Plotting#
easysnowdata.plotting#
Plotting helpers: maps that are true to scale, time series on calendar dates.
Nothing here is required to use the data: every product plots with plain xarray and geopandas. What these helpers add is the map furniture and the labelling conventions the gallery follows, so an example is one call rather than fifteen lines of matplotlib:
map()— one raster on equal-aspect axes with a matched colorbar, a scale bar, a light latitude/longitude graticule, and an optional web basemap. Geographic (EPSG:4326) data get a latitude-corrected aspect and a warning, because a degree of longitude is not a degree of latitude.categorical()— the same for a classified raster, drawing its colours and legend from the CFflag_values/flag_meanings/flag_colorsattributeseasysnowdata.processing.categoricalwrites.points()— a GeoDataFrame of stations (or any vector layer) over a basemap, coloured by a column with a legend or colorbar placed outside.timeseries()— one line per station (or other dimension) against calendar dates, withlong name [units]axis labels.by_water_yearoverlays water years on one October-to-September axis.label()—"long name [units]"from an object’s attrs, the one convention every axis label here follows (units in square brackets).
Every piece of furniture is a keyword argument (scalebar=False,
graticule=False, basemap="CartoDB.Positron" …), and every function
returns the matplotlib Axes so anything can be added afterwards.
Draw one raster as a map with the package's conventions. |
|
Plot a categorical DataArray with one colour per class and a legend. |
|
Draw a GeoDataFrame (stations, basins) over a basemap with the map conventions. |
|
Plot a time series, one line per hue value, against calendar dates. |
|
|
|
Apply the map conventions to ax: aspect, labels, scale bar, graticule, basemap. |
|
Add a small scale bar ( |
|
Draw light latitude/longitude lines on ax and label them on the frame. |
|
Draw web tiles under the data on ax ( |
|
Draw gdf (boundaries, basins, glaciers) over a map, in the map's CRS. |
|
Return |
|
|
|
Register a |