jbusecke / xMIP

Analysis ready CMIP6 data in python the easy way with pangeo tools.
https://cmip6-preprocessing.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
197 stars 44 forks source link

North Atlantic mask misses some ocean area between Greenland and Iceland #208

Open hmkhatri opened 2 years ago

hmkhatri commented 2 years ago

I followed the approach from tutorial notebook and created a mask for North Atlantic. However, there is a small region (see while space between Greenland and Iceland in figure) that has nan values, even though there is an ocean in between. I have tried creating masks with 1 deg and 0.25 deg. Both had this issue.

image
jbusecke commented 2 years ago

Thanks for raising the issue @hmkhatri. The masking is ultimately based on combining smaller named subregions from regionmask. I suspect that a new one of these regions has been added during a recent update

@mathause, is this possible (also sorry for not responding on that old issue)?

@hmkhatri, could you follow the docs like this:

basins = regionmask.defined_regions.natural_earth.ocean_basins_50
basins.plot(add_ocean=False, add_label=True)

and zoom in on this region? I would be very curious to see what is going on, but do not currently have time to dig into this myself.

mathause commented 2 years ago

Indeed, there is a a bit of ocean not part of any region - but it's the same with both versions of the naturalearthdata. v4.1 is orange and v5.0 is blue.

ocean_basins_50

@jbusecke you'll be able to specify the naturalearthdata version once the new version is released.

The code requires regionmask master or the upcoming 0.9 release. ```python %matplotlib import cartopy.crs as ccrs import regionmask line_kws = dict(color="#ff7f00", lw=2) ax= regionmask.defined_regions.natural_earth_v4_1_0.ocean_basins_50.plot(resolution="50m", line_kws=line_kws) line_kws = dict(color="#1f78b4", lw=2, ls=":") ax = regionmask.defined_regions.natural_earth_v5_0_0.ocean_basins_50.plot(resolution="50m", line_kws=line_kws) ax.set_extent([-40, -10, 60, 90], ccrs.PlateCarree()) ```
hmkhatri commented 2 years ago

@mathause @jbusecke Thanks for looking into this. Seems like some manual tweaking is needed to incorporate the missing region in the North Atlantic mask.

It is not a major issue and I managed to get rid of white space by combining North Atlantic mask and ocean wet point mask. It would be nice to update the code for correcting it. I am busy for next few weeks, but I would be happy to work on this later.

jbusecke commented 2 years ago

Bummer to see that this is in fact baked into both NE versions. I have been thinking about refactoring the basin masking ability (#119) and maybe this should be part of it. Using the wetmask is not ideal IMO, since this method should really just rely on the lon/lat values of the model (which makes it quite universal). All that cmip6_pp does is just combine a bunch of shapefiles, so its concievable that we just add a manual correction there?

Then again, since I wrote this, I have actually used this in many more use cases outside of cmip6. I wonder if such a refactor should maybe include efforts upstream, to just publish a NE shapefile with ocean basins? This seems of much broader use than just for the cmip community. @mathause have you interacted with that community at all?

mathause commented 2 years ago

@mathause have you interacted with that community at all?

No I didn't so far, but you have ;-) nvkelso/natural-earth-vector#319

jbusecke commented 2 years ago

I pinged them over in https://github.com/nvkelso/natural-earth-vector/issues/697. Lets see what they think.

jbusecke commented 2 years ago

On a separate note: It might be worth raising this issue over at their issue tracker again. They were very responsive to my suggestions! @hmkhatri

nvkelso commented 2 years ago

Upstream support for this will be in Natural Earth v5.2.0 which is in public preview on Github.