Comments (3)
I just tried cartopy version 0.18.1.dev113+g3565f78
(which includes SciTools/cartopy#1622). Here is the result.
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_global()
ax.coastlines()
plt.pcolormesh(
ds.lons.isel(nf=0).values,
ds.lats.isel(nf=0).values,
ds.SpeciesConc_NO2.isel(nf=0, lev=0, time=0).values,
vmax=8e-9
)
plt.pcolormesh(
ds.lons.isel(nf=1).values,
ds.lats.isel(nf=1).values,
ds.SpeciesConc_NO2.isel(nf=1, lev=0, time=0).values,
vmax=8e-9
)
So SciTools/cartopy#1622 does fix the horizontal streaking that we see. Thanks again @htonchia and @greglucas, this is terrific!
from gchp.
Just following up on my prefered workaround. Here's a minimal example.
I forgot to mention that with this method you have to plot each grid-box that crosses the AM as a polygon and manually specify its color. Since this is a minimal example, I omitted logic to only do this for grid-boxes that cross the AM, and instead I do it for all grid-boxes on nf=1. This can be sped up by using masked arrays with pcolormesh()
and then only drawing polygons for grid-boxes that cross the AM.
Note: This method also requires grid-box corners.
import shapely.geometry
import pyproj
# Get grid corners in epsg:4326
lons = grid.xe.isel(nf=1).values # Note: grid.xe and grid.ye are the grid's corners
lats = grid.ye.isel(nf=1).values
# Project corners to gnomonic space centered on the face nf=1
gno = ccrs.Gnomonic(20, -150)
xe, ye = pyproj.transform('epsg:4326', gno.proj4_init, lons, lats, always_xy=True)
# We have to manually assign colors to polygons, tf. create norm and cmap
cmap = plt.get_cmap('viridis')
norm = plt.Normalize(vmin=0, vmax=8e-9)
for j in range(ds.dims['Ydim']):
for i in range(ds.dims['Xdim']):
fill=cmap(norm(ds.SpeciesConc_NO2.isel(lev=0, nf=1, Ydim=j, Xdim=i).values[0])) # color of polygon
polygon = shapely.geometry.Polygon([(xe[j,i], ye[j,i]), (xe[j+1,i], ye[j+1,i]), (xe[j+1,i+1], ye[j+1,i+1]), (xe[j,i+1], ye[j,i+1])]) # create a polygon
ax.add_geometries( # add the polygon to the plot
[polygon],
gno, edgecolor=fill, facecolor=fill
)
A full example of this method can be found here
This can make plots that look like this
from gchp.
Good to know this will be officially fixed with Cartopy 0.19, which will make it easy to include in GCPy once we can confirm that our plotting works correctly in that new version.
from gchp.
Related Issues (20)
- Feature request: Update the docs/requirements.yml to avoid security issues w/ old python versions (used for ReadTheDocs) HOT 1
- Problem about compilation of GCHP HOT 11
- Wrong units for SLP and TROPP in preprocessed GEOS-IT ExtData.rc HOT 2
- Constant value for all grid boxes in Passive Tracer monthly mean diagnostic HOT 1
- Single column/grid subset mode? HOT 6
- Access issue with restart files of GCHP 14.3.2 HOT 10
- Stretched Grid Runs Failing with "Error calling DO_WETDEP" HOT 7
- Create Run Directory Problem with 14.2.2 and 14.2.3 container HOT 4
- Using gcchem_internal_checkpoint for grid-stretching simulation but fails with 'Factories not equal' error. HOT 17
- GCHP simulation stopped after 7 month simulation (total set time for 1 yr) HOT 9
- Wrong surface type field when using raw meteorology file HOT 7
- [SUBMODULE UPDATES] MAPL fix for restarting with stretched grid checkpoints HOT 1
- GCHP carbon simulations with CH4 take much longer than simulations without CH4 HOT 14
- Using a new inventory in ExtData.rc HOT 8
- GCHP 14.3.1 out of memory when writing checkpoint files HOT 12
- Error with CMIP6 file HOT 26
- ERROR during 'Initialize' stage of the gridded component 'EXTDATA' HOT 6
- Transport Budget Diagnostics at surface level for GCHP14.3.1 C180 simulation are all zero HOT 7
- error running carbon simulation HOT 16
- Segmentation fault - invalid memory reference in mapl_capmod_MOD_run_model 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 gchp.