lat/lon and local-cartesian regridding
Project description
regridcart
Regridding lat/lon to local Cartesian coordinates
This package takes care of regridding data defined with latitude/longitude
coordinates onto a local Cartesian grid of a fixed resolution. To use it you
simply define the domain you want to regrid onto and then call the resample
method.
Usage
import regridcart as rc
import xaray as xr
da_src = xr.open_dataarray("...")
target_domain = rc.LocalCartesianDomain(
central_latitude=lat0,
central_longitude=lon0,
l_meridional=1000.0e3,
l_zonal=3000.0e3,
)
dx = 1.0e3 # new resoluion 1km
da_regridded = rc.resample(target_domain, da=da_src, dx=dx)
The provided data-array is assumed to have latitude/longitude coordinates defined by one of the following:
lat
andlon
coordinates along which the data is aligned, i.e.lat
andlon
are given as 1D arrayslat
andlon
are given as auxilliary variables so that the data isn't aligned along the lat/lon directions, but rather thelat
andlon
of every datapoint is given- the data-array has projection information defined in a CF-compliant
manner using the
grid_mapping
attribute (http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/ch05s06.html) - the data-array was loaded from a raster-file using
rioxarray.open_rasterio
so that the projection information is available viada.rio.crs
The package also implements cropping (rc.crop_field_to_domain
), plotting
domain outline (domain.plot_outline
) and can also with data already on a
Cartesian grid with rc.CartesianDomain
. See
notebooks/examples.ipynb for detailed examples.
Installation
regridcart
can be installed with pip
from pypi, but it
relies on cartopy
and xesmf
which in turn rely on proj
and emsf
, these
can most easily be installed with
conda:
conda install xarray cartopy xesmf -c conda-forge
pip install regridcart
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for regridcart-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d192ef41fedac2a37225ae60f03a9bb5e13364281ba9071cf3ffb82b55fb471b |
|
MD5 | 41e5fcab14814e701938b9170f8397f9 |
|
BLAKE2b-256 | a7f622bffd9ed0ac6e77bcc97a14b3e330c4e6e942545f93b60dd0c2580162fc |