Re: [netcdf-java] Documentation or Direction on defining dimensions of variables in DODSNetcdfFile

Thank you Ethan,

I ended up trying DODSNetcdfFile because it was the only way I could get the 
netcdf library to read from without a Content 
Length error, or Range Access error.  I was hoping that there was some header 
that I could add to my request that would allow me to query the thredds dods 
server with these features.  The netcdf version which I am using 4.2.20, seems 
to only have static method for dods via open(String location, int buffer_size, 
ucar.nc2.util.CancelTask cancelTask, Object iospMessage) which nomads at ncdc 
doesn't seem to support.

Can netcdf make a query equivilent to[0][2][100][300]

Thank You
Jacob Sheck
From: netcdf-java-bounces@xxxxxxxxxxxxxxxx 
[netcdf-java-bounces@xxxxxxxxxxxxxxxx] On Behalf Of Ethan Davis 
Sent: Friday, October 21, 2011 12:02 AM
To: netcdf-java@xxxxxxxxxxxxxxxx
Subject: Re: [netcdf-java] Documentation or Direction on defining dimensions of 
variables in DODSNetcdfFile

Hi Jake,

Instead of using DODSNetcdfFile directly, try using the method.

There are some examples of reading data in the NetCDF-Java tutorial:

In particular, see the NetcdfFile section:

which describes a few ways that subsets of data can be read.

Hope that helps,


On 10/20/2011 9:17 PM, Jake Sheck wrote:
> UCAR NetCDF mail group,
> I am working on acquiring small amounts of GFS, NAM and RUC data
> from As a test I am trying to collect
>Temperature variable for a particular point. I can easily acquire
> this data via my web browser with this link.
> I would like to collect this variable via the netcdf java library.
> However I can't seem to find documentation on the correct use of the
> dimensions variables in the readSection or readArrays methods of the
> DODSNetcdfFile. Could anyone please direct me to documentation for
> these? I have found that even when I specifiy dimenions for a variable
> it still downloads the complete grid and takes much longer than the link
> above.
> Here is an example of what I am trying to do.
> String modelFile = 
> "";;
> DODSNetcdfFile ncfile = new DODSNetcdfFile( modelFile );
> Dimension time = new Dimension("time", 1);
>                 Dimension pressure = new Dimension("pressure",1);
>                 Dimension xd = new Dimension("x", 126);
>                 Dimension yd = new Dimension("y", 557);
>                 List<Dimension> ds = new ArrayList<Dimension>();
>                 ds.add(time);
>                 ds.add(pressure);
>                 ds.add(xd);
>                 ds.add(yd);
> for(Variable v : ncfile.getVariables()){
>       if(v.getName.equals("Temperature_height_above_ground"))
>              preloadVariables.add(v);
> }
> List<Array> arrays = ncfile.readArrays( preloadVariables );
> Here I get the variable for temperature, but I get the whole set, and
> not a set limited by the dimensions that I set.
> Thanks
> Jacob Sheck

netcdf-java mailing list
For list information or to unsubscribe, visit:

CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended 
recipient(s) and may contain confidential and privileged information. Any 
unauthorized review, use, disclosure or distribution of any kind is strictly 
prohibited. If you are not the intended recipient, please contact the sender 
via reply e-mail and destroy all copies of the original message. Thank you.

  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: