pyremap.descriptor.ProjectionGridDescriptor
- class pyremap.descriptor.ProjectionGridDescriptor(projection, mesh_name=None)[source]
A class for describing a general logically rectangular grid that can be defined by a
pyproj
projection.- Variables:
projection (pyproj.Proj) – The projection used to map from grid x-y space to latitude and longitude
lat_lon_projection (pyproj.Proj) – lat-lon projection used to transform from x-y to lat-lon space
x (numpy.ndarray) – The latitude coordinate at grid-cell centers
y (numpy.ndarray) – The longitude coordinate at grid-cell centers
x_corner (numpy.ndarray) – The latitude coordinate at grid-cell corners
y_corner (numpy.ndarray) – The longitude coordinate at grid-cell corners
history (str) – The history attribute written to SCRIP files
x_var_name (str) – The name of the x variable
y_var_name (str) – The name of the y variable
- __init__(projection, mesh_name=None)[source]
Constructor stores the projection
- Parameters:
projection (pyproj.Proj) – The projection used to map from grid x-y space to latitude and longitude
mesh_name (str, optional) – The name of the grid (e.g.
'10km_Antarctic_stereo'
)
Methods
__init__
(projection[, mesh_name])Constructor stores the projection
create
(projection, x, y, mesh_name)Given x and y coordinates defining the axes of the logically rectangular grid, save the coordinates interpolate/extrapolate to locate corners.
mesh_name_from_attr
(ds)Get the mesh name from the dataset attributes if not already set
project_to_lat_lon
(x, y)Given x and y locations of points in a projection, returns the corresponding latitude and longitude of each point.
read
(projection, filename[, mesh_name, ...])Given a grid file with x and y coordinates defining the axes of the logically rectangular grid, read in the x and y coordinates and interpolate/extrapolate to locate corners.
to_scrip
(scrip_filename[, expand_dist, ...])Create a SCRIP file based on the grid and projection.
write_netcdf
(ds, filename)Write the mesh to a NetCDF file