pyremap.descriptor.LatLon2DGridDescriptor
- class pyremap.descriptor.LatLon2DGridDescriptor(mesh_name=None, regional=True)[source]
A class for describing a lat-lon grid that may not be a tensor grid (lat/lon are 2D arrays). The grid is assumed to be regional, since this is difficult to determine just from the lat/lon values. The calling code should pass
regional=False
to the constructor orread()
method for global grids with 2D lat/lon.- Variables:
lat (numpy.ndarray) – The latitude coordinate at grid-cell centers
lon (numpy.ndarray) – The longitude coordinate at grid-cell centers
lat_corner (numpy.ndarray) – The latitude coordinate at grid-cell corners
lon_corner (numpy.ndarray) – The longitude coordinate at grid-cell corners
history (str) – The history attribute written to SCRIP files
- __init__(mesh_name=None, regional=True)[source]
Construct a mesh descriptor
- mesh_namestr or None, optional
The name of the mesh or grid, used to give mapping files unique names
- regionalbool or None, optional
Whether this is a regional or global grid
Methods
__init__
([mesh_name, regional])Construct a mesh descriptor
mesh_name_from_attr
(ds)Get the mesh name from the dataset attributes if not already set
read
([filename, ds, lat_var_name, ...])Read the lat-lon grid from a file with the given lat/lon var names.
to_scrip
(scrip_filename[, expand_dist, ...])Create a SCRIP file based on the grid.
write_netcdf
(ds, filename)Write the mesh to a NetCDF file