# Cmip6 data visualization

**URL:** <https://discourse.pangeo.io/t/cmip6-data-visualization/1222>\
**Category:** Data\
**Tags:** location-ncar\
**Created:** [February 10, 2021, 11:14am UTC](https://discourse.pangeo.io/t/cmip6-data-visualization/1222 "2021-02-10T11:14:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeparaLaMapara](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/leparalamapara/32/795_2.png) [@LeparaLaMapara](https://discourse.pangeo.io/u/LeparaLaMapara)\
**Post date:** [February 10, 2021, 11:14am UTC](https://discourse.pangeo.io/t/cmip6-data-visualization/1222/1 "2021-02-10T11:14:30Z")

</div>

Hi guys I’m working on CMIP6 data and trying to visualize the data using basemap, but the data for some of the ensemble models does not look right

Here is the screenshot:

 ![Screenshot 2021-02-10 at 13.10.29](https://canada1.discourse-cdn.com/flex030/uploads/pangeo/original/1X/473136d060d219a3bfe44267f7283acf4f20a8ef.jpeg)

This is the data i used to plot the image above  
def plot\_field(m, X, lats, lons, step=0.5, cmap=plt.get\_cmap(‘jet’),   
ax=False, grid=False, title=None):

```
lons, lats = np.meshgrid(lons, lats)

if not ax: 
    f, ax = plt.subplots(figsize=(8, (X.shape[0] / float(X.shape[1])) * 8))
m.ax = ax
Xmin = np.nanmin(X)
Xmax = np.nanmax(X)
im = m.contourf(lons, lats, X, np.arange(Xmin, Xmax+step, step), \
                latlon=True, cmap=cmap, extend='both', ax=ax)

```

# im = m.imshow(X, ax=ax)

```
m.drawcoastlines()
if grid: 
    m.drawmeridians(np.arange(0, 360, 30), labels=[0,0,0,1])
    m.drawparallels(np.arange(-80, 80, 20), labels=[1,0,0,0])
m.colorbar(im)
if title: 
    ax.set_title(title)
```

---

<div class="post-metadata">

**Author:** ![aaronspring](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/aaronspring/32/188_2.png) [@aaronspring](https://discourse.pangeo.io/u/aaronspring)\
**Post date:** [February 10, 2021, 6:46pm UTC](https://discourse.pangeo.io/t/cmip6-data-visualization/1222/2 "2021-02-10T18:46:57Z")

</div>

Do you have to use basemap?

Try cartopy. [Plotting — xarray 0.16.3.dev0+gcc53a77f.d20201130 documentation](http://xarray.pydata.org/en/stable/plotting.html#maps)

[https://xarray-contrib.github.io/xarray-tutorial/scipy-tutorial/04\_plotting\_and\_visualization.html#Geography:-Matplotlib-and-Cartopy](https://xarray-contrib.github.io/xarray-tutorial/scipy-tutorial/04_plotting_and_visualization.html#Geography:-Matplotlib-and-Cartopy)

just pass “lat” as string instead of lat from numpy. “Lon” likewise
