Map plotting tools for gridded data¶
Created on 24 Mai 2025
- Authors:
radanovics
largely copied from epygram epy_cartoplot.py
- plots.maps.quicklookmap.difference_map(field, ref_field, title, plot_kwargs={})[source]¶
Plot a difference map between two fields.
- Parameters:
field (epygram H2D field) – first scalar field
ref_field (epygram H2D field) – reference field to substract.
title (str) – plot title
plot_kwargs – every other argument that can be passed to the cartoplot method of an epygram H2D field.
- Returns:
dict with plot elements: ‘fig’, ‘ax’, potentially ‘colorbar’ etc.
- Return type:
dict
- plots.maps.quicklookmap.read_and_preprocess(resource, fid, date, operation=None, global_shift_center=None, zoom=None)[source]¶
Read field in resource, and preprocess if requested.
- Parameters:
resource (epygram.resource) – epygram resource to read data from
fid (epygram field idenifier depending on the resource type. for example str for NetCDF files or a dict for grib files) – field identifier
date (bronx.Date) – date (with time)
operation (dict) – makes the requested operation (e.g. {‘operation’:’-‘,’operand’:273.15} or {‘operation’:’exp’}) on the field before plot. default=None
global_shift_center – for global lon/lat grids, shift the center by the requested angle (in degrees). Enables a [0,360] grid to be shifted to a [-180,180] grid, for instance (with -180 argument).
zoom (dict) – a dict(lonmin, lonmax, latmin, latmax) on which to build the plot.
- Returns:
field
- Return type:
epygram.field
- plots.maps.quicklookmap.scalar_map(field, title, plot_kwargs)[source]¶
Plot a map.
- Parameters:
field (epygram H2DField or H2DVectorField) – field to plot
title (str) – plot title
plot_kwargs – every other argument that can be passed to the cartoplot method of an epygram H2D field.
- Returns:
dict with plot elements: ‘fig’, ‘ax’, potentially ‘colorbar’ etc.
- Return type:
dict
- plots.maps.quicklookmap.wind_map(field, title, map_factor_correction=False, vectors_subsampling=50, wind_components_are_projected_on=None, vector_plot_method='quiver', quiverkey=None, plot_kwargs={})[source]¶
Plot a map of a vector field.
- Parameters:
field (epygram vector field) – vector field to plot
title (str) – plot title
map_factor_correction (bool) – if True, applies a correction of magnitude to vector due to map factor.
vectors_subsampling (int) – subsampling ratio of vectors plots. for example: 1 for a vector at every gridpoint, 10 for a vector every 10 grid points.
wind_components_are_projected_on – inform the plot on which axes the vector components are projected on (‘grid’ or ‘lonlat’). If None (default), look for information in the field, or raise error.
vector_plot_method – among (‘quiver’, ‘barbs’, ‘streamplot’) for vector plots. default is ‘quiver’.
quiverkey – options to be passed to plotfield to activate a quiver key (cf. pyplot.quiverkey).
plot_kwargs – every other argument that can be passed to the cartoplot method of an epygram H2D field.
- Returns:
dict with plot elements: ‘fig’, ‘ax’, potentially ‘colorbar’ etc.
- Return type:
dict