Re: [netcdf-java] Creating unlimited dimension


Thanks Jeff,

Seems to work if I create thusly:

Dimension timedim = ncout.addDimension("TIME", 0, true, true, false);

though I'll try the addUnlimitedDimension method, too.

Trying to get faster read times with the version 2.2.22 over opendap.

Cheers,
Chris

_________________________________________________________________
Christopher W. Moore...(206)526-6779...christopher.moore@xxxxxxxx
Pacific Marine Environmental Lab....NCTR..............Seattle, WA
-----------------------------------------------------------------

On Tue, 6 May 2008, Jeff Van Dorn wrote:

Hi Chris,

I believe you need to do something like:

Dimension timedim = ncout.addUnlimitedDimension("time");

See the last example at:

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

Hope that helps,
Jeff


On May 6, 2008, at 5:30 PM, Christopher.Moore@xxxxxxxx wrote:


I'm trying upgrade to netcdf 2.2.22... I used to create a netcdf file with
unlimited time dimension using:

        Dimension timedim = ncout.addDimension("TIME",-1);

but now I try,

        Dimension londim = ncout.addDimension("LON", isize);
        Dimension latdim = ncout.addDimension("LAT", jsize);
Dimension timedim = ncout.addDimension("TIME", 0, true, true, true);
        Dimension[] dim3 = new Dimension[] {timedim,latdim,londim};
        ncout.addVariable(varName[varNum], float.class, dim3);


and I get:

java.lang.IllegalArgumentException: Unknown dimension can only be used in 1 dim
array
        at ucar.nc2.Variable.setDimensions(Variable.java:1137)
        at
ucar.nc2.NetcdfFileWriteable.addVariable(NetcdfFileWriteable.java:335)
        at
ucar.nc2.NetcdfFileWriteable.addVariable(NetcdfFileWriteable.java:279)
        at
gov.noaa.tsunami.cmi.LinCombModule.downloadFile(LinCombModule.java:325)

Any ideas?  I can't find a simple example for creating with unlimited
dimension...

Cheers,
Chris

_________________________________________________________________
Christopher W. Moore...(206)526-6779...christopher.moore@xxxxxxxx
Pacific Marine Environmental Lab....NCTR..............Seattle, WA
-----------------------------------------------------------------
_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/



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