-
Notifications
You must be signed in to change notification settings - Fork 2
Add remap function using xESMF for regridding in goesgcp #1
Copy link
Copy link
Open
Description
Description:
We need to implement a remap function in goesgcp to enable regridding capabilities using the xesmf library. This will allow users to interpolate data onto different grids efficiently, similar to CDO's remapbil function.
Implementation Steps
- Install Dependency: Ensure
xesmfis added as an optional dependency inrequirements.txt. - Define the Function: Implement a
remapfunction insidegoesgcp/main.pythat:- Accepts an input NetCDF file.
- Defines or loads a target grid.
- Uses
xesmffor bilinear interpolation. - Saves the output to a new NetCDF file.
- Integrate with CLI: Add a new CLI command (
--remap) to enable this feature. - Test Cases: Create test cases to validate the interpolation results.
- Update Documentation: Add examples of how to use the new
remapfunction in the README.
Example Code Outline
import xarray as xr
import xesmf as xe
def remap(input_file: str, output_file: str, target_grid: dict):
ds = xr.open_dataset(input_file)
ds_out = xr.Dataset(target_grid)
regridder = xe.Regridder(ds, ds_out, "bilinear")
ds_remap = regridder(ds)
ds_remap.to_netcdf(output_file)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels