This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
John, You responded: > New Staff Reply: converting grib2 files to netcdf using wgrib2 -netcdf > > Im not sure what you mean by a "Grib2 file". Everything inside the CDM librar > y uses the NetcdfFile abstraction. > > > Dear Unidata: > > > > Thanks for the help. When I wrap the original dataset in ncml, can the > > original dataset be a Grib2 file or must it be NetCDF? I think the answer to his question may be just "Yes", because he was converting Grib2 files to netCDF using: java -Xmx512m -classpath netcdfAll-4.0.jar ucar.nc2.dataset.NetcdfDataset -in myfile.grib2 -out out.nc so now he wants to know if he can just create an ncml wrapper for myfile.grib2 and instead use: java -Xmx512m -classpath netcdfAll-4.0.jar ucar.nc2.dataset.NetcdfDataset -in myfile.ncml -out out.nc I think you had previously indicated he could use the <remove> element of ncml, so maybe he's asking about a grib2 file that contains a collection of grib2 objects appended together, and does the <remove> element still work in this case to remove some of them from the resulting output netCDF file ... --Russ > > Thanks, > > > > Larry Mastin > > > > David A. Johnston Cascades Volcano Observatory > > 1300 SE Cardinal Court, Bldg. 10, Suite 100 > > Vancouver, WA 98683 USA > > tel. 360-993-8925 fax 360-993-8980 > > http://vulcan.wr.usgs.gov/Projects/Mastin > > -----Original Message----- > > From: Unidata netCDF Java Support > > [mailto:address@hidden] > > Sent: Friday, November 06, 2009 2:59 PM > > To: address@hidden > > Cc: address@hidden > > Subject: [netCDF #HOT-122007]: converting grib2 files to netcdf using wgrib > 2 > > -netcdf > > > > The -isLargeFile option is now in the lastest 4.1 release at: > > > > http://www.unidata.ucar.edu/software/netcdf-java/ > > > > under the "Development version 4.1" downloads. > > > > You can wrap the original dataset in ncml, and use the <remove> element to > > remove the ones you dont want, see > > > > http://www.unidata.ucar.edu/software/netcdf/ncml/ > > > > example at: > > > > http://www.unidata.ucar.edu/software/netcdf/ncml/v2.2/Cookbook.html#remove > > > > the xml file must have the suffix ".ncml", and it then becomes the "in" > > file: > > > > java -Xmx512m -classpath netcdfAll-4.0.jar ucar.nc2.dataset.NetcdfDataset > > -in myfile.ncml -out out.nc > > > > > Russ: > > > > > > Thanks again for the quick response. Actually, I only need the wind fiel > d > > > data (UGRD, VVEL, AND VGRD), and only for a particular geographic > > subregion. > > > If there's a way to just convert those data to NetCDF, the -isLargeFile > > > option won't be necessary. > > > > > > I'm just learning how to do this. I'll poke through the NetCDF-Java > > > documentation. If you know offhand how it would be done and can tell me, > > > that would be even better. > > > > > > Thanks again, > > > > > > Larry > > > > > > David A. Johnston Cascades Volcano Observatory > > > 1300 SE Cardinal Court, Bldg. 10, Suite 100 > > > Vancouver, WA 98683 USA > > > tel. 360-993-8925 fax 360-993-8980 > > > http://vulcan.wr.usgs.gov/Projects/Mastin > > > -----Original Message----- > > > From: Unidata netCDF Java Support > > > [mailto:address@hidden] > > > Sent: Thursday, November 05, 2009 4:41 PM > > > To: address@hidden > > > Cc: address@hidden > > > Subject: [netCDF #HOT-122007]: converting grib2 files to netcdf using > > wgrib2 > > > -netcdf > > > > > > Hi Larry: > > > > > > The problem is that the 2 Gb netcdf file limit is being exceeded (yes it > > > expands that much!). I will add a -isLargeFile option to allow writing to > > > the 64-bit offset version. It will take a few days to get teh release out > , > > > ill let you know when its ready. > > > > > > > Thanks, Russ. > > > > > > > > I downloaded NetCDFAll-4.0.jar from that site and it now finds the main > > > > class. However I am getting another error message indicating the > > > > variable starting position is exceeding an allowed value (see below). > > > > > > > > My grib2 file is pretty big (383 Mb). Is there a size limit to the > > > > grib2 files that can be read? > > > > > > > > Thanks, > > > > > > > > Larry > > > > > > > > ******************************************************************* > > > > Command & error messages below: > > > > > > > > lgmastin@phobos:~/ncj> java -Xmx512m -classpath netcdfAll-4.0.jar > > > > ucar.nc2.dataset.NetcdfDataset -in > > > > ~/grib2/testfiles/NAM_Alaska_11km_20090920_0600.grib2 -out > > > > ~/grib2/testfiles/NAM_Alaska_11km_20090920_0600.nc > > > > Read > > > > from /home/lgmastin/grib2/testfiles/NAM_Alaska_11km_20090920_0600.grib2 > > > > write to /home/lgmastin/grib2/testfiles/NAM_Alaska_11km_20090920_0600.n > c > > > > > > > > Exception in thread "main" java.lang.IllegalArgumentException: Variable > > > > starting pos=2343709348 may not exceed 2147483647 > > > > at ucar.nc2.iosp.netcdf3.N3header.writeHeader(N3header.java:626) > > > > at ucar.nc2.iosp.netcdf3.N3header.create(N3header.java:560) > > > > at ucar.nc2.iosp.netcdf3.N3iosp.create(N3iosp.java:640) > > > > at ucar.nc2.NetcdfFileWriteable.create(NetcdfFileWriteable.java:594) > > > > at ucar.nc2.FileWriter.writeToFile(FileWriter.java:195) > > > > at ucar.nc2.dataset.NetcdfDataset.main(NetcdfDataset.java:1600) > > > > > > > > > > > > On Thu, 2009-11-05 at 16:11 -0700, Unidata netCDF Java Support wrote: > > > > > Larry, > > > > > > > > > > Alternatively, if from > > http://www.unidata.ucar.edu/software/netcdf-java/ > > > > > you had downloaded > > > > > > > > > > "The complete netCDF library (MD5) implements the full CDM model, > > with > > > all dependent jars included." > > > > > > > > > > you would have gotten netcdfAll-4.0.jar file instead of the .zip fil > e > > > you used, and that would have worked, using: > > > > > > > > > > java -Xmx512m -classpath netcdfAll-4.0.jar > > > ucar.nc2.dataset.NetcdfDataset -in > > > ~/grib2/testfiles/NAM_Alaska_11km_20090920_0600.grib2 -out > > > > > ~/grib2/testfiles/NAM_Alaska_11km_20090920_0600.nc > > > > > > > > > > --Russ > > > > > > > > > > > > > > > Russ Rew UCAR Unidata Program > > > > > address@hidden http://www.unidata.ucar.edu > > > > > > > > > > > > > > > > > > > > Ticket Details > > > > > =================== > > > > > Ticket ID: HOT-122007 > > > > > Department: Support netCDF Java > > > > > Priority: Normal > > > > > Status: Closed > > > > > > > > > > > > > > > > > > > > > > Ticket Details > > > =================== > > > Ticket ID: HOT-122007 > > > Department: Support netCDF Java > > > Priority: Normal > > > Status: Open > > > > > > > > > > > > > > > > > > Ticket Details > > =================== > > Ticket ID: HOT-122007 > > Department: Support netCDF Java > > Priority: Normal > > Status: Closed > > > > > > > > > > > Ticket Details > =================== > Ticket ID: HOT-122007 > Department: Support netCDF Java > Priority: Normal > Status: Closed > Link: https://www.unidata.ucar.edu/esupport/staff/index.php?_m=tickets&_a=vi > ewticket&ticketid=10101 Ticket Details =================== Ticket ID: HOT-122007 Department: Support netCDF Java Priority: Normal Status: Closed