pywgrib2_xr.grid_fromstring

pywgrib2_xr.grid_fromstring(string, winds='grid', globe=None)[source]

Factory method to create projection from wgrib2 style string.

Parameters
  • string (str) –

    Grid description in wgrib2 style:

    • latitude longitude : ‘latlon lon0:nlon:dlon lat0:nlat:dlat’, where

      • lon0, lat0 : degrees of lat/lon for 1st grid point.

      • nlon : number of longitudes.

      • nlat : number of latitudes.

      • dlon : grid cell size in degrees of longitude.

      • dlat : grid cell size in degrees of latitude.

    • rotated latitude longitude : ‘rot-ll:sp_lon:sp_lat:sp_rot lon0:nlon:dlon lat0:nlat:dlat’, where

      • sp_lon : longitude of the South pole (for rotation)

      • sp_lat : latitude of the South pole (for rotation)

      • sp_rot : angle of rotation

      • lon0, lat0 : degrees of lat/lon for 1st grid point.

      • nlon : number of longitudes.

      • nlat : number of latitudes.

      • dlon : grid cell size in degrees of longitude.

      • dlat : grid cell size in degrees of latitude.

    • Mercator : ‘mercator:lad lon0:nx:dx:lonn lat0:ny:dy:latn’, where

      • lad : latitude (degrees) where dx and dy are specified.

      • lat0, lon0 : degrees of lat/lon for 1st grid point.

      • latn, lonn : degrees of lat/lon for last grid point.

      • nx : number of grid points in X direction.

      • ny : number of grid points in Y direction.

      • dx : grid cell distance in meters in x direction at lad.

      • dy : grid cell distance in meters in y direction at lad.

    • north polar stereographic: ‘nps:lov:lad lon0:nx:dx lat0:ny:dy’

    • south polar stereographic: ‘sps:lov:lad lon0:nx:dx lat0:ny:dy’

      • lov : longitude (degrees) where y axis is parallel to meridian.

      • lad : latitude (degrees) where dx and dy are specified. lad must be 60 (nps) or -60 (sps) (library limitation).

      • lat0, lon0 : degrees of lat/lon for 1st grid point.

      • nx : number of grid points in X direction.

      • ny : number of grid points in Y direction.

      • dx : grid cell distance meters in x direction at lad.

      • dy : grid cell distance meters in y direction at lad.

    • Lambert conformal : ‘lambert:lov:latin1:latin2:lad lon0:nx:dx lat0:ny:dy’

      • lov : longitude (degrees) where y axis is parallel to meridian

      • latin1 : first latitude from pole which cuts the secant cone

      • latin2 : second latitude from pole which cuts the secant cone

      • lad : latitude (degrees) where dx and dy are specified

      • lat0, lon0 : degrees of lat/lon for first grid point

      • nx : number of grid points in X direction

      • ny : number of grid points in Y direction

      • dx : grid cell size in meters in x direction

      • dy : grid cell size in meters in y direction

    • global Gaussian: ‘gaussian lon0:nx:dlon lat0:ny’

      lat0, lon0 : degrees of lat/lon for 1st grid point (lon1 = -lon0, lat1 = lat0 + (nx-1)*dlon)

      nx : number of grid points in X direction.

      ny : number of grid points in Y direction. ny must be even.

      dlon : degrees of longitude between adjacent grid points.

  • winds ({'grid', 'earth'}) – Vector orientation. Default is ‘grid’.

  • globe (dict, optional) – Mapping: code -> int, ‘shape’ -> str, ‘earth_radius’ -> float, ‘semi_major_axis’ -> float, ‘semi_minor_axis’ -> float Default is current NCEP choice: Earth assumed spherical with radius = 6,371,229.0 m.

Returns

Projection specific class instance.

Return type

Grid