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

PO4 contourf map is wrong #28

Open
matt-long opened this issue Mar 5, 2020 · 2 comments
Open

PO4 contourf map is wrong #28

matt-long opened this issue Mar 5, 2020 · 2 comments

Comments

@matt-long
Copy link
Contributor

I added code to plot surface nutrients for the paper, but for some reason, the PO4 map from the model is messed up (panel D).

This code (no projection)

cf = plt.contourf(ds_surf_plot.TLONG, ds_surf_plot.TLAT, ds_surf_plot['PO4'], **contour_spec['PO4'])
plt.colorbar(cf)

yield this (the right answer):
image

However, adding the projection seems to screw things up:

ax = plt.axes(projection=prj)
cf = ax.contourf(ds_surf_plot.TLONG, ds_surf_plot.TLAT, ds_surf_plot['PO4'], 
                  **contour_spec['PO4'],
                 transform=ccrs.PlateCarree())
plt.colorbar(cf)

image

The other nutrients seem to plot fine; something about the PO4 field is screwy...but the obs and bias plots seem ok. I am at a loss.

@mnlevy1981
Copy link
Contributor

So it seems like something weird is happening due to one of the levels being exactly 1 -- changing that specific value of levels['PO4'] to 1.0001 produces a reasonable plot:

Screen Shot 2020-03-05 at 12 30 50 AM

I found that changing the level to 0.99, 0.999, 0.9999, 1.0001, 1.001, or 1.01 all removed the "all green" nature of the plot, while 0.99999 and 1.00001 did not. I wonder if values very close to 1 near the cyclic border caused this weird behavior due to the utils.pop_add_cyclic() call? I don't know if that would explain why I could raise or lower the problematic contour level rather than needing to modify it in a specific direction. (I commented out the call to see what happens, but that led to ValueError: A LinearRing must have at least 3 coordinate tuples.)

mnlevy1981 added a commit to mnlevy1981/cesm2-marbl that referenced this issue Mar 5, 2020
For some reason changing one of the levels from 1 to 1.0001 fixes the issue
outlined in marbl-ecosys#28
@mnlevy1981
Copy link
Contributor

dd7eee2 applies this extremely kludgy fix. I'll leave this issue ticket open until we figure out what was actually going wrong / how to fix it.

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

No branches or pull requests

2 participants