Skip to content
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

Arctic projection plotting routine #71

Open
NoraLoose opened this issue Feb 17, 2021 · 5 comments
Open

Arctic projection plotting routine #71

NoraLoose opened this issue Feb 17, 2021 · 5 comments

Comments

@NoraLoose
Copy link

Does anybody have a python plotting routine that produces nice Arctic projections from CCSM POP2 model output, e.g., with cartopy's NorthPolarStereo or Orthographic projections?

My first attempt was:

import cartopy
import cartopy.crs as ccrs

fig = plt.figure(figsize=(10,8))
ax = plt.gca(projection=ccrs.NorthPolarStereo())
ax.set_extent([-180, 180, 50, 90], ccrs.PlateCarree())
ax.add_feature(cartopy.feature.LAND)
ax.gridlines()

cs = ax.pcolormesh(ds.TLAT,ds.TLONG,ds.TEMP.isel(z_t=0,time=-1),transform=ccrs.PlateCarree())

but it seems that there are interpolation issues (probably related to the seam of the tripolar grid in the Arctic):

POP_Arctic

This is of course not an issue with pop-tools, but I am hoping that this is a good platform to ask if anyone has experience with this. 😃 Thanks!

@matt-long
Copy link
Collaborator

matt-long commented Feb 17, 2021

Check out this function, pop_add_cyclic:
https://gist.github.com/matt-long/50433da346da8ac17cde926eec90a87c

You may also need to mask (subset) data outside the domain.

@Eddebbar
Copy link

Hi @NoraLoose, try switching ds.TLAT & ds.TLONG? i.e.:
cs = ax.pcolormesh(ds.TLONG,ds.TLAT,ds.TEMP.isel(z_t=0,time=-1),transform=ccrs.PlateCarree())

and for mask, this usually works for me:
land = ax.add_feature(cartopy.feature.NaturalEarthFeature('physical', 'land', '10m',linewidth=0.1, edgecolor='black', facecolor='grey'))

@NoraLoose
Copy link
Author

Thanks so much for your quick responses!

@Eddebbar, getting ds.TLAT and ds.TLONG in the right order was definitely a good idea 😄 ! But it didn't fix my problem completely, and I am still seeing weird interpolation patterns and stripes (despite masking out the data outside of the domain, as recommended by @matt-long).

@matt-long, I tried the add_cyclic_point function from #48 on my POP model output. But it seems that it did something else than shown in your notebook:

dsp = add_cyclic_point(ds)

fig,axs = plt.subplots(1,2,figsize=(18,5))
ds.TLONG.where(ds.KMT > 0).plot(ax=axs[0])
dsp.TLONG.where(dsp.KMT > 0).plot(ax=axs[1])

add_cyclic_point_test

Should the add_cyclic_point function work on my POP_tx0.1 grid, too?

@Eddebbar
Copy link

Eddebbar commented Mar 4, 2021

@NoraLoose, hmmm, not sure what that's from... do the interpolation patterns/stripes look something like this? (seems like it's contouring over NaN/land)

fig = plt.figure(figsize=(10,8))
ax = plt.gca(projection=ccrs.NorthPolarStereo())
ax.set_extent([-180, 180, 50, 90], ccrs.PlateCarree())
ax.add_feature(cartopy.feature.LAND)
ax.gridlines()
cs = ax.pcolormesh(ds.TLONG,ds.TLAT,ds.TEMP.isel(z_t=0,time=-1),transform=ccrs.PlateCarree())

download-5

which seems to go away on my end with cartopy.feature.NaturalEarthFeature, so could be a grid specific issue...

fig = plt.figure(figsize=(10,8))
ax = plt.gca(projection=ccrs.NorthPolarStereo())
ax.set_extent([-180, 180, 50, 90], ccrs.PlateCarree())
ax.add_feature(cartopy.feature.LAND)
ax.gridlines()
cs = ax.pcolormesh(ds.TLONG,ds.TLAT,ds.TEMP.isel(z_t=0,time=-1),transform=ccrs.PlateCarree())
land = ax.add_feature(cartopy.feature.NaturalEarthFeature('physical', 'land', '10m',linewidth=0.1, edgecolor='black', facecolor='white'))

download-6

@NoraLoose
Copy link
Author

Sorry for not following up on your responses - I had dropped the ball on this issue for a while.

@Eddebbar, thanks for your suggestion! Weirdly, this didn't solve the issue on my end. I ended up decreasing the latitudinal extent from [50, 90] to [82, 90] because that's all I needed for our tutorial. Not a general solution, but oh well.

Thanks again for your help, @Eddebbar and @matt-long! Please feel free to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

3 participants