hypergas.folium_map module

Plot orthorectified data and overlay images on folium maps.

class hypergas.folium_map.Map(dataset, varnames, center_map=None)[source]

Bases: object

Plot data on folium maps.

Initialize Map class.

Parameters:
  • dataset (Dataset) – The xarray dataset which contains gas fields and geolocations (longitude and latitude).

  • varnames (list) – The list of varnames to be plotted.

  • center_map (list) – The map center: [latitude, longitude].

Examples

Basic usage:

m = Map(ds, ['rgb', 'ch4'])
m.initialize()
m.plot()
m.export()

Full parameters:

m = Map(ds, ['rgb', 'ch4'])
m.initialize()
m.plot(show_layers=[False, True], opacities=[0.9, 0.7])
m.export('full_params.html')

Multiple datasets on one map:

m = Map(ds1, ['rgb', 'ch4'])
m.initialize()
m.plot()
m.ds = ds2
m.varnames = varnames2
m.plot()
m.export()
export(savename=None, pre_suffix='')[source]

Export plotted folium map to html file.

Parameters:
  • savename (str) – The exported html filename.

  • pre_suffix (str) – The suffix added to the html filename.

initialize()[source]

Set the basic folium map background.

plot(out_epsg=3857, vmax=None, show_layers=None, opacities=None, marker=None, df_marker=None, export_dir=None, draw_polygon=True, pre_suffix='')[source]

Plot data, export to png files, plot folium map, and export to html files.

Parameters:
  • out_epsg (int) – EPSG code of the output projection (3857 is the proj of folium Map).

  • vmax (float) – The cmap vmax for plotting species (unit is as same as species variable).

  • show_layers (bool list) – Whether the layers will be shown on opening (the length should be as same as varnames).

  • opacities (float list) – The opacities of layer (the length should be as same as varnames).

  • marker (list) – The coords [lat, lon] for a yellow circle marker.

  • df_marker (DataFrame) – The DataFrame (columns: latitude, longitude) for adding blue circle markers.

  • export_dir (str) – The directory to save plotted images (Default: the same path as filename attrs).

  • draw_polygon (bool) – Whether plot the scene boundary polygon (Default: True).

  • pre_suffix (str) – The suffix added to the png and html filename (Default: “”).

plot_folium(pre_suffix='')[source]

Overlay png images on folium map.

Parameters:

pre_suffix (str) – The suffix added to the png and html filename.

plot_png(out_epsg=3857, vmax=None, export_dir=None, pre_suffix='')[source]

Plot data and export to png files.

Parameters:
  • out_epsg (int) – EPSG code of the output projection (3857 is the proj of folium Map).

  • vmax (float) – The cmap vmax for plotting species (unit is as same as species variable).

  • export_dir (str) – The directory to save plotted images (Default: the same path as filename attrs).

  • pre_suffix (str) – The suffix added to the png and html filename (Default: “”).

plot_wind(source='ERA5', position='bottomright')[source]

Plot the wind as html element.

Parameters:
  • source (str) – wind source: “ERA5” or “GEOS-FP”.

  • position (str) – the position to add the wind marker.