Re: Java NetCDF problem...

you are using units "days since 0000-1-1"

perhaps you are using a different calendar than udunits expects ?? perhaps one 
that expects 365 days per year ??

udunits uses Gregorian calendar.

time
 {730015.5, 730045.0, 730074.5, 730105.0, 730135.5, 730166.0, 730196.5, 
730227.5, 730258.0, 730288.5, 730319.0, 730349.5, 730380.5, 730410.0, 730439.5, 
730470.0, 730500.5, 730531.0, 730561.5, 730592.5, 730623.0, 730653.5, 730684.0, 
730714.5, 730745.5, 730775.0, 730804.5, 730835.0, 730865.5, 730896.0, 730926.5, 
730957.5, 730988.0, 731018.5, 731049.0, 731079.5, 731110.5, 731140.0, 731169.5, 
731200.0, 731230.5, 731261.0, 731291.5, 731322.5, 731353.0, 731383.5, 731414.0, 
731444.5, 731475.5, 731505.0, 731534.5, 731565.0, 731595.5, 731626.0, 731656.5, 
731687.5, 731718.0, 731748.5, 731779.0, 731809.5, 731840.5, 731870.0, 731899.5, 
731930.0, 731960.5, 731991.0, 732021.5, 732052.5, 732083.0, 732113.5, 732144.0, 
732174.5, 732205.5, 732235.0, 732264.5, 732295.0, 732325.5, 732356.0, 732386.5, 
732417.5, 732448.0, 732478.5, 732509.0, 732539.5, 732570.5, 732600.0, 732629.5, 
732660.0, 732690.5, 732721.0, 732751.5, 732782.5, 732813.0, 732843.5, 732874.0, 
732904.5, 732935.5, 732965.0, 732994
.5, 733025.0, 733055.5, 733086.0, 733116.5, 733147.5, 733178.0, 733208.5, 
733239.0, 733269.5, 733300.5, 733330.0, 733359.5, 733390.0, 733420.5, 733451.0, 
733481.5, 733512.5, 733543.0, 733573.5, 733604.0, 733634.5}

1998-09-16 12:00:00Z
1998-10-16 00:00:00Z
1998-11-14 12:00:00Z
1998-12-15 00:00:00Z
1999-01-14 12:00:00Z
1999-02-14 00:00:00Z
1999-03-16 12:00:00Z
1999-04-16 12:00:00Z
1999-05-17 00:00:00Z

Nathan Wilhelmi wrote:
Hi John,
Thanks for the previous help. We are having some problems with dates on the same file. I believe the first date for the file should be Jan 15 2000. However we are getting back values that seem out of range. The code below is returning 1998-09-16 12:00:00Z -> 2008-08-13 12:00:00Z for the range. 2000-1 to 2009-12 is the expected range. Dumping the time variable shows the first value to be 730015.5, which seems as expected. Any thoughts if this is an library usage error, file units error?

Thanks!!!!

-Nate

CoordinateAxis1DTime timeAxis = coordSys.getTimeAxis1D();
String timeUnit = timeAxis.getTimeResolution().getUnitString();
       if (logger.isDebugEnabled()) {
           logger.debug("loadTimeSlices() - String timeUnit=" + timeUnit);
       }

       DateRange range = timeAxis.getDateRange();

logger.debug("Start: " + range.getStart().getText() + " End: " + range.getEnd().getText());
             Date[] dates = timeAxis.getTimeDates();


