Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,47 @@ Unreleased

* added a ``py.typed`` marker so that type checkers use the inline type hints of ``grid-process`` (PEP 561)
* added example notebooks to the documentation illustrating ``interp2poi`` and ``interp2grid`` with open data, with
their dependencies in the optional ``example`` dependency group
their dependencies in the optional ``example`` dependency group. Two of them are global: GFS 2 m temperature to
stations worldwide (compared with GHCN-hourly observations) and ERA5 2 m temperature to the IFS 0.1° grid
* fixed ``interp2grid`` and ``interp2poi`` truncating reprojected coordinates when the grid coordinates are
integers (e.g. an LV95 destination grid built with ``np.arange``), which gave wrong values or NaN
* fixed ``create_dst_grid`` with ``topright`` and ``resolution``: the resolution is now exact and ``topright``
a closed upper bound, instead of the grid spacing being stretched to end exactly on ``topright``
* fixed ``interp2poi`` and ``interp2grid`` (outside of the regular grid interpolation) searching nearest neighbors
and triangulating (``linear``, ``cubic``) in latitude/longitude degrees, where a degree of longitude is shorter
than a degree of latitude (about 0.68 times in Switzerland). Distances are now always in meters: native
coordinates projected in meters are used even if latitude/longitude coordinates are present (e.g. LV95 grids),
and latitude/longitude grids are converted to Swiss LV95, or to earth-centered earth-fixed coordinates (ECEF) far
from Switzerland. Neighbors, IDW weights and ``linear``/``cubic`` results change slightly for grids that were
searched in latitude/longitude, including native LV95 grids with latitude/longitude coordinates
* fixed the reprojection of grids in rotated pole (or latitude/longitude) on a sphere without datum, e.g. from a CF
grid mapping with ``earth_radius``: their latitudes and longitudes are now considered as WGS84 ones, as their
latitude/longitude coordinates usually are. The datum shift to Swiss coordinates (about 180 m) was left out.
``parse_grid_mapping`` (and ``get_grid_crs``) now return such CF mappings directly on WGS84, without
``pyproj.CRS.from_cf``, which took about 0.3 s for a rotated pole; other mappings parsed by ``from_cf`` are cached
* added the support of global and other non-Swiss latitude/longitude grids by ``interp2poi`` and ``interp2grid``
(except ``linear``, ``linear_3D`` and ``cubic``, which raise an error), with nearest neighbor searches in ECEF
coordinates. The maximum distance of the destination to the LV95 central northing for using LV95 is set by the
new setting ``lv95_max_offset`` (environment variable ``GRID_PROCESS__lv95_max_offset``, default 700 km)
* changed the methods with altitude, which no longer reproject to Swiss coordinates when the source grid or the
destination has another CRS projected in meters (e.g. UTM)
* added an explicit error when the destination grid of ``interp2grid`` is unstructured, which is not supported
* fixed ``interp2poi`` and ``interp2grid`` with latitude/longitude source grids whose longitude convention
(0..360 or -180..180) differs from the one of the POIs or destination grid: the source was sliced to the
wrong longitudes (wrong values in the generic path, e.g. for a global destination grid) and the regular grid
interpolation (``try_reg=True``) returned NaN. Global latitude/longitude grids are also interpolated across
their 360 degree seam. When slicing a latitude/longitude source grid, the longitude buffer is widened by
1 / cos(latitude) (as nearest neighbors are now searched in meters) and all longitudes are kept close to the
poles
* changed the ``temp`` method of ``interp2poi``: POIs whose nearest grid points all have the same altitude (e.g.
close to the poles of a latitude/longitude grid, whose pole rows repeat the same point, or on flat orography)
use the fixed lapse rate fallback (as POIs far above or below their neighborhood) instead of raising an error
* fixed ``create_dst_grid_from_src``: the destination grid now spans exactly the bounding box of the source domain
reprojected in the destination CRS (from native coordinates projected in meters when available), instead of the
reprojected corners of its latitude/longitude bounding box, which could be much larger (e.g. +80 km for ICON-CH2
in LV95) or miss parts of the domain (e.g. 28 km for IFS in LV95)
* fixed ``set_grid_mapping`` with CF grid mappings holding numpy arrays or non-float64 numpy values (e.g. a
``standard_parallel`` array read from a netCDF file), which raised a ``TypeError``

1.0.0
-----
Expand Down
14 changes: 8 additions & 6 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Examples
========

The following notebooks illustrate the spatial interpolation functions of :mod:`grid_process.grid_interp` with open
data from MeteoSwiss, ECMWF, Copernicus and swisstopo. Each one compares several interpolation methods visually and
with a runtime benchmark.
data from MeteoSwiss, ECMWF, Copernicus, swisstopo and NOAA. Each one compares several interpolation methods visually
and with a runtime benchmark. The first four examples cover Switzerland, the last two the whole globe.

The notebooks are rendered with the outputs of their last execution. Since open forecast data are only kept for a few
days, re-running them retrieves more recent forecasts. To run them, install the extra dependencies with::
Expand All @@ -17,12 +17,12 @@ keep them between sessions, enable its cache once, e.g. in ``~/.config/earthkit/
cache-policy: user
user-cache-directory: /path/to/a/large/disk/earthkit-cache

The ERA5-Land example additionally needs a free account on the
The ERA5-Land and ERA5 examples additionally need a free account on the
`Copernicus Climate Data Store <https://cds.climate.copernicus.eu>`_, with the API token in ``~/.cdsapirc`` and the
licence of the dataset accepted once on its download page.
licences of the datasets accepted once on their download pages.

All data are open data under the CC BY 4.0 licence (MeteoSwiss, ECMWF, Copernicus Climate Change Service) or the
open data terms of swisstopo. The data sources are credited in each notebook.
All data are open data under the CC BY 4.0 licence (MeteoSwiss, ECMWF, Copernicus Climate Change Service), the
open data terms of swisstopo, or in the public domain (NOAA). The data sources are credited in each notebook.

.. toctree::
:maxdepth: 1
Expand All @@ -31,3 +31,5 @@ open data terms of swisstopo. The data sources are credited in each notebook.
examples/02_interp2poi_ifs_temperature
examples/03_interp2grid_era5land_precipitation
examples/04_interp2grid_valais_temperature
examples/05_interp2poi_gfs_global_temperature
examples/06_interp2grid_era5_global_temperature
Loading
Loading