gridit v3.2.3

Mercurial revision 5770:c90c3015e72d | 2026-05-22


Description

gridit is a tool that converts unstructured data to structured grids. It processes input files (e.g., finite element or mesh-based data) and generates structured output in various formats such as ASCII, NetCDF, or BMG.


Usage

gridit input [OPTIONS] file

Options

Option

Description

-h, --help

Display help and exit.

--mapping

Define grid mapping using the format [lonmin:dlon:lonmax; latmin:dlat:latmax]. dlon and dlat are optional. Supported units: d (degrees), m (minutes), ' (arcminutes), s (seconds), " (arcseconds)

--persistence

Number of iterations for growing unmasked pixels.

-discretisation

Discretization pair for NetCDF input atlas.

-c

NetCDF input atlas file name convention. See Notes for details.

-g

Grid file followed by an empty-terminated list of up to 3 gridded variable names for e, u, and v.

-n

Notebook file containing grid or projection definitions.

-m

Mesh file (required).

-z

Zone name or global resolution.

-o

Output root name. Default: generic.

-f

Input format. Default: ascii. If set to netcdf, discretization is compulsory.


Examples

Basic Conversion (ASCII Output)

Convert an unstructured .s2r file to ASCII format:

gridit input.s2r -f ascii -m mesh_file.nc

Convert to NetCDF with Custom Output Name

Convert an unstructured .s2r file to NetCDF format with a custom output name:

gridit input.s2r -f netcdf -o output_root -m mesh_file.nc

Specify Grid Span and Resolution

Convert an input file with a custom grid span and resolution:

gridit input.s2r -xmin 0 -xmax 10 -ymin 0 -ymax 10 -dx 0.1 -dy 0.1 -m mesh_file.nc

Use a Predefined Zone

Convert an input file using a predefined zone:

gridit input.s2r -z "global_1deg" -m mesh_file.nc

Apply Persistence for Unmasked Pixels

Convert an input file with persistence applied to unmasked pixels:

gridit input.s2r --persistence 5 -m mesh_file.nc

Custom Mapping

Convert an input file with a custom mapping:

gridit input.s2r --mapping "[0:0.5:10; 0:0.5:10]" -m mesh_file.nc

Convert Vector Data (V2R to NetCDF)

Convert a vector .v2r file to NetCDF format:

gridit input.v2r -f netcdf -m mesh_file.nc -g grid_file.nc u v

Use a Notebook File

Convert an input file using a notebook file for grid definitions:

gridit input.s2r -n notebook_file.txt -m mesh_file.nc

Environment Variables

gridit does not explicitly rely on environment variables for its core functionality. However, if used in conjunction with other tools or scripts, standard environment variables (e.g., PATH, LD_LIBRARY_PATH) may apply.


Notes

  1. Input Files:

  • Supported input formats: .s2r, .s2c, .v2r, .v2c.

  • The -m (mesh file) option is required for all conversions.

  1. Output Formats:

  • Supported output formats: ascii, netcdf, grd, bmg.

  • If the output format is netcdf, the -discretisation option may be required for proper handling of the input atlas.

  1. Grid and Mesh:

  • The -g option requires a grid file followed by up to 3 variable names (e.g., for e, u, and v components in vector data).

  • The --mapping option allows flexible grid definitions. Ensure the syntax is correct (e.g., [lonmin:dlon:lonmax; latmin:dlat:latmax]).

  1. Resolution Units:

  • Units for -dx and -dy can be specified as:

    • d: Degrees

    • m: Minutes

    • ' : Arcminutes

    • s: Seconds

    • ": Arcseconds

  • Example: -dx 30' (30 arcminutes) or -dy 0.5d (0.5 degrees).

  1. Persistence:

  • The --persistence option is useful for filling gaps in unmasked regions by iteratively growing unmasked pixels.

  1. Zone and Global Resolution:

  • The -z option can specify a predefined zone (e.g., global_1deg) or a global resolution.


See Also