ncl_grib2nc
ncl_grib2nc converts one or more GRIB1 or GRIB2 files to netCDF formatted files. This tool was deprecated in version 4.2.0.a034. Use ncl_convert2nc instead.Note: in version 4.3.0, support was added for GRIB2 files.
Synopsis
ncl_grib2nc gribFile(s) OPTIONS gribFile(s) name of GRIB file(s) [required] [-i input_directory] location of input file(s) [default: current directory] [-o output_directory] location of output file(s) [default: current directory] [-v var1[,...]] user specified subset of variables [default: all variables] ncl_filedump can be used to determine desired variable names [-L] support for writing large (>2Gb) netCDF files [default: no largefile support] [-c comment] text to be included in netCDF file attribute [default: no comment] [-d] upon exit: print contents each netCDF file [like ncdump -h] [-h] this usage message
Description
ncl_grib2nc converts one or more GRIB files to netCDF formatted files. Each input file must be a GRIB1 or GRIB2 file that NCL can read. The output filenames will have the same name as the input filenames, except the output filenames have the '.nc' extension. Each input GRIB file will result in a corresponding netCDF file.
Options
ncl_grib2nc accepts the following options:
- gribFile(s)
- The name of the input GRIB file(s). More than one input filename may be
specified; in this case, each file is processed individually. The input
filenames are not required to have the ".grb" extension. This argument
is required.
- -i input_directory
- The location of input files. Defaults to the current working directory.
- -o output_directory
- The location where output files will be written. Defaults to the current working directory.
- -v var1[,...]
- Specifies one or more variable names to be included in the output netCDF
file. One or more variables must be specified by name, in a comma-delimited
list (without blanks or other whitespace characters). Named variables must be valid
within the input file.
- -L
- Specifies that the resultant netCDF output file may exceed 2Gb in size on
platforms that have "large file support" (LFS). However, no single variable
may exceed 2Gb in the current implementation.
- -c comment
- User-supplied text to be included as a netCDF file attribute called "comment."
- -h
- Display a short message explaining the command usage, and exit.
Examples
Example 1
The following converts the input GRIB file 'U12345' to a netCDF-formatted file called 'U12345.nc' written in the current working directory. The extension '.grb' is assumed for the input file. The resultant netCDF file is shown (in part).
% ncl_grib2nc U12345 [...] filename: U12345 path: U12345.nc file global attributes: creation_date : Wed Nov 2 13:47:15 MST 2005 NCL_Version : 4.2.0.a033 system : Linux jupiter 2.4.20-37.9.legacy #1 Mon Sep 27 18:16:43 EDT 2004 i686 athlon i386 GNU/Linux conventions : None grib_source : U12345.grb title : NCL: GRIB-to-netCDFExample 2
The following converts the input GRIB files 'U12345' and 'U67890' located in the directory /data/dss/GRIB to netCDF-formatted files called 'U12345.nc' and 'U67890.nc' written in the directory /data/dss/netCDF. The extension '.grb' is assumed for the input file. The resultant netCDF file is shown(in part).
% ncl_grib2nc U12345 U67890 -i /data/dss/GRIB -o /data/dss/netCDF [...] filename: U12345 path: /data/dss/netCDF/U12345.nc file global attributes: creation_date : Wed Nov 2 13:47:15 MST 2005 NCL_Version : 4.2.0.a033 system : Linux jupiter 2.4.20-37.9.legacy #1 Mon Sep 27 18:16:43 EDT 2004 i686 athlon i386 GNU/Linux conventions : None grib_source : U12345.grb title : NCL: GRIB-to-netCDF [...] filename: U67890 path: /data/dss/netCDF/U67890.nc file global attributes: creation_date : Wed Nov 2 13:48:02 MST 2005 NCL_Version : 4.2.0.a033 system : Linux jupiter 2.4.20-37.9.legacy #1 Mon Sep 27 18:16:43 EDT 2004 i686 athlon i386 GNU/Linux conventions : None grib_source : U67890.grb title : NCL: GRIB-to-netCDFExample 3
The following converts the input GRIB files 'U12345' and '/data/ncep/ncep05062005.grb' to nettCDF-formatted files called 'U12345.nc' and 'ncep05062005.nc' written in the current working directory. The extension '.grb' is assumed for the inut file 'U12345.' The resultant netCDF file is shown(in part).
% ncl_grib2nc U12345 /data/ncep/ncep05062005.grb [...] filename: U12345 path: U12345.nc file global attributes: creation_date : Wed Nov 2 13:47:15 MST 2005 NCL_Version : 4.2.0.a033 system : Linux jupiter 2.4.20-37.9.legacy #1 Mon Sep 27 18:16:43 EDT 2004 i686 athlon i386 GNU/Linux conventions : None grib_source : U12345.grb title : NCL: GRIB-to-netCDF [...] filename: ncep05062005 path: ncep05062005.nc file global attributes: creation_date : Wed Nov 2 13:48:02 MST 2005 NCL_Version : 4.2.0.a033 system : Linux jupiter 2.4.20-37.9.legacy #1 Mon Sep 27 18:16:43 EDT 2004 i686 athlon i386 GNU/Linux conventions : None grib_source : /data/ncep/ncep05062005.grb title : NCL: GRIB-to-netCDFExample 4
The following converts the input GRIB file 'U12345' located in the current working directory to a netCDF-formatted file called 'U12345.nc' written in the current working directory and sets the netCDF 'comment' attribute to the text 'Data Support Section: ds124.1'. The extension '.grb' is assumed for the input file. The resultant netCDF file is shown (in part).
% ncl_grib2nc U12345 -c 'Data Support Section: ds124.1' [...] filename: U12345 path: U12345.nc file global attributes: comment: Data Support Section: ds124.1 creation_date : Wed Nov 2 13:47:15 MST 2005 NCL_Version : 4.2.0.a033 system : Linux jupiter 2.4.20-37.9.legacy #1 Mon Sep 27 18:16:43 EDT 2004 i686 athlon i386 GNU/Linux conventions : None grib_source : U12345.grb title : NCL: GRIB-to-netCDFExample 5
The following converts the input GRIB file 'U12345' located in the current working directory to a netCDF-formatted file called 'U12345.nc' written in the current working directory and writes only the variables 'PRES_6_SFC' and 'PRES_6_TRO' to the output file. The output file supports netCDF-formatted "large files;" that is, files larger than 2Gb in size. The extension '.grb' is assumed for the input file. The resultant netCDF file is shown (in part).
% ncl_grib2nc U12345 -v PRES_6_SFC,PRES_6_TRO -L [...] filename: U12345 path: U12345.nc file global attributes: creation_date : Wed Nov 2 13:47:15 MST 2005 NCL_Version : 4.2.0.a033 system : Linux jupiter 2.4.20-37.9.legacy #1 Mon Sep 27 18:16:43 EDT 2004 i686 athlon i386 GNU/Linux conventions : None grib_source : U12345.grb title : NCL: GRIB-to-netCDF [...] variables: float PRES_6_SFC ( gridx_6, gridy_6 ) initial_time : 10/24/1995 (00:00) forecast_time : 0 parameter_number : 1 grid_number : 6 level_indicator : 1 coordinates : gridlat_6 gridlon_6 units : Pa long_name : Pressure center : US National Weather Service - NCEP (WMC) _FillValue : -999 float PRES_6_TRO ( gridx_6, gridy_6 ) initial_time : 10/24/1995 (00:00) forecast_time : 0 parameter_number : 1 grid_number : 6 level_indicator : 7 coordinates : gridlat_6 gridlon_6 units : Pa long_name : Pressure center : US National Weather Service - NCEP (WMC) _FillValue : -999Example 6
The following prints the usage message:
% ncl_grib2nc -h ncl_grib2nc gribFile(s) OPTIONS gribFile name of GRIB file(s) [required] [-i input_directory] location of input file [default: current directory] [-o output_directory] location of output file [default: current directory] [-v var1[,...]] user specified subset of variables [default: all variables] ncl_filedump can be used to determine desired variable names [-L] support for writing large (>2Gb) netCDF files [default: no largefile support] [-c comment] text to be included in netCDF file attribute [default: no comment] [-d] upon exit: print contents each netCDF file [like ncdump -h] [-h] this usage message
See also
ncl_filedump ncl_convert2nc
Caveats
Input files that do not end with an extension indicating a GRIB file (.grb, .grib, .grb2, .GRB, .GRIB) are assigned the default extension of .grb for NCL-related purposes.
If the input file is of a supported type, but is not tagged with a recognized extension, simply adding the recognized extention on the command line will result in the file being recognized as valid input, as noted above.
It is important to note is that GRIB is a read-only format -- GRIB files can not be created using NCL. This is because, in general, the community that NCL serves does not use GRIB as an archival format.
Files written using the netCDF-supported large file format may be greater than 2Gb in size; however, at this time NCL does not support writing single variables greater than 2Gb.