Re: [netcdf-java] acces remote NetcdfSubset from NetCDF java library

Hi Alexis,

The netCDF-java library can't open a dataset when handed a NetCDF Subset
Service (NCSS) URL. It can open HTTP served netCDF files when the server
supports HTTP byte ranges. However, the NCSS does not (for various
reasons) support HTTP byte ranges.

If you give it the OPeNDAP URL for the same dataset

> http://motherlode.ucar.edu:8080/thredds/dodsC/fmrc/NCEP/GFS/Global_0p5deg/runs/NCEP-GFS-Global_0p5deg_RUN_2011-04-01T00:00:00Z

you will be able to open the dataset. You would then have to do your
subsetting through the netCDF API rather than through the NCSS.

Of course, the other option is to use the NCSS service to download the
subset dataset and then open the local netCDF file directly.

Hope that helps,

Ethan

On 5/3/2011 4:19 AM, alexis wrote:
> Hi,
> 
> I would like to get data from a NetcdfSubset using the NetCDF java library.
> I made different tries without any success.
> 
> I am passing through a proxy and I think the parameter were set correctly.
> I tried either with the version 4.1 and 4.2 of the library.
> With version 4.1 I used this code:
> 
> // Set proxy if specified 
> if (this.proxyHost != null) {
>       httpClient.getHostConfiguration().setProxy(
>               this.proxyHost, 
>               this.proxyPort);
> }
> NetcdfDataset.setHttpClient(httpClient);
> 
> 
> With version 4.2 I used this code:
> 
> // Set proxy if specified 
> if (this.proxyHost != null) {
>       System.setProperty("http.proxyHost", this.proxyHost);
>       System.setProperty("http.proxyPort", String.valueOf(this.proxyPort));
> }
> 
> 
> 
> The URL I use to get the data is:
> http://motherlode.ucar.edu:8080/thredds/ncss/grid/fmrc/NCEP/GFS/Global_0p5deg/runs/NCEP-GFS-Global_0p5deg_RUN_2011-04-01T00:00:00Z?var=U-component_of_wind_height_above_ground,V-component_of_wind_height_above_ground,Temperature_height_above_ground&temporal=range&time_start=2011-04-01T00:00:00&time_end=2011-04-08T12:00:00&spatial=bb&south=15.5&north=16.5&west=-62.0&east=-61.0
> 
> When I copy / paste this URL on my browser, I am able to save the nc file.
> So I do not know I am doing wrong.
> 
> I tried both with either:
> 
> this.netcdfFile = NetcdfFile.open(filepath);
> this.netcdfFile = NetcdfDataset.openFile(filepath, null);
> 
> 
> But I get the same error at the end which is:
> Cant read
> http://motherlode.ucar.edu:8080/thredds/ncss/grid/fmrc/NCEP/GFS/Global_0p5deg/runs/NCEP-GFS-Global_0p5deg_RUN_2011-04-01T00:00:00Z?var=U-component_of_wind_height_above_ground,V-component_of_wind_height_above_ground,Temperature_height_above_ground&temporal=range&time_start=2011-04-01T00:00:00&time_end=2011-04-08T12:00:00&spatial=bb&south=15.5&north=16.5&west=-62.0&east=-61.0:
> not a valid CDM file.
> 
> I also tried with:
> 
> NetcdfDataset.initNetcdfFileCache(100,200000,15*60);
> this.netcdfFile = NetcdfDataset.acquireFile(filepath, null);
> 
> 
> But again I got the same error.
> 
> Could somebody tell if what I am trying to do is possible. And if so help me
> on how to do it.
> 
> Thanks,
> 
> Alex
> 
> 
> 
> --
> View this message in context: 
> http://netcdf-java.1577316.n2.nabble.com/acces-remote-NetcdfSubset-from-NetCDF-java-library-tp6326804p6326804.html
> Sent from the NetCDF-Java mailing list archive at Nabble.com.
> 
> _______________________________________________
> netcdf-java mailing list
> netcdf-java@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe, visit: 
> http://www.unidata.ucar.edu/mailing_lists/ 



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