[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #RYR-340344]: one problem of ucar.jar



Tim,

I rewrote your program to use NetcdfFile.open but it gave the error below. But 
I tried it on our server using url3 and it worked fine. So I don't think it's 
the code's logic but the GDS server capability. I could be wrong but this is 
what I found, I'll ask the dods support person for more information about the 
exception. I have some notes after the code snippet.

java.io.IOException: Server does not support byte Ranges


public class TestGMU {
  public static void main(String[] args) {
      String url1 = 
"http://unidata.cos.gmu.edu:9090/dods/Sheffield/daily/dlwrf_daily_1948_1948.dods?dlwrf[0][1][0][0:179]
 [0:359]";
      String url2 = 
"http://unidata.cos.gmu.edu:9090/dods/Sheffield/daily/dlwrf_daily_1948_1948";;
      String url3 = 
"http://motherlode.ucar.edu:8080/thredds/fileServer/fmrc/NCEP/GFS/Alaska_191km/files/GFS_Alaska_191km_20090911_1200.grib1";;
       try {

         NetcdfFile ncf = NetcdfFile.open( url3 );

         Variable Pressure_tropopause = ncf.findVariable( 
"Pressure_tropopause");
         Array data = Pressure_tropopause.read( "0,0:38,0:44");
         //Variable dlwrfVar = ncf.findVariable( "dlwrf");
         //Array data = dlwrfVar.read( "0,1,0,0:179,0:359");

          
         System.out.println( "Success");
       } catch (Exception exc) {
              exc.printStackTrace();
       }
    }
}

  NetcdfFile is the preferred entry point into the netCDF-Java API.  
  url2 is the basic OPeNDAP dataset URL. All the ".dods?..." stuff
  (also ".dds" and ".das") is part of the OPeNDAP protocol which
  the netCDF-Java uses under the hood to satisfy all netCDF-Java
  API requests on an OPeNDAP dataset.

  dlwrfVar.read( "0,1,0,0:179,0:359") explanation:
  The netCDF-Java API uses the Fortran 90 array section string
  format; the OPeNDAP protocol uses a different standard which
  uses square brackets. I also think the start/stride/end order
  is different (start/end/stride) but I forget which is which.

  here are other ways to request a section of data:

  - read( int[] origin, int[] shape)
  - read( List<Range> ranges)
  - read( Section section)

  But the one using "0,1,0,0:179,0:359" is the most direct
  mapping from the OPeNDAP URL given above. But it requires
  parsing the string and converting it into one of the other
  forms. So if lots of requests are going to be made, one of
  the other forms is better.


  Robb...

Ticket Details
===================
Ticket ID: RYR-340344
Department: Support netCDF Java
Priority: Normal
Status: Open