[netcdf-java] Creating unlimited dimension
Jeff Van Dorn
jeffvandorn at yahoo.com
Tue May 6 16:46:35 MDT 2008
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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.unidata.ucar.edu/mailing_lists/archives/netcdf-java/attachments/20080506/29be11df/attachment.html
More information about the netcdf-java
mailing list