Closed mariuskist closed 7 years ago
Is there a way to read 10 variables from one source file remotely from an OPeNDAP server with a single server access using nctoolbox ?
Here’s a code snippet that reads the last 10 variables of your file into a Matlab structure.
ds = ncgeodataset(f); v = ds.variables; n = length(v); for i = n:-1:n - 10 varname = v{i}; m.(varname) = ds.data(varname); end m
Brian Schlining
On September 15, 2016 at 6:16:38 AM, marius (notifications@github.com) wrote:
Hello,
We currently use nctoolbox to read and store meteorological grib2 data remotely from the CFSR database using MATLAB.
The following filepath is an example OPeNDAP database accessed by nctoolbox
"filepath = http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cmd_pgbh/2006/200604/20060404/pgbh05.gdas.2006040418.grb2; "
The source grib2 file is stored in a ncgeodataset object.
"ds=ncgeodataset(filepath);"
The variable of choice is retrived using a in a geovariable .
"CFSR_variablename = 'Temperature_height_above_ground'; %air temperature in 2 m height variable = ds.geovariable(CFSR_variablename);"
Currently, nctoolbox, recursively, calls files which contains values of a lot of parameters. Amongst these parameters are ~10 required parameters for each file = point of time. This is done to download a time history of the required parameters.
Up to now, I have to access the same file containing 10 required parameters for the same time, 10 times. Once for each parameter. This is because I don't see a way to use "ds.geovariable" for more than one variable. E.g. "[variable1,variable2] = ds.geovariable(Temperature_surface,Pressure_surface)"
The multiple accesses make my script quite slow. Therefore, I would like to access one file and retrieve all required parameters all at once.
Is there a way to read 10 variables from one source file remotely from an OPeNDAP server with a single server access using nctoolbox ? I did not find an example in the documentation but I did not find it denied either.
Thank you and best regards Marius
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nctoolbox/nctoolbox/issues/93, or mute the thread https://github.com/notifications/unsubscribe-auth/AARRPYAafh_wfoYunnQfFWLKJPSEkGwcks5qqUU1gaJpZM4J92m7 .
That worked. Thanks a lot.
Hello,
We currently use nctoolbox to read and store meteorological grib2 data remotely from the CFSR database using MATLAB.
The following filepath is an example OPeNDAP database accessed by nctoolbox
"filepath = http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cmd_pgbh/2006/200604/20060404/pgbh05.gdas.2006040418.grb2;"
The source grib2 file is stored in a ncgeodataset object.
"ds=ncgeodataset(filepath);"
The variable of choice is retrived using a in a geovariable .
"CFSR_variablename = 'Temperature_height_above_ground'; %air temperature in 2 m height variable = ds.geovariable(CFSR_variablename);"
Currently, nctoolbox, recursively, calls files which contains values of a lot of parameters. Amongst these parameters are ~10 required parameters for each file = point of time. This is done to download a time history of the required parameters.
Up to now, I have to access the same file containing 10 required parameters for the same time, 10 times. Once for each parameter. This is because I don't see a way to use "ds.geovariable" for more than one variable. E.g. "[variable1,variable2] = ds.geovariable(Temperature_surface,Pressure_surface)"
The multiple accesses make my script quite slow. Therefore, I would like to access one file and retrieve all required parameters all at once.
Is there a way to read 10 variables from one source file remotely from an OPeNDAP server with a single server access using nctoolbox ? I did not find an example in the documentation but I did not find it denied either.
Thank you and best regards Marius