[netcdf-java] Creating unlimited dimension
Christopher.Moore at noaa.gov
Christopher.Moore at noaa.gov
Tue May 6 17:20:49 MDT 2008
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 at noaa.gov
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 at noaa.gov 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 at noaa.gov
>> Pacific Marine Environmental Lab....NCTR..............Seattle, WA
>> -----------------------------------------------------------------
>> _______________________________________________
>> netcdf-java mailing list
>> netcdf-java at unidata.ucar.edu
>> For list information or to unsubscribe, visit:
>> http://www.unidata.ucar.edu/mailing_lists/
>
More information about the netcdf-java
mailing list