epygram.fields.H2DVectorField — Horizontal 2-D Vector Field class

Contains the class for a Horizontal 2D Vector field.


class epygram.fields.H2DVectorField.H2DVectorField(*args, **kwargs)[source]

Bases: epygram.fields.D3VectorField.D3VectorField

Horizontal 2-Dimensions Vector field class.

This is a wrapper to a list of H2DField(s), representing the components of a vector projected on its geometry (the grid axes).

Note

This class is managed by footprint.

  • info: Not documented
  • priority: PriorityLevel::DEFAULT (rank=1)

Automatic parameters from the footprint:

  • comment (builtins.str) - rwd - Not documented, sorry.
    • Optional. Default is None.
  • components (footprints.stdtypes.FPList) - rxx - List of Fields that each compose a component of the vector.
    • Optional. Default is FPList::<<as_list:: []>>.
  • fid (footprints.stdtypes.FPDict) - rwx - Not documented, sorry.
  • misc_metadata (footprints.stdtypes.FPDict) - rwd - Not documented, sorry.
    • Optional. Default is FPDict::<<as_dict:: dict()>>.
  • processtype (builtins.str) - rxx - Generating process.
    • Optional. Default is None.
  • structure (builtins.str) - rxx - Type of Field geometry.
    • Values: set([‘H2D’])
  • units (builtins.str) - rwd - Not documented, sorry.
    • Optional. Default is ‘’.
  • validity (epygram.base.FieldValidityList) - rwx - Validity of the field.
    • Optional. Default is FieldValidityList::<<as_list:: [FieldValidity::<epygram.base.FieldValidity object at 0x7f60a4fcb828>]>>.
  • vector (builtins.bool) - rxx - Intrinsic vectorial nature of the field.
    • Values: set([True])

Constructor. See its footprint for arguments.

basemap_plot(over=(None, None), subzone=None, title=None, gisquality='i', specificproj=None, zoom=None, use_basemap=None, drawcoastlines=True, drawcountries=True, drawrivers=False, departments=False, boundariescolor='0.25', parallels='auto', meridians='auto', subsampling=1, symbol='barbs', symbol_options={'color': 'k'}, plot_module=True, plot_module_options=None, bluemarble=0.0, background=False, quiverkey=None, quiver_options=None, components_are_projected_on='grid', map_factor_correction=True, mask_threshold=None, figsize=None, drawmapboundary_kwargs=None, fillcontinents_kwargs=None, drawcoastlines_kwargs=None, drawcountries_kwargs=None, drawparallels_kwargs=None, drawmeridians_kwargs=None, drawequator_kwargs=None, drawgreenwich_kwargs=None, rcparams=None)

Note

Requires plugin: with_basemap (config.activate_plugins)

Note

Deprecated since version 1.3.11: (cf. cartoplot())

Makes a simple plot of the field, with a number of options.

Parameters:
  • over – to plot the vectors over an existing figure (e.g. colorshades). Any existing figure and/or ax to be used for the plot, given as a tuple (fig, ax), with None for missing objects. fig is the frame of the matplotlib figure, containing eventually several subplots (axes); ax is the matplotlib axes on which the drawing is done. When given (is not None), these objects must be coherent, i.e. ax being one of the fig axes.
  • subzone

    among (‘C’, ‘CI’), for LAM fields only, plots the data resp. on the C or C+I zone.

    Default is no subzone, i.e. the whole field.

  • gisquality – among (‘c’, ‘l’, ‘i’, ‘h’, ‘f’) – by increasing quality. Defines the quality for GIS elements (coastlines, countries boundaries…). Default is ‘i’. Cf. ‘basemap’ doc for more details.
  • specificproj

    enables to make basemap on the specified projection, among: ‘kav7’, ‘cyl’, ‘ortho’, (‘nsper’, {…}) (cf. Basemap doc).

    In ‘nsper’ case, the {} may contain:

    • ’sat_height’ = satellite height in km;
    • ’lon’ = longitude of nadir in degrees;
    • ’lat’ = latitude of nadir in degrees.

    Overwritten by zoom.

  • zoom

    specifies the lon/lat borders of the map, implying hereby a ‘cyl’ projection. Must be a dict(lonmin=, lonmax=, latmin=, latmax=).

    Overwrites specificproj.

  • use_basemap – a basemap.Basemap object used to handle the projection of the map. If given, the map projection options (specificproj, zoom, gisquality …) are ignored, keeping the properties of the use_basemap object. (because making Basemap is the most time-consuming step).
  • drawrivers – to add rivers on map.
  • departments – if True, adds the french departments on map (instead of countries).
  • boundariescolor – color of lines for boundaries (countries, departments, coastlines)
  • drawcoastlines – to add coast lines on map.
  • drawcountries – to add countries on map.
  • title – title for the plot. Default is field identifier.
  • meridians

    enable to fine-tune the choice of lines to plot, with either:

    • ’auto’: automatic scaling to the basemap extents
    • ’default’: range(0,360,10)
    • a list of values
    • a grid step, e.g. 5 to plot each 5 degree.
    • None: no one is plot
    • meridian == ‘greenwich’ // ‘datechange’ // ‘greenwich+datechange’ combination (,) will plot only these.
  • parallels

    enable to fine-tune the choice of lines to plot, with either:

    • ’auto’: automatic scaling to the basemap extents
    • ’default’: range(-90,90,10)
    • a list of values
    • a grid step, e.g. 5 to plot each 5 degree.
    • None: no one is plot
    • ’equator’ // ‘polarcircles’ // ‘tropics’ or any combination (,) will plot only these.
  • subsampling – to subsample the number of gridpoints to plot. Ex: subsampling = 10 will only plot one gridpoint upon 10.
  • symbol – among (‘barbs’, ‘arrows’, ‘stream’)
  • symbol_options – a dict of options to be passed to barbs or quiver method.
  • plot_module – to plot module as colorshades behind vectors.
  • plot_module_options – options (dict) to be passed to module.plotfield().
  • bluemarble – if > 0.0 (and <=1.0), displays NASA’s “blue marble” as background. The numerical value sets its transparency.
  • background – if True, set a background color to continents and oceans.
  • quiverkey – to activate quiverkey; must contain arguments to be passed to pyplot.quiverkey(), as a dict.
  • components_are_projected_on – inform the plot on which axes the vector components are projected on (‘grid’ or ‘lonlat’).
  • map_factor_correction – if True, applies a correction of magnitude to vector due to map factor.
  • mask_threshold – dict with min and/or max value(s) to mask outside.
  • figsize – figure sizes in inches, e.g. (5, 8.5). Default figsize is config.plotsizes.
  • drawmapboundary_kwargs – kwargs to be passed to basemap.drawmapboundary()
  • fillcontinents_kwargs – kwargs to be passed to basemap.fillcontinents()
  • drawcoastlines_kwargs – kwargs to be passed to basemap.drawcoastlines()
  • drawcountries_kwargs – kwargs to be passed to basemap.drawcountries()
  • drawparallels_kwargs – kwargs to be passed to basemap.drawparallels()
  • drawmeridians_kwargs – kwargs to be passed to basemap.drawgreenwich()
  • drawequator_kwargs – draw kwargs to emphasize equator parallel
  • drawgreenwich_kwargs – draw kwargs to emphasize greenwich meridian
  • rcparams – list of (*args, **kwargs) to be passed to pyplot.rc() defaults to [((‘font’,), dict(family=’serif’)),]

