User Tools

Site Tools


other:python:maps_by_jyp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
other:python:maps_by_jyp [2019/09/13 11:39] jypeterother:python:maps_by_jyp [2019/09/13 16:02] – Finished adding the megabiome example jypeter
Line 24: Line 24:
  
   * Summary: Plot two megabiome maps based on 2 versions of the IPSL model (CM5 and CM6), and compare them to a map with observations   * Summary: Plot two megabiome maps based on 2 versions of the IPSL model (CM5 and CM6), and compare them to a map with observations
-  * Authors: Raj Rani-Singh & Jean-Yves Peterschmitt+  * Authors: Raj Rani & Jean-Yves Peterschmitt
   * Date: September 2019   * Date: September 2019
   * Script: ''~jypeter/CDAT/Progs/Devel/pasb/PMIP4/Press_Conference_1909/mh_CM6_CM5_megabiome.py   * Script: ''~jypeter/CDAT/Progs/Devel/pasb/PMIP4/Press_Conference_1909/mh_CM6_CM5_megabiome.py
 '' ''
  
 +{{:other:python:mh_cm6_cm5_megabiome.png?direct&300 |}}
   * Load the NetCDF model data with ''cdms2'', and the xlsx observations' data with ''pandas''   * Load the NetCDF model data with ''cdms2'', and the xlsx observations' data with ''pandas''
   * Use ''matplotlib''+''cartopy'' to create the plot   * Use ''matplotlib''+''cartopy'' to create the plot
Line 35: Line 35:
     * Use a square (''figsize=(8, 8)'') figure size in order to improve the page layout     * Use a square (''figsize=(8, 8)'') figure size in order to improve the page layout
     * Use the same color scale for both the model data (plotted with ''pcolormesh'') and the observation data (plotted with ''scatter'')     * Use the same color scale for both the model data (plotted with ''pcolormesh'') and the observation data (plotted with ''scatter'')
 +    * Use a //dictionary trick// for easily using the same gridlines parameters for all the maps
     * Use a common //listed colormap// to plot the discrete megabiome values (with a //norm// associated with the megabiome values) and the observations (with a **different //norm//** associated with the observations)     * Use a common //listed colormap// to plot the discrete megabiome values (with a //norm// associated with the megabiome values) and the observations (with a **different //norm//** associated with the observations)
 +    * The three plots have the same colormap, but we create a standalone colormap (created with ''mpl.colorbar.ColorbarBase'') in the Bottom Left quadrant. We use ''UR_plot.get_position().bounds'' to determine the exact location of the Upper Right and Lower Left plots, and combine the coordinates to create the axis (with ''my_page.add_axes'') where the colorbar will be plotted
  
 /* standard page footer */ /* standard page footer */
other/python/maps_by_jyp.txt · Last modified: 2021/08/03 14:01 by jypeter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki