File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ def plot_global_mpas_field(
2525 figsize = (8 , 4.5 ),
2626 dpi = 200 ,
2727 patch_edge_color = None ,
28+ descriptor = None ,
2829):
2930 """
3031 Plots a data set as a longitude-latitude map
@@ -72,6 +73,15 @@ def plot_global_mpas_field(
7273
7374 patch_edge_color : str, optional
7475 The color of patch edges (if not the same as the face)
76+
77+ descriptor : mosaic.Descriptor, optional
78+ Descriptor from a previous call to ``plot_global_mpas_field()``
79+
80+ Returns
81+ -------
82+ descriptor : mosaic.Descriptor
83+ For reuse with future plots. Patches are cached, so the Descriptor only
84+ needs to be created once per mesh file.
7585 """
7686
7787 use_mplstyle ()
@@ -80,9 +90,13 @@ def plot_global_mpas_field(
8090 projection = cartopy .crs .PlateCarree (central_longitude = central_longitude )
8191
8292 mesh_ds = xr .open_dataset (mesh_filename )
83- descriptor = mosaic .Descriptor (
84- mesh_ds , projection = projection , transform = transform , use_latlon = True
85- )
93+ if descriptor is None :
94+ descriptor = mosaic .Descriptor (
95+ mesh_ds ,
96+ projection = projection ,
97+ transform = transform ,
98+ use_latlon = True ,
99+ )
86100
87101 fig , ax = plt .subplots (
88102 figsize = figsize ,
You can’t perform that action at this time.
0 commit comments