***
netcdf parents {
dimensions:
       bnds = 2 ;
       lon = 1405 ;
       lat = 621 ;
       time = UNLIMITED ; // (120 currently)
       parentlons = 41 ;
       parentlats = 19 ;
variables:
       int bnds(bnds) ;
       double lon(lon) ;
               lon:units = "degrees_east" ;
               lon:axis = "X" ;
               lon:standard_name = "longitude" ;
               lon:bounds = "lon_bnds" ;
               lon:long_name = "longitude" ;
       double lon_bnds(lon, bnds) ;
               lon_bnds:units = "degrees_east" ;
               lon_bnds:missing_value = -999. ;
       double lat(lat) ;
               lat:units = "degrees_north" ;
               lat:axis = "Y" ;
               lat:standard_name = "latitude" ;
               lat:bounds = "lat_bnds" ;
               lat:long_name = "latitude" ;
       double lat_bnds(lat, bnds) ;
               lat_bnds:units = "degrees_north" ;
               lat_bnds:missing_value = -999. ;
       double time(time) ;
               time:units = "days since 0000-1-1" ;
               time:calendar = "noleap" ;
               time:standard_name = "time" ;
               time:axis = "T" ;
               time:long_name = "time" ;
               time:bounds = "time_bnds" ;
       double time_bnds(time, bnds) ;
               time_bnds:units = "days since 0000-1-1" ;
               time_bnds:missing_value = -999. ;
       double parentlons(parentlons) ;
               parentlons:units = "degrees_east" ;
       double parentlats(parentlats) ;
               parentlats:units = "degrees_north" ;
       float parentvar(time, parentlats, parentlons) ;
               parentvar:units = "K" ;
               parentvar:missing_value = -999.f ;
               parentvar:original_varname = "tas" ;
               parentvar:standard_name = "air_temperature" ;
               parentvar:long_name = "air_temperature" ;
       float tas(time, lat, lon) ;
               tas:units = "K" ;
               tas:missing_value = -999.f ;
               tas:cell_method = "time: mean" ;
               tas:cell_methods = "time: mean (interval: 1 month)" ;
               tas:cell_step1 = "thin-plate spline to dense grid" ;
               tas:cell_step2 = "apply linear model based on PRISM" ;
               tas:standard_name = "air_temperature" ;
               tas:long_name = "air_temperature" ;

// global attributes:
:CoefficientFileName = "/ptmp/thoar/downscaling/coeffs_tave_1895_2005.nc" ;
               :PrismDataSource = "PRISM Group, Oregon State University" ;
               :PrismDataURL = "http://www.ocs.orst.edu/prism/"; ;
               :PrismDataOrigin = "ftp.ncdc.noaa.gov/pub/data/prism100" ;
               :PrismDataRetrievalDate1_1895_1997 = "30 Aug 2006" ;
               :PrismDataRetrievalDate2_1998_2005 = "20 Oct 2006" ;
:ParentDataFileName = "tas_A1.SRESA1B_6.CCSM.atmm.2000-01_cat_2099-12.nc" ;
               :netCDFCreatedBy = "Tim Hoar - thoar@xxxxxxxx" ;
               :CreationDate = "Tue Apr 17 13:55:49 2007" ;
:history = "Fri Apr 20 08:29:55 2007: ncks -A bounds.nc parents.nc\n", "Wed Apr 18 10:28:42 2007: ncks -A time_bnds.2000-01_cat_2009-12.nc tas_A1.SRESA1B_6.CCSM.atmm.2000-01_cat_2009-12.downscaled.org.nc\n",
   " " ;
               :Conventions = "CF-1.0" ;
               :realization = 6 ;
:experiment_id = "720 ppm stabilization experiment (SRES A1B)" ;
}
***


John Caron wrote:
Hi Nathan:

Its a bug in the Java NetCDF library: its unusual to have non-contiguous coordinate bounds. Its now fixed in development release 2.2.19.13 at:

http://www.unidata.ucar.edu/software/netcdf-java/

It looks like your coordinates are off, as you'll see if you look at it in the GridViewer tab.

Thanks for reporting!

John

Nathan Wilhelmi wrote:
Hello - I have been working with Tim Hoar on a NetCDF file that we need to load up in the Java NetCDF library. It is crashing with a null pointer exception when creating the grid coordinate system. Is there anyway we can get the file (~400mb) to you or who ever would be best to take a look and try to spot the problem. We can't find it.

Thanks!

-Nate Wilhelmi
ext 1839