-
Notifications
You must be signed in to change notification settings - Fork 9
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
[Feature]: Explore land sea mask generation #576
Comments
@lee1043 – I like regionmask. I ran into an issue with it that was recently closed. Have you hit any issues with NaNs in experimenting with it? I'm supportive of including support for land/sea masking in xcdat, though it might need some discussion (e.g., why not just use regionmask or other packages directly without wrapping them). |
@pochedls glad to learn you already have explored this path! Thank you for sharing the edge case. I haven't hit such issue, maybe the issue you posted is specifically coming with import numpy as np
# create mask
#ocean = regionmask.defined_regions.natural_earth_v5_0_0.ocean_basins_50
ocean = regionmask.defined_regions.natural_earth_v5_0_0.land_110
mask = ocean.mask(ds.lon, ds.lat)
mask = xr.DataArray(np.nan_to_num(mask, nan=True), coords={"lat": ds.lat, "lon": ds.lon}, dims=["lat", "lon"])
mask.plot() |
This issue is likely fixed with |
@pochedls I was able to reproduce the edge case issue you had, so I presume the issue has not been fully resolved. And you are right, the library Mark found, global-land-mask, is only available via pip install. |
Is your feature request related to a problem?
I know that we had discussed this before and concluded to take an independent path to host land sea mask generation capability in a separate package (i.e., pcmdi_utils), I recently came across much simpler and more reliable method that possibly be worth considering to implement to xcdat.
The new approach uses
regionmask
, a package that is available via conda and pip.This method has following advantages:
(1) It overcomes the complexity of the regrid2-based method that is originated from
cdutil
. Although the more precised land sea fraction conservation is considered in the regrid2-based method, in common practical case of global uses its influence is not very critical.(2) It is not using global-land-mask, which is only available via
pip
, thus does not complicate xcdat installation.Describe the solution you'd like
Function
[Proposed function updated -- boolean option added]
Examples
[Examples updated -- boolean option and regional use case added]
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: