S102FeatureInformation

class s100py.s102.api.S102FeatureInformation(*args, **kwrds)

Bases: s100py.s100.FeatureInformation

S102 specifc version of FeatureInformation. Sets defaults of uom.name to metres, fillValue to 1000000, upper and lower to 12000, -12000 and closure to closedInterval and datatype to H5T_NATIVE_FLOAT. The user should set code and name to ‘depth’ or ‘uncertainty’ as needed.

Inheritance diagram of S102FeatureInformation

Attributes Summary

closure

type of closure from S100 Table 1-3 — Interval Types.

closure_attribute_name

closure_type

code

Camel case code of attribute as in feature catalogue.

code_attribute_name

code_type

datatype

rtype

str

datatype_attribute_name

datatype_type

fill_value

Value denoting missing data.

fill_value_attribute_name

fill_value_type

lower

Lower bound on value of attribute

lower_attribute_name

lower_type

name

Long name as in feature catalogue

name_attribute_name

name_type

unit_of_measure

Units of measurement for the dataset.

unit_of_measure_attribute_name

unit_of_measure_type

upper

Upper bound on attribute value

upper_attribute_name

upper_type

Methods Summary

add_data(key, value)

closure_create()

code_create()

datatype_create()

fill_value_create()

get_all_keys()

Gets all the non-standard keys that are contained in this object currently as well as all the standard keys (S100/HDF5 style names) that could be added.

get_compound_dtype()

Override this method if the dtype of compound dataset items is important

get_data(key)

get_hdf5_from_file(file_obj)

get_s1xx_attr(s1xx_name)

get_standard_keys()

Returns the S100 (HDF5) names for the things that are listed in the specs for this class.

get_standard_list_properties()

Returns a list of properties that are lists (children based on S1xxMetadataListBase).

get_standard_properties()

This function autodetermines the properties implemented (which have get/set @properties and _attribute_name associated)

get_standard_properties_mapping()

This function autodetermines the HDF5 or xml names and their associated property names.

get_write_order()

Override this method if the write order of attributes/groups/dataset items is important

initialize_properties([...])

Calls the create function for all the properties of the class.

lower_create()

name_create()

read(group_object)

Given an h5py.File or a h5py group then read the data based on the encoded S100+ spec.

read_simple_attributes(group_object)

Reads the standard simple types (strings, ints, floats, datetimes, enums) from the given group as specified by the class specs.

set_datetime_attribute(val, attribute_name, ...)

A DateTime is a combination of a date and a time type.

set_enum_attribute(val, attribute_name, ...)

Function to set an attribute that is an enumeration type using either it's string or numeric value or enumeration instance.

set_s1xx_attr(s1xx_name, val)

unit_of_measure_create()

upper_create()

write(group_object)

write the contained data and all it's children into an HDF5 file using h5py.

write_as_xml(etree_object)

write_simple_attributes(group_object)

Attributes Documentation

closure

type of closure from S100 Table 1-3 — Interval Types:

openInterval    The open interval             (a,b)   a < x < b
geLtInterval    The right half-open interval  [a,b)   a ≤ x < b
gtLeInterval    The left half-open interval   (a,b]   a < x ≤ b
closedInterval  The closed interval           [a,b]   a≤ x ≤ b
gtSemiInterval  The left half-open ray        (a,∞)   a < x
geSemiInterval  The left closed ray           [a,∞)   a ≤ x
ltSemiInterval  The right half-open ray       (-∞,a)  x < a
leSemiInterval  The right closed ray          (-∞,a]  x ≤ a
Return type

str

closure_attribute_name = 'closure'
closure_type
code

Camel case code of attribute as in feature catalogue. The “code” and “datatype” components encode the rangeType attribute of the coverage features in Part 8.

Return type

str

code_attribute_name = 'code'
code_type
datatype
Return type

str

datatype_attribute_name = 'datatype'
datatype_type
fill_value

Value denoting missing data. Fill value (integer or float value, string representation)

Return type

Union[float, int, str]

fill_value_attribute_name = 'fillValue'
fill_value_type
lower

Lower bound on value of attribute

Return type

Union[float, int, str]

lower_attribute_name = 'lower'
lower_type
name

Long name as in feature catalogue

Return type

str

name_attribute_name = 'name'
name_type
unit_of_measure

Units of measurement for the dataset. (uom>name from S-100 feature catalogue)

Return type

str

unit_of_measure_attribute_name = 'uom.name'
unit_of_measure_type
upper

Upper bound on attribute value

Return type

Union[float, int, str]

upper_attribute_name = 'upper'
upper_type

Methods Documentation

add_data(key, value)
closure_create()
code_create()
datatype_create()
fill_value_create()
get_all_keys()