This method uses (hence requires) ‘matplotlib’ and ‘basemap’ libraries.

cartoimage(takeover=False, **plot_kwargs)

Note

Requires plugin: with_cartopy (config.activate_plugins)

Project an image, with a number of options.

Parameters:takeover – give the user more access to the objects used in the plot, by returning a dict containing them instead of only fig/ax

Arguments to build the figure, geometry, cartography and to plot the image shall be passed as additional arguments, cf. H2DField.cartoplot() arguments.

cartoplot(map_factor_correction=True, subsampling=1, components_are_projected_on='grid', vector_plot_method='quiver', vector_plot_kwargs=None, quiverkey=None, takeover=False, **module_plot_kwargs)

Note

Requires plugin: with_cartopy (config.activate_plugins)

Makes a simple plot of the vector field, with a number of options.

Arguments to build the figure, geometry, cartography and to plot the module of vector shall be passed as additional arguments, cf. H2DField.cartoplot() arguments.

To deactivate module plotting, add plot_method=None.

Parameters:
  • map_factor_correction – if True, applies a correction of magnitude to vector due to map factor.
  • subsampling – to subsample the number of gridpoints to plot. Ex: subsampling = 10 will only plot one gridpoint upon 10.
  • components_are_projected_on – inform the plot on which axes the vector components are already projected on (‘grid’ or ‘lonlat’).
  • vector_plot_method – the matplotlib Axes method to be used to plot, among (‘quiver’, ‘barbs’, ‘streamplot’).
  • vector_plot_kwargs – arguments to be passed to the associated plot method.
  • quiverkey – to activate quiverkey, in case vector_plot_method=’quiver’: may be a dict containing arguments to be passed to pyplot.quiverkey().

Takeover:

Parameters:takeover – give the user more access to the objects used in the plot, by returning a dict containing them instead of only fig/ax
comment

Undocumented footprint attribute

components

Undocumented footprint attribute

fid

Undocumented footprint attribute

misc_metadata

Undocumented footprint attribute

plotanimation(title='__auto__', repeat=False, interval=1000, **kwargs)

Note

Requires plugin: with_basemap (config.activate_plugins)

Note

Deprecated since version 1.3.11.

Plot the field with animation with regards to time dimension. Returns a matplotlib.animation.FuncAnimation.

In addition to those specified below, all plotfield() method arguments can be provided.

Parameters:
  • title – title for the plot. ‘__auto__’ (default) will print the current validity of the time frame.
  • repeat – to repeat animation
  • interval – number of milliseconds between two validities
plotfield(*args, **kwargs)

Note

Requires plugin: with_basemap (config.activate_plugins)

Proxy to basemap_plot().

processtype

Undocumented footprint attribute

structure

Undocumented footprint attribute

units

Undocumented footprint attribute

validity

Undocumented footprint attribute

vector

Undocumented footprint attribute