Page 1 of 1

OSCAR SURFACE CURRENTS

PostPosted: Fri Jun 14, 2019 5:03 am
by nfamayamartinez
P00DAC PEOPLE, IM WORKING IN THE VARIABILITY OF CARIBBEAN SURFACE CURRENTS, BUT I DONT KNOW HOW TO PROCESS THE NETCDF DATA IN MATLAB SOTWARE

THANKS :geek:

Re: OSCAR SURFACE CURRENTS

PostPosted: Mon Jun 17, 2019 12:18 pm
by jimp
Hi,

Matlab has two functions that should help you out, "ncdisp" and "ncread". The first will display the metadata in the netcdf file. This can work on local files as well as OPENDAP URLs.

For example, if you navigate to https://podaac.jpl.nasa.gov/, then select "THREDDS" under the data access tab, you can successively click to OceanCirculation and then 1992-current YEARS OSCAR Third Degree Resolution Ocean Surface Currents Time Aggregation and finally OPENDAP.

The end result should put you here https://thredds.jpl.nasa.gov/thredds/do ... eg.nc.html

At the top of this page you'll see the access URL. All the THREDDS data should work in this way. In this case it's https://thredds.jpl.nasa.gov/thredds/do ... ird-deg.nc

If you enter that URL into ncdisp you should get a metadata listing:

URL = 'https://thredds.jpl.nasa.gov/thredds/dodsC/ocean_circulation/ALL_OSCAR_L4_OC_third-deg.nc';
ncdisp(URL)

This will tell you the variable names and dimensions. With this information you can access the data directly. For example, latitude is called "latitude" in this data set. To read this into Matlab as the variable "lat",

URL = 'https://thredds.jpl.nasa.gov/thredds/dodsC/ocean_circulation/ALL_OSCAR_L4_OC_third-deg.nc';
lat = ncread(URL,'latitude');

and so on with other variables. Note the syntax for ncread is URL name followed by remote variable name, and then optionally the specific data "slice" you want (start index, number points, and increment). For large data sets like this you'll need to subset.

More details can be found at https://www.mathworks.com/help/matlab/ref/ncread.html

Hope this helps.

Jim