Gets all the non-standard keys that are contained in this object currently as well as all the standard keys (S100/HDF5 style names) that could be added.

Return type

list

get_compound_dtype()

Override this method if the dtype of compound dataset items is important

Return type

A list of dtype, None otherwise.

get_data(key)
get_hdf5_from_file(file_obj)
get_s1xx_attr(s1xx_name)
get_standard_keys()

Returns the S100 (HDF5) names for the things that are listed in the specs for this class.

Returns

The S102 HDF5 group/attribute/dataset names from this object that will be written or read from an HDF5 file. e.g. BathymetryCoverage or westBoundLongitude etc.

For the class “Root”: [‘BathymetryCoverage’, ‘Group_F’, ‘TrackingListCoverage’]

Return type

list

get_standard_list_properties()

Returns a list of properties that are lists (children based on S1xxMetadataListBase). Basically a way of finding which items will be named <name>_001, <name>_002 etc

Returns

The property names that will have auto-generated names based on their index in a list.

Return type

list

classmethod get_standard_properties()

This function autodetermines the properties implemented (which have get/set @properties and _attribute_name associated)

Returns

Names of the properties implemented.

For eample class “Root” might have (for S102): [‘bathymetry_coverage’, ‘feature_information’, ‘tracking_list_coverage’]

Return type

list

get_standard_properties_mapping()

This function autodetermines the HDF5 or xml names and their associated property names. Keys are the s100 (HDF5 spelling) strings and the values are the python style naming.

Returns

dictionary of xml element names as keys and property names as values.

For the class “Root”: {‘BathymetryCoverage’: ‘bathymetry_coverage’, ‘Group_F’: ‘feature_information’, ‘TrackingListCoverage’: ‘tracking_list_coverage’}

Return type

dict

get_write_order()

Override this method if the write order of attributes/groups/dataset items is important

Return type

A list of key names if order is important, None otherwise.

initialize_properties(recursively_create_children=False, overwrite=True)

Calls the create function for all the properties of the class. Default values will be created for each attribute that is expected to be contained in this object.

For example, say a class has simple attributes of ESPG code (int) and locatilty (str) and then a class made from S1xxAttributesBase called “extents” which has east and west inside it.

Calling initialize_properties(recursively_create_children=False) would result in EPSG=0, locality=”” and an instance of the “extents” class but NO value (nothing would be written to HDF5) for east, west.

Calling initialize_properties(recursively_create_children=True) would result in EPSG=0, locality=”” and an instance of the “extents” class but with east=0.0 and wesst=0.0 as well.

Calling initialize_properties(recursively_create_children=True, overwrite=False) with an esiting dataset, say locality=”test” would result in EPSG=0 being made, locality=”test” being retained and an instance of the “extents” class with east=0.0 and wesst=0.0 as well.

Parameters
  • recursively_create_children – True = Create children for any child data that would have other children False = Only create data for immediate children of this instance

  • overwrite – True = Overwrite existing data with new default data False = Keep existing data if it exists but create new data otherwise

Return type

None

lower_create()
name_create()
read(group_object)

Given an h5py.File or a h5py group then read the data based on the encoded S100+ spec.

Parameters

group_object – The group (an h5py.File is a group too) to read from.

Return type

None

read_simple_attributes(group_object)

Reads the standard simple types (strings, ints, floats, datetimes, enums) from the given group as specified by the class specs.

Parameters

group_object – The group (an h5py.File is a group too) to read from.

Return type

None

set_datetime_attribute(val, attribute_name, date_type)

A DateTime is a combination of a date and a time type. Character encoding of a DateTime must follow ISO 8601:2004 ( :2004 took away partial dates with two digit year or just month/day) EXAMPLES 19850412T101530 2001-07-17T04:50:00 2012-11-01T00:44:00+10:30 2001-07-17 19850412T101530.44 19850412T101530.44Z 19850412T101530.44+10 19850412T101530.44+1030 19850412T10:15:30Z

Parameters
  • val

  • attribute_name

  • date_type

set_enum_attribute(val, attribute_name, enum_type)

Function to set an attribute that is an enumeration type using either it’s string or numeric value or enumeration instance.

Parameters
  • val – The value as a string, int or Enum().

  • attribute_name – The S100 name (hdf5 spelling).

  • enum_type – The class of enumeration to use if an instance needs to be created.

Return type

None

set_s1xx_attr(s1xx_name, val)
unit_of_measure_create()
upper_create()
write(group_object)

write the contained data and all it’s children into an HDF5 file using h5py.

Parameters

group_object – An h5py.File or an h5py group object

Return type

None

write_as_xml(etree_object)
write_simple_attributes(group_object)
__init__(*args, **kwrds)