api
Plotting tools for visualizing rioxarray variables on ipyleaflet maps
General Attributes and Methods
- class IS2view.api.Leaflet(projection, **kwargs)[source]
Create interactive leaflet maps for visualizing ATL14/15 data
- Parameters:
- mapobj or NoneType, default None
ipyleaflet.Map- basemapobj or NoneType
Basemap for the
ipyleaflet.Map- layoutobj, default
ipywidgets.Layout(width='70%', height='600px') Layout for the
ipyleaflet.Map- attributionbool, default False
Include layer attributes on leaflet map
- scale_controlbool, default False
Include spatial scale bar to map
- cursor_controlbool, default True
Include display for cursor location
- full_screen_control: bool, default False
Include control for full screen map view
- layer_controlbool, default True
Include control for added map layers
- draw_controlbool, default False
Include control for interactively drawing on map
- draw_toolslist, default [‘marker’, ‘polyline’, ‘rectangle’, ‘polygon’]
Interactive drawing tools to include with control
- colorstr, default ‘blue’
Color of drawn or included GeoJSON objects
- centertuple, default (0, 0)
Map center at (latitude, longitude)
- zoomint, default 1
Initial map zoom level
- Attributes:
- mapobj
ipyleaflet.Map- crsstr
Coordinate Reference System of map
- layer_controlobj
ipyleaflet.LayersControl- scale_controlobj
ipyleaflet.ScaleControl- cursorobj
ipywidgets.Labelwith cursor location- geometriesdict
GeoJSON formatted geometries
- add_geodataframe(gdf, **kwargs)[source]
Add a GeoDataFrame to map and append to list of geometries
- Parameters:
- gdfobj
geopandas GeoDataFrame
- kwargsdict, default {}
Keyword arguments for GeoJSON
- to_geojson(filename, **kwargs)[source]
Output geometries to a GeoJSON file
- Parameters:
- filenamestr
Output GeoJSON filename
- kwargsdict, default {}
Additional attributes for the GeoJSON file
- plot_basemap(ax=None, **kwargs)[source]
Plot the current basemap
- Parameters:
- ax: obj, default None
Figure axis
- kwargs: dict, default {}
Additional keyword arguments for
owslib.wms.getmap
- plot_geometries(ax=None, **kwargs)[source]
Plot the current geometries in the coordinate reference system (
crs) of the map- Parameters:
- ax: obj, default None
Figure axis
- kwargs: dict, default {}
Additional keyword arguments for
plot
- property layers
get the map layers
- property controls
get the map controls
- IS2view.api.image_service_layer(name, raster='hillshade')[source]
Creates image service layers with optional raster functions
- Parameters:
- namestr
Name of the image service layer
ArcticDEMREMA
- rasterstr, default ‘hillshade’
Name of the raster function for image service layer
aspect: Slope Aspect Mapcontour: Elevation Contours Mapellipsoidal: Ellipsoidal Elevation Maphillshade: Gray Hillshade Maporthometric: Orthometric Elevation Mapslope: Slope Mapsmoothed: Smoothed Contours Maptinted: Tinted Hillshade Map
- class IS2view.api.LeafletMap(**kwargs: Any)[source]
A xarray.DataArray extension for interactive map plotting, based on ipyleaflet
- Parameters:
- dsobj
xarray.Dataset
- Attributes:
- _dsobj
xarray.Dataset- _ds_selectedobj
xarray.Datasetfor selected variable- _variablestr
Selected variable
- mapobj
ipyleaflet.Map- crsstr
Coordinate Reference System of map
- left, top, right, bottomfloat
Map bounds in image coordinates
- swdict
Location of lower-left corner in projected coordinates
- nedict
Location of upper-right corner in projected coordinates
- boundstuple
Location of map bounds in geographical coordinates
- imageobj
ipyleaflet.ImageServicelayer for variable- cmapobj
Matplotlib colormap object
- normobj
Matplotlib normalization object
- opacityfloat
Transparency of image service layer
- colorbarobj
ipyleaflet.WidgetControlwith Matplotlib colorbar- popupobj
ipyleaflet.Popupwith value at clicked location- _datafloat
Variable value at clicked location
- _unitsstr
Units of selected variable
- plot(m, **kwargs)[source]
Creates image plots on leaflet maps
- Parameters:
- mobj
leaflet map to add the layer
- variablestr, default ‘delta_h’
xarray variable to plot
- lagint, default 0
Time lag to plot if 3-dimensional
- cmapstr, default ‘viridis’
matplotlib colormap
- vminfloat or NoneType
Minimum value for normalization
- vmaxfloat or NoneType
Maximum value for normalization
- normobj or NoneType
Matplotlib color normalization object
- opacityfloat, default 1.0
Opacity of image plot
- enable_popupsbool, default False
Enable contextual popups
- colorbarbool, decault True
Show colorbar for rendered variable
- positionstr, default ‘topright’
Position of colorbar on leaflet map
- property z
get the map zoom level
- property resolution
get the map resolution for a given zoom level
- get_norm_bounds(**kwargs)[source]
Get the colorbar normalization bounds
- Parameters:
- vminfloat or NoneType
Minimum value for normalization
- vmaxfloat or NoneType
Maximum value for normalization
- add_colorbar(**kwargs)[source]
Creates colorbars on leaflet maps
- Parameters:
- cmapstr, matplotlib colormap
- normobj, matplotlib color normalization object
- opacityfloat, opacity of colormap
- orientationstr, orientation of colorbar
- labelstr, label for colorbar
- positionstr, position of colorbar on leaflet map
- widthfloat, width of colorbar
- heightfloat, height of colorbar
- class IS2view.api.TimeSeries(**kwargs: Any)[source]
A xarray.DataArray extension for extracting and plotting a time series
- Parameters:
- dsobj
xarray.Dataset
- Attributes:
- _dsobj
xarray.Dataset- _ds_selectedobj
xarray.Datasetfor selected variable- _variablestr
Selected variable
- geometrydict
GeoJSON geometry of feature
- propertiesdict
GeoJSON properties of feature
- crsstr
Coordinate Reference System of feature
- _datafloat
Variable value at geometry
- _areafloat
Area of geometry (
Polygon,MultiPolygon)- _diststr
Eulerian distance from first point (
LineString)- _timestr
Time coordinates in decimal-years
- _unitsstr
Units of selected variable
- _longnamestr
Unit longname of selected variable
- _linestr
Matplotlib line object from plot
- plot(feature, variable='delta_h', crs='epsg:4326', epoch=2018.0, ax=None, figsize=(6, 4), all_touched=False, conserve=False, **kwargs)[source]
Plot a time series for an extracted geometry
- Parameters:
- featureobj
GeoJSON feature to extract
- variablestr, default ‘delta_h’
xarray variable to plot
- crsstr, default ‘epsg:4326’
coordinate reference system of geometry
- epochfloat, default 2018.0
Reference epoch for delta times
- axobj or NoneType, default None
Figure axis on which to plot
Mutually exclusive with
figsize- figsizetuple, default (6,4)
Dimensions of figure to create
- all_touchedbool, default False
Include all pixels touched by geometry
- conservebool, default False
Conserve total value when averaging over area
- kwargsdict, default {}
Keyword arguments for time series plot
- extract(feature, variable='delta_h', crs='epsg:4326', epoch=2018.0, fields=[], all_touched=False, conserve=False, **kwargs)[source]
Extract a time series for a geometry
- Parameters:
- featureobj
GeoJSON feature to extract
- variablestr, default ‘delta_h’
xarray variable to extract
- crsstr, default ‘epsg:4326’
coordinate reference system of geometry
- epochfloat, default 2018.0
Reference epoch for delta times
- fieldslist, default []
Additional variables to extract from dataset
- all_touchedbool, default False
Include all pixels touched by geometry
- conservebool, default False
Conserve total value when averaging over area
- point(ax, fields=[], **kwargs)[source]
Extracts and plots a time series for a geolocation
- Parameters:
- axobj or NoneType
Figure axis on which to plot
Will only extract time series if
None- legendbool, default False
Add legend
- fieldslist, default []
Additional variables to extract from dataset
- transect(ax, fields=[], all_touched=False, **kwargs)[source]
Extracts and plots a time series for a transect
- Parameters:
- axobj or NoneType
Figure axis on which to plot
Will only extract time series if
None- cmapstr or NoneType, default None
matplotlib colormap
- legendbool, default False
Add legend with time values
- fieldslist, default []
Additional variables to extract from dataset
- all_touchedbool, default False
Include all pixels touched by geometry
- average(ax, fields=[], all_touched=False, conserve=False, **kwargs)[source]
Extracts and plots a time series for a regional average
- Parameters:
- axobj or NoneType
Figure axis on which to plot
Will only extract time series if
None- legendbool, default False
Add legend
- fieldslist, default []
Additional variables to extract from dataset
- all_touchedbool, default False
Include all pixels touched by geometry
- conservebool, default False
Update masks to conserve volume between calls
- class IS2view.api.Transect(**kwargs: Any)[source]
A xarray.DataArray extension for extracting a transect
- Parameters:
- dsobj
xarray.Dataset
- Attributes:
- _dsobj
xarray.Dataset- _ds_selectedobj
xarray.Datasetfor selected variable- _variablestr
Selected variable
- geometrydict
GeoJSON geometry of feature
- propertiesdict
GeoJSON properties of feature
- crsstr
Coordinate Reference System of feature
- _datafloat
Variable value at geometry
- _diststr
Eulerian distance from first point (
LineString)- _unitsstr
Units of selected variable
- _longnamestr
Unit longname of selected variable
- _linestr
Matplotlib line object from plot
- plot(feature, variable='h', lag=0, crs='epsg:4326', ax=None, figsize=(6, 4), all_touched=False, **kwargs)[source]
Creates a plot for a transect
- Parameters:
- featureobj
GeoJSON feature to extract
- variablestr, default ‘h’
xarray variable to plot
- lagint, default 0
Time lag to plot if 3-dimensional
- crsstr, default ‘epsg:4326’
coordinate reference system of geometry
- axobj or NoneType, default None
Figure axis on which to plot
Mutually exclusive with
figsize- figsizetuple, default (6,4)
Dimensions of figure to create
- all_touchedbool, default False
Include all pixels touched by geometry
- kwargsdict, default {}
Keyword arguments for transect plot
- extract(feature, variable='h', lag=0, crs='epsg:4326', all_touched=False, **kwargs)[source]
Extract a transect for a geometry
- Parameters:
- featureobj
GeoJSON feature to extract
- variablestr, default ‘h’
xarray variable to extract
- lagint, default 0
Time lag to extract if 3-dimensional
- crsstr, default ‘epsg:4326’
coordinate reference system of geometry
- epochfloat, default 2018.0
Reference epoch for delta times
- all_touchedbool, default False
Include all pixels touched by geometry
- transect(ax, fields=[], all_touched=False, **kwargs)[source]
Extracts and plots a transect
- Parameters:
- axobj or NoneType
Figure axis on which to plot
Will only extract transect if
None- legendbool, default False
Add legend
- fieldslist, default []
Additional variables to extract from dataset
- all_touchedbool, default False
Include all pixels touched by geometry