This document describes the HydrOffice BAG library and tools (0.2). For the source code,
go here.
hydroffice.bag package
Submodules
hydroffice.bag.bag module
-
class
hydroffice.bag.bag.BAGFile(name, mode=None, driver=None, libver=None, userblock_size=None, swmr=False, **kwds)[source]
Bases: hydroffice.bag.base.File
Represents a BAG file.
-
BAG_NAN = 1000000
-
classmethod
create_template(name)[source]
create a BAG file with empty template structure
-
default_metadata_file = 'BAG_metadata.xml'
-
elevation(mask_nan=True, row_range=None)[source]
Return the elevation as numpy array
- mask_nan
- If True, apply a mask using the BAG nan value
- row_range
- If present, a slice of rows to read from
-
elevation_shape()[source]
Save metadata on disk
- name
- The file path where the metadata will be saved. If None, use a default name.
-
metadata(as_string=True, as_pretty_xml=True)[source]
Return the metadata
- as_string
- If True, convert the metadata from a dataset of characters to a string
- as_pretty_xml
- If True, return the xml in a pretty format
-
populate_metadata()[source]
Populate metadata class
-
tracking_list()[source]
Return the tracking list as numpy array
-
tracking_list_fields()[source]
Return the tracking list field names
-
uncertainty(mask_nan=True, row_range=None)[source]
Return the uncertainty as numpy array
- mask_nan
- If True, apply a mask using the BAG nan value
- row_range
- If present, a slice of rows to read from
-
uncertainty_shape()[source]
-
validate_metadata()[source]
Validate metadata based on XML Schemas and schematron.
-
validation_info()[source]
Return a message string with the result of the validation
hydroffice.bag.base module
-
class
hydroffice.bag.base.File(name, mode=None, driver=None, libver=None, userblock_size=None, swmr=False, **kwds)[source]
Bases: h5py._hl.files.File
Represents a BAG file (at low-level, thin wrapper around h5py).
-
close()[source]
Close the file. All open objects become invalid
-
flush()[source]
Tell the BAG library to flush its buffers.
-
hydroffice.bag.base.is_bag(file_name)[source]
Determine if a file is valid BAG (False if it doesn’t exist).
-
hydroffice.bag.base.u(s)[source]
hydroffice.bag.bbox module
-
class
hydroffice.bag.bbox.Bbox2Gdal(bag_meta, fmt='kml', title=None, out_file=None)[source]
Bases: object
-
formats = {'gjs': [b'GeoJSON', 'bag.geojson'], 'gml': [b'GML', 'bag.gml'], 'kml': [b'KML', 'bag.kml'], 'shp': [b'ESRI Shapefile', 'bag.shp']}
hydroffice.bag.elevation module
-
class
hydroffice.bag.elevation.Elevation2Gdal(bag_elevation, bag_meta, fmt='geotiff', out_file=None, epsg=None)[source]
Bases: object
-
formats = {'ascii': [b'AAIGrid', 'bag.elevation.asc'], 'geotiff': [b'GTiff', 'bag.elevation.tif'], 'xyz': [b'XYZ', 'bag.elevation.xyz']}
hydroffice.bag.helper module
-
exception
hydroffice.bag.helper.BAGError(message, *args)[source]
Bases: Exception
BAG class for exceptions
-
class
hydroffice.bag.helper.Helper[source]
Bases: object
-
static
elide(input_str, max_len=255)[source]
only in case the passed string is longer than ‘max_len’, it applies elision
-
classmethod
iso19139_folder()[source]
-
classmethod
iso19757_3_folder()[source]
-
classmethod
samples_folder()[source]
hydroffice.bag.tracklist module
-
class
hydroffice.bag.tracklist.TrackList2Csv(track_list, csv_file=None, header=None, comment=None)[source]
Bases: object
-
default_csv_name = 'BAG.tracklist.csv'
hydroffice.bag.uncertainty module
-
class
hydroffice.bag.uncertainty.Uncertainty2Gdal(bag_uncertainty, bag_meta, fmt='geotiff', out_file=None, epsg=None)[source]
Bases: object
-
formats = {'ascii': [b'AAIGrid', 'bag.uncertainty.asc'], 'geotiff': [b'GTiff', 'bag.uncertainty.tif'], 'xyz': [b'XYZ', 'bag.uncertainty.xyz']}
Module contents
BAG
-
hydroffice.bag.hyo_lib()[source]