pybob.ICESat¶
- pybob.ICESat provides an interface to extracted ICESat(-1) data stored in HDF5 format. Pre-extracted ICESat tracks for
- each of the RGI subregions can be found here.
-
class
pybob.ICESat.ICESat(in_filename, in_dir=None, cols=['lat', 'lon', 'd_elev', 'd_UTCTime'], ellipse_hts=True)[source]¶ Create an ICESat dataset from an HDF5 file containing ICESat data.
-
__init__(in_filename, in_dir=None, cols=['lat', 'lon', 'd_elev', 'd_UTCTime'], ellipse_hts=True)[source]¶ Parameters: - in_filename (str) – Filename (optionally with path) of HDF5 file to be read in.
- in_dir (str) – Directory where in_filename is located. If not given, the directory will be determined from the input filename.
- cols (array-like) – Columns to read in and set as attributes in the ICESat object. Default values are [‘lat’, ‘lon’, ‘d_elev’, ‘d_UTCTime’], and will be added if not specified.
- ellipse_hts (bool) – Convert elevations to ellipsoid heights. Default is True.
The following example:
>>> ICESat('donjek_icesat.h5', ellipse_hts=True)
will return an ICESat object with lat, lon, elevation, and UTCTime attributes, with elevations given as height above WGS84 ellipsoid.
-
clean(el_limit=-500)[source]¶ Remove all elevation points below a given elevation.
Parameters: el_limit (float) – minimum elevation to accept
-
clip(bounds)[source]¶ Remove ICEsat data that falls outside of a given bounding box.
Parameters: bounds (array-like) – bounding box to clip to, given as xmin, xmax, ymin, ymax
-
display(fig=None, extent=None, sfact=1, showfig=True, geo=False, **kwargs)[source]¶ Plot ICESat tracks in a figure.
Parameters: - fig (matplotlib.figure.Figure) – Figure to plot tracks in. If not set, creates a new figure.
- extent (array-like) – Spatial extent to limit the figure to, given as xmin, xmax, ymin, ymax.
- sfact (int) – Factor by which to reduce the number of points plotted. Default is 1 (i.e., all points are plotted).
- showfig (bool) – Open the figure window. Default is True.
- geo (bool) – Plot tracks in lat/lon coordinates, rather than projected coordinates. Default is False.
- kwargs – Optional keyword arguments to pass to matplotlib.pyplot.plot
Returns fig: Handle pointing to the matplotlib Figure created (or passed to display).
-
from_ellipse()[source]¶ Convert ICESat elevations from ellipsoid heights, based on the data stored in the HDF5 file.
-
get_bounds(geo=False)[source]¶ Return bounding coordinates of the dataset.
Parameters: geo (bool) – Return geographic (lat/lon) coordinates (default is False) Returns bounds: xmin, xmax, ymin, ymax values of dataset. Example: >>> xmin, xmax, ymin, ymax = my_icesat.get_bounds()
-
mask(mask, mask_value=True, drop=False)[source]¶ Mask values
Parameters: - mask (array-like) – Array of same size as self.img corresponding to values that should be masked.
- mask_value (bool or numeric) – Value within mask to mask. If True, masks image where mask is True. If numeric, masks image where mask == mask_value.
- drop (bool) – remove values from dataset (True), or mask using numpy.masked_array (False). Default is False.
-
project(dest_proj)[source]¶ Project the ICESat dataset to a given coordinate system, using pyproj.transform. ICESat.project does not overwrite the lat/lon coordinates, so calling ICESat.project will only update self.x,self.y for the dataset, self.xy, and self.proj.
Parameters: dest_proj (str or pyproj.Proj) – Coordinate system to project the dataset into. If dest_proj is a string, ICESat.project() will create a pyproj.Proj instance with it. Example: Project icesat_data to Alaska Albers (NAD83) using epsg code:
>>> icesat_data.project('epsg:3338')
-
to_csv(out_filename)[source]¶ Write ICESat data to csv format using pandas.
Parameters: out_filename (str) – Filename (optionally with path) of file to read out.
-
to_ellipse()[source]¶ Convert ICESat elevations to ellipsoid heights, based on the data stored in the HDF5 file.
-
to_shp(out_filename, driver='ESRI Shapefile', epsg=4326)[source]¶ Write ICESat data to shapefile.
Parameters: - out_filename (str) – Filename (optionally with path) of file to read out.
- driver (str) – Name of driver fiona should use to create the outpufile. Default is ‘ESRI Shapefile’.
- epsg (int) – EPSG code to project data to. Default is 4326, WGS84 Lat/Lon.
Example:
>>> donjek_icesat.to_shp('donjek_icesat.shp', epsg=3338)
will write donjek_icesat to a shapefile in Alaska Albers projection (EPSG:3338)
-
-
pybob.ICESat.extract_ICESat(in_filename, workdir=None, outfile=None)[source]¶ Extract ICESat data given the extent of a GeoImg.
Note - currently not supported outside of UiO working environment.
Parameters: - in_filename (str) – Filename (optionally with path) of DEM to be opened using GeoImg.
- workdir (str) – Directory where in_filename is located. If not given, the directory will be determined from the input filename.
- outfile (str) – name of the output file [default=’ICESat_DEM.h5’]