Comments (2)
Thanks for looking into this @rcomer. I will pass your recommendation on. I played around with your try_plot
function and got some interesting results. The resultant contours are extremely sensitive to that central value.
try_plot(-4.44e-16)
try_plot(0)
try_plot(-5e-16)
try_plot(-4e-16)
try_plot(-4.5e-16)
I also added lev0
to the data (after casting it to float64
) which would align the 'zeros' in the data with the middle level, and this resulted in 5 identical plots. I guess this would indicate a floating point conversion and/or equality error somewhere?
from cartopy.
Thanks for the report and the clear reproducer @dsroberts. This seems reminiscent of #2224 which I ultimately solved by locating the specific problem level and analyzing that. I had some trouble locating the problem level in this case as it seems to be very specific to the slightly off-zero value generated by arange
. But now I have this:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import numpy as np
import netCDF4
ds = netCDF4.Dataset('dataset.nc','r')
def try_plot(lev0):
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=1))
cf = ax.contourf(np.array(ds['lon']), np.array(ds['lat']), np.array(ds['a']), transform=ccrs.PlateCarree(), levels=[lev0, lev0+0.2], extend='both')
plt.colorbar(cf)
plt.show()
try_plot(-4.44e-16)
try_plot(0)
The slightly negative value give this (bad!)
Whereas zero give this (good!)
A workaround for your researcher might be to use levels=np.linspace(-2, 2, 21)
, which gives me this:
from cartopy.
Related Issues (20)
- Feature request: Shading on Orthographic projection HOT 10
- Discontinuous RotatedPole parameters produce inverted coordinate system HOT 3
- The left extent has a boundary when plotting using Cartopy? HOT 2
- Improve documentation of cartopy.feature.NaturalEarthFeature HOT 1
- Deepcopy of CRS Object Fails to Initialize HOT 7
- Services which support only WMS v1.3.0 return error (Only v1.3.0 is allowed)
- 0.23.0 fails to build due to test failures when no network is available HOT 3
- A GEOSException error occurred when calling contourf HOT 3
- Incorrect behavior of GridLiner when setting draw_labels='x'
- figsize is not affecting the actual figure size of a matplotlib figure when a cartopy projection is applied HOT 6
- Error initializing LambertConformal projection on sphere with 0.23 HOT 2
- Inconsistent plots between uniform grid and non-uniform climate model grid HOT 1
- [TST] Upcoming dependency test failures HOT 2
- [TST] Upcoming dependency test failures
- Issue plotting Any maps.
- `GeoAxes._update_title_position` called before `Gridliner._labels` is populated HOT 7
- Broken WMTS examples in gallery
- Missing y-axis gridline labels when rotated to 90 degrees HOT 2
- Request to add transform_first keyword to barbs HOT 3
- Errors when transforming points to a cartopy projection HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cartopy.