pyremap.descriptor.LatLonGridDescriptor
- class pyremap.descriptor.LatLonGridDescriptor(mesh_name=None, regional=None)[source]
A class for describing a lat-lon grid
- Variables:
lat (Optional[numpy.ndarray]) – The latitude coordinate at grid-cell centers
lon (Optional[numpy.ndarray]) – The longitude coordinate at grid-cell centers
lat_corner (Optional[numpy.ndarray]) – The latitude coordinate at grid-cell corners
lon_corner (Optional[numpy.ndarray]) – The longitude coordinate at grid-cell corners
history (Optional[str]) – The history attribute written to SCRIP files
- __init__(mesh_name=None, regional=None)[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. If
None
, this will be determined automatically by checking the limits of the corner latitude and longitude to see if they cover the globe.
Methods
__init__
([mesh_name, regional])Construct a mesh descriptor
create
(lat_corner, lon_corner[, units, ...])Create the lat-lon grid with the given arrays and units.
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, ...])Given a lat-lon grid file, create a SCRIP file based on the grid.
write_netcdf
(ds, filename)Write the mesh to a NetCDF file