dtc_super_resolution.rcm_emulator.pre_processing_module.reprojection
Reprojection functions for the emulator’s inputs.
Functions
|
Create a uniform grid in EPSG:3031 spanning the RACMO domain at a given resolution. |
|
Print the maximum and minimum values of latitude and longitude. |
|
Print the maximum and minimum values of x and y coordinates along with their units. |
|
Print the shape, resolution, bounds, and CRS of a raster dataset. |
|
Print the shape of a 3D variable along with its dimensions and dataset name. |
|
Reproject ERA5 (EPSG:4326, lat/lon 0-360) onto a polar stereographic EPSG:3031 grid. |
- create_target_grid_from_racmo(racmo_ds: Dataset, resx_km: float = 14.0, resy_km: float = 28.0) tuple
Create a uniform grid in EPSG:3031 spanning the RACMO domain at a given resolution.
In our case, we select a resolution that approximately matches the ERA5 grid spacing at our target latitude of 75°S, which is around 14km in x, and around 28km in y.
- Parameters:
racmo_ds (xr.Dataset) – The RACMO dataset containing the original grid information.
resx_km (float) – The desired resolution in the x-direction (in kilometers).
resy_km (float) – The desired resolution in the y-direction (in kilometers).
- Returns:
A tuple containing the x and y coordinates of the target grid.
- Return type:
tuple
- print_max_min_lat_lon(varlat: DataArray, varlon: DataArray, unit: str = '°') None
Print the maximum and minimum values of latitude and longitude.
- print_max_min_xy(varx: DataArray, vary: DataArray, unit: str = 'km') None
Print the maximum and minimum values of x and y coordinates along with their units.
- print_raster(raster: Dataset) None
Print the shape, resolution, bounds, and CRS of a raster dataset.
- print_shape(var: DataArray, dim1: str, dim2: str, dim3: str, ds: str = 'GCM') None
Print the shape of a 3D variable along with its dimensions and dataset name.
- reproject_era5_to_racmo_grid(era5_ds: Dataset, gridx: ndarray, gridy: ndarray) Dataset
Reproject ERA5 (EPSG:4326, lat/lon 0-360) onto a polar stereographic EPSG:3031 grid.
Uses the same inverse-transform approach as InterpolateGCM: each target (x,y) point is converted back to lat/lon, then used as a lookup coordinate in ERA5.
- Parameters:
era5_ds (xr.Dataset) – The ERA5 dataset containing the original lat/lon grid.
gridx (np.ndarray) – The x coordinates of the target grid in EPSG:3031.
gridy (np.ndarray) – The y coordinates of the target grid in EPSG:3031.
- Returns:
The ERA5 dataset reprojected onto the target polar stereographic grid.
- Return type:
xr.Dataset