-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Horizontal regridding from limited domain to global #528
Comments
Thanks for documenting this @acordonez. I agree that regardless of whether this is a bug/feature request, it would be nice to better handle the out-of-domain values. |
@acordonez @pochedls This brings up a good question, is the expected behavior usually or always that unmapped values should be NaN i.e. missing? If that's the case we could default We could also add an option that would automatically align the input and output grids, this could be a feature. Also the active xESMF repo is https://github.com/pangeo-data/xESMF for future reference. |
@jasonb5 thank you for investigating on this. I think it makes more sense to set unmapped value to NaN instead of zero, curious why they set it to zero as default. |
Maybe before we set this as the default, we could reach out to the appropriate library ( |
Yeah, good point. This goes one layer deeper with From the original developer back in 2018 (
|
I can default |
@jasonb5 Thanks for finding the unmapped_to_nan=True setting, I'll use that for now. |
From 9/13/23 meeting: Jason thinks that ESMF represents missing values with 0 because If their reasoning is not strong enough, we can set |
Steve reached out to ESMF support, they said they don’t see an issue with defaulting |
@acordonez do we have any update on this? Just housekeeping. |
@lee1043 I've been using the unmapped_to_nan=True option and that's working for me. |
@acordonez thank you for confirming. Are you okay with closing this issue? |
@lee1043 Sure, although it looks like it's associated with some future milestones? Would closing the issue affect that? |
@tomvothecoder should we keep this issue opened? |
I believe the plan was to make |
I have this and the regrid2 nan fix coming in a PR today. |
@tomvothecoder thanks for reminding me, and @jasonb5 thanks for the PR! |
@acordonez can you rerun your minimal code in #528 (comment) with #613? |
@acordonez thanks for checking this! |
What happened?
I was told this might be a bug, so documenting here. I'm regridding LOCA2 downscaled data on a CONUS domain to a global 2.5 degree grid using the xesmf tool and "conservative_normed" method. On the resulting grid, any cells that were not part of the original CONUS domain are populated with zeros.
Original data example:
![dataset_mean_original](https://private-user-images.githubusercontent.com/18147700/259502480-d94712de-8d96-4d01-99ea-fa3c6095687b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMDY2NzUsIm5iZiI6MTczOTIwNjM3NSwicGF0aCI6Ii8xODE0NzcwMC8yNTk1MDI0ODAtZDk0NzEyZGUtOGQ5Ni00ZDAxLTk5ZWEtZmEzYzYwOTU2ODdiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDE2NTI1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAxZTJiNjUyZGExYmEwZjY3NjA5OWQxZTE3ZTQ5OTdkNGZjNWRhOTdkYTJkZWZhMjliYThlMTM0NmY4ZGNkZTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.IuvWWX6ri0nMw4WtX-nxL4TH2mmRwI-hh9mq89WJ-t8)
Regridded example:
![dataset_mean_regridded](https://private-user-images.githubusercontent.com/18147700/259502488-07e37707-9d09-4575-84f3-76615276c68a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMDY2NzUsIm5iZiI6MTczOTIwNjM3NSwicGF0aCI6Ii8xODE0NzcwMC8yNTk1MDI0ODgtMDdlMzc3MDctOWQwOS00NTc1LTg0ZjMtNzY2MTUyNzZjNjhhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDE2NTI1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY0Y2I5MWQxMWYzZDI2YzZjZTMxMzcwODkwMTY1NWIzNTBjNmEyZDk5OTgyZjZkNjBhNmJkNGRmMDIxYTI3OTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.0-oGjjMl_7Y5O7Gh3LfLtdoKLj1o7xlB7qx3OivyDQg)
What did you expect to happen? Are there are possible answers you came across?
Based on this issue shared by @pochedls , it seems like this might be the expected behavior when using the xesmf tool to regrid data to a larger domain? But it would be helpful to have some ability to use NaN's as the fill value in stead of zero for areas outside the original domain.
Minimal Complete Verifiable Example (MVCE)
Relevant log output
Anything else we need to know?
Here's some Dataset information about my CONUS data:
Longitude:
Latitude
Environment
INSTALLED VERSIONS
commit: None
python: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0]
python-bits: 64
OS: Linux
OS-release: 5.14.21-150400.24.46_12.0.73-cray_shasta_c
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.14.1
libnetcdf: 4.9.2
xarray: 2023.7.0
pandas: 2.0.3
numpy: 1.22.4
scipy: 1.11.1
netCDF4: 1.6.4
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.6.2
nc_time_axis: None
PseudoNetCDF: None
iris: None
bottleneck: None
dask: 2023.8.0
distributed: 2023.8.0
matplotlib: 3.7.2
cartopy: 0.21.1
seaborn: 0.12.2
numbagg: None
fsspec: 2023.6.0
cupy: None
pint: None
sparse: 0.14.0
flox: None
numpy_groupies: None
setuptools: 68.0.0
pip: 23.2.1
conda: None
pytest: None
mypy: None
IPython: 8.14.0
sphinx: None
The text was updated successfully, but these errors were encountered: