Script pywgrib2

This is a stand-alone script installed as pywgrib2. It provides the following functionality:

  1. List content of a GRIB2 file (same as wgrib2 without options).

  2. Create inventory files.

  3. List content of inventory files.

  4. Convert GRIB2 files to netCDF4.

  5. Convert GRIB2 files to zarr.

  6. Emulates wgrib2 executable.

pywgrib2_xr.script.main(argv=None)[source]
USAGE: pywgrib2 [-h] | [command [option ...]] argument ...

where:
    -h
        Print this message and exit.

    When command is not specified, the script emulates wgrib2 executable.

    command:
        list_inv
            Displays content of GRIB file(s).

            Options:
                -L
                    Long listing (all metadata). Default is short

            Arguments:
                gribfile ...
                    One or more GRIB files.

        make_inv
            Makes inventory file[s]

            Options:
                -i inv-dir
                    Directory for inventory files. Will be created if does not exist.
                    Intended for read-only GRIB directories.
                -n num-procs
                    Number of processes in multiprocessing mode. Default is 1.
                -p pattern
                    "glob.glob" pattern.
                -r
                    Recursively search grib-dir subdirectories.

            Arguments:
                gribfile ...
                    Zero (only if -r or -p is specified) or more GRIB files.

        cat_inv
            Lists content of inventory file[s].
            Use when inventories coexist with GRIB files.

            Options:
                -d dir
                    Directory of GRIB files
                -r
                    Recursively search subdirectories for inventory files.

            Arguments:
                gribfile ...
                    Zero or more GRIB files. The extension ".binv" does not need
                    to be included.

            The final list of files comprises directory entries and explicit
            paths.

        cat_hash
            Lists content of inventory file[s].
            Use when inventories are not collocated with GRIB files
            (i.e. -i inv_dir was specified for make_inv).

            Arguments:
                invfile ...
                    One or more GRIB files. The extension ".binv" does not need
                    to be included.

        template:
            Writes template file.

            Options:
                -i inv_dir
                    Location of inventory files, if different from GRIB files.
                -t reftime
                    Reference time, necessary when GRIB files have messages
                    with more than one reference time.
                -o template
                    Output file name. Must be specified.

            Arguments:
                gribfile ...
                    One or more GRIB files.

        to_nc:
            Writes netcdf file.

            Options:
                -c
                    Compress file, with zlib and compression level 1.
                -o ncfile
                    Output file name. Must be specified.
                -T template
                    Template file name. Must be specified.

            Arguments:
                gribfile ...
                    One or more GRIB files.

        to_zarr:
            Writes zarr group.

            Options:
                -c level
                    Compression level, an integer between 1 and 4. Default is 1.
                -o store
                    Output directory. Must be specified.
                -T template
                    Template file name. Must be specified.

            Arguments:
                gribfile ...
                    One or more GRIB files.