Synthesis Models
This is the main package, containing the BASIN-3D Django Framework’s synthesis model classes used for building custom a brokering service.
django_basin3d.synthesis
- synopsis:
The high level BASIN-3D synthesis models.
- module author:
Val Hendrix <vhendrix@lbl.gov>
- module author:
Danielle Svehla Christianson <dschristianson@lbl.gov>
- module author:
Charuleka Varadharajan <cvaradharajan@lbl.gov>
serializers- Serializers that renderbasin3d.core.modelsfrom Python objects to JSON and back again.viewsets- Controllers for BASIN-3D REST api
django_basin3d.synthesis.serializers
- synopsis:
The BASIN-3D Synthesis Model Serializers
- module author:
Val Hendrix <vhendrix@lbl.gov>
- module author:
Danielle Svehla Christianson <dschristianson@lbl.gov>
Serializers that render basin3d.core.models from Python objects to JSON and back again.
- class django_basin3d.synthesis.serializers.AbsoluteCoordinateSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.AbsoluteCoordinate- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- handle_fields(request=None)
Restrict the fields by those in the request :type request: :param request: :return:
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.CoordinateSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.Coordinate- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- handle_fields(request=None)
Restrict the fields by those in the request :type request: :param request: :return:
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.FeatureSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.Feature- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_url(obj)[source]
Get the Site url based on the current context :type obj: :param obj: an object instance :return: An URL to the current object instance
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- handle_fields(request=None)
Restrict the fields by those in the request :type request: :param request: :return:
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.FloatField(*args, **kwargs)[source]
A Float field that can handle empty strings
- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
Validate a simple representation and return the internal value.
The provided data may be empty if no representation was included in the input.
May raise SkipField if the field should not be included in the validated data.
- run_validators(value)
Test the given value against all the validators on the field, and either raise a ValidationError or simply return.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.HorizonatalCoordinateSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.HorizonatalCoordinateand its child classes- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.IdUrlSerializerMixin(*args, **kwargs)[source]
Serializer Mixin to support Hypermedia as the Engine of Application State (HATEOAS).
- class django_basin3d.synthesis.serializers.MappedAttributeField(*args, **kwargs)[source]
A field to handle the special case of a Mapped Attribute
- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
Validate a simple representation and return the internal value.
The provided data may be empty if no representation was included in the input.
May raise SkipField if the field should not be included in the validated data.
- run_validators(value)
Test the given value against all the validators on the field, and either raise a ValidationError or simply return.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.MeasurementTimeseriesTVPObservationSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.MeasurementTimeseriesTVPObservation- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_datasource(obj)[source]
Return the url for the data sources associated with the current observation :type obj: :param obj: :return:
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_url(obj)[source]
Get the url based on the current context :type obj: :param obj:
MeasurementTimeseriesTVPObservationobject instance :return: An URL to the current object instance
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.MonitoringFeatureSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.MonitoringFeature- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_url(obj)
Get the Site url based on the current context :type obj: :param obj: an object instance :return: An URL to the current object instance
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- handle_fields(request=None)
Restrict the fields by those in the request :type request: :param request: :return:
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.ObservationSerializerMixin(*args, **kwargs)[source]
Serializes a
basin3d.core.models.Observation
- class django_basin3d.synthesis.serializers.PersonSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.Person- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.ReadOnlySynthesisModelField(*args, **kwargs)[source]
A generic field that can be used against any serializer
- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
Validate a simple representation and return the internal value.
The provided data may be empty if no representation was included in the input.
May raise SkipField if the field should not be included in the validated data.
- run_validators(value)
Test the given value against all the validators on the field, and either raise a ValidationError or simply return.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.RelatedSamplingFeatureSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.RelatedSamplingFeature- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_url(obj)[source]
Get the url based on the current context :type obj: :param obj:
MeasurementTimeseriesTVPObservationobject instance :return: An URL to the current object instance
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- handle_fields(request=None)
Restrict the fields by those in the request :type request: :param request: :return:
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.RepresentativeCoordinateSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.RepresentativeCoordinate- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- handle_fields(request=None)
Restrict the fields by those in the request :type request: :param request: :return:
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.ResultListTVPSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.ResultsListTVP- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_validators()
Returns a list of validator callables.
- get_value(obj)[source]
Get the value (i.e., the timeseries data) :type obj: :param obj:
MeasurementTimeseriesTVPObservationobject instance :return:
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.SamplingFeatureSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.SamplingFeature- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_url(obj)
Get the Site url based on the current context :type obj: :param obj: an object instance :return: An URL to the current object instance
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- handle_fields(request=None)
Restrict the fields by those in the request :type request: :param request: :return:
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.SpatialSamplingFeatureSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.SpatialSamplingFeature- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_url(obj)
Get the Site url based on the current context :type obj: :param obj: an object instance :return: An URL to the current object instance
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- handle_fields(request=None)
Restrict the fields by those in the request :type request: :param request: :return:
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.TimestampField(*args, **kwargs)[source]
Extends
rest_framework.serializers.DateTimeFieldto handle numeric epoch times.- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- datetime_parser()
string, format -> new datetime parsed from a string (like time.strptime()).
- default_empty_html
alias of
empty
- enforce_timezone(value)
When self.default_timezone is None, always return naive datetimes. When self.default_timezone is not None, always return aware datetimes.
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
Validate a simple representation and return the internal value.
The provided data may be empty if no representation was included in the input.
May raise SkipField if the field should not be included in the validated data.
- run_validators(value)
Test the given value against all the validators on the field, and either raise a ValidationError or simply return.
- to_internal_value(value)
Transform the incoming primitive data into a native value.
- to_representation(value)[source]
If specified value is an epoch time, convert it first.
- Parameters:
value –
- Returns:
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- class django_basin3d.synthesis.serializers.VerticalCoordinateSerializer(*args, **kwargs)[source]
Serializes a
basin3d.core.models.VerticalCoordinateand its child classes- bind(field_name, parent)
Initializes the field name and parent for the field instance. Called when a field is added to the parent serializer instance.
- property context
Returns the context as passed to the root serializer on initialization.
- default_empty_html
alias of
empty
- fail(key, **kwargs)
A helper method that simply raises a validation error.
- fields
A dictionary of {field_name: field_instance}.
- get_attribute(instance)
Given the outgoing object instance, return the primitive value that should be used for this field.
- get_default()
Return the default value to use when validating data if no input is provided for this field.
If a default has not been set for this field then this will simply raise SkipField, indicating that no value should be set in the validated data for this field.
- get_fields()
Returns a dictionary of {field_name: field_instance}.
- get_initial()
Return a value to use when the field is being returned as a primitive value, without any object instance.
- get_validators()
Returns a list of validator callables.
- get_value(dictionary)
Given the incoming primitive data, return the value for this field that should be validated and transformed to a native value.
- classmethod many_init(*args, **kwargs)
This method implements the creation of a ListSerializer parent class when many=True is used. You can customize it if you need to control which keyword arguments are passed to the parent, and which are passed to the child.
Note that we’re over-cautious in passing most arguments to both parent and child classes in order to try to cover the general case. If you’re overriding this method you’ll probably want something much simpler, eg:
@classmethod def many_init(cls, *args, **kwargs):
- property root
Returns the top-level serializer for this field.
- run_validation(data=<class 'rest_framework.fields.empty'>)
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- run_validators(value)
Add read_only fields with defaults to value before running validators.
- set_value(dictionary, keys, value)
Similar to Python’s built in dictionary[key] = value, but takes a list of nested keys instead of a single key.
set_value({‘a’: 1}, [], {‘b’: 2}) -> {‘a’: 1, ‘b’: 2} set_value({‘a’: 1}, [‘x’], 2) -> {‘a’: 1, ‘x’: 2} set_value({‘a’: 1}, [‘x’, ‘y’], 2) -> {‘a’: 1, ‘x’: {‘y’: 2}}
- to_internal_value(data)
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)
Object instance -> Dict of primitive datatypes.
- validate_empty_values(data)
Validate empty values, and either:
Raise ValidationError, indicating invalid data.
Raise SkipField, indicating that the field should be ignored.
Return (True, data), indicating an empty value that should be returned without any further validation being applied.
Return (False, data), indicating a non-empty value, that should have validation applied as normal.
- synopsis:
The BASIN-3D Models
- module author:
Val Hendrix <vhendrix@lbl.gov>
- module author:
Danielle Svehla Christianson <dschristianson@lbl.gov>
- class basin3d.core.models.AbsoluteCoordinate(**kwargs)[source]
Absolute coordinate describes the geo-referenced location of a feature. Coordinates match the feature’s shape. For example, a curve is a list of points. Currently collections of discrete points describing a feature are supported.
- property horizontal_position: List[GeographicCoordinate]
list of obj
GeographicCoordinate
- property vertical_extent: List[AltitudeCoordinate]
list of obj
AltitudeCoordinate
- class basin3d.core.models.AltitudeCoordinate(**kwargs)[source]
An altitudinal vertical position (i.e., distance from sea level). The reference frame or system is specified. The term “altitude” is used instead of the common term “elevation” to conform to the terminology in Federal Information Processing Standards 70-1 and 173.
- DATUM_NAVD88 = 'NAVD88'
North American Vertical Datum of 1988
- DATUM_NGVD29 = 'NGVD29'
National Geodetic Vertical Datum of 1929
- DISTANCE_UNITS_FEET = 'feet'
Distance in feet
- DISTANCE_UNITS_METERS = 'meters'
Distance in meters
- ENCODING_ATTRIBUTE = 'ATTRIBUTE'
Attribute values
- ENCODING_EXPLICIT = 'EXPLICIT'
Explicit coordinate included with horizontal coordinates
- ENCODING_IMPLICIT = 'IMPLICIT'
Implicit coordinate
- TYPE_ALTITUDE = 'ALTITUDE'
The distance above or below sea level (elevation)
- TYPE_DEPTH = 'DEPTH'
The distance above (height) or below (depth) of the local surface
- property distance_units: str
The unit of distance. It uses constants prefixed with DISTANCE_UNITS_ from
VerticalCoordinate
- property encoding_method: str
The method for encoding the units of distance. Use constants prefixed with ENCODING_ from
VerticalCoordinate
- property resolution: float
The minimum distance possible between two adjacent depth values, expressed in Distance Units used for Depth
- property type: str
The type of veritical position
VerticalCoordinate.TYPE_ALTITUDEorVerticalCoordinate.TYPE_DEPTH
- class basin3d.core.models.AttributeMapping(attr_type, basin3d_vocab, basin3d_desc, datasource_vocab, datasource_desc, datasource=DataSource(id='', name='', id_prefix='', location='', credentials={}))[source]
A data class for attribute mappings between datasource vocabularies and BASIN-3D vocabularies. These are the associations defined in the datasource (i.e., plugin) mapping file.
- Fields:
attr_type: Attribute Type; e.g., STATISTIC, RESULT_QUALITY, OBSERVED_PROPERTY; separate compound mappings with ‘:’
basin3d_vocab: The BASIN-3D vocabulary; separate compound mappings with ‘:’
basin3d_desc: The BASIN-3D vocabulary descriptions; objects or enum
datasource_vocab: The datasource vocabulary
datasource_desc: The datasource vocabulary description
datasource: The datasource of the mapping
- class basin3d.core.models.Base(plugin_access, **kwargs)[source]
Base synthesis model class. All classes that extend this are immutable.
- class basin3d.core.models.Coordinate(**kwargs)[source]
Top level coordinate class that holds
AbsoluteCoordinateorRepresentativeCoordinate- property absolute: AbsoluteCoordinate
Absolute coordinate
- property representative: RepresentativeCoordinate
Representative coordinate
- class basin3d.core.models.DataSource(id='', name='', id_prefix='', location='', credentials=<factory>)[source]
Data Source definition
- Fields:
id: string (inherited)
name: string
id_prefix: string, prefix that is added to all data source ids
location:
credentials:
- class basin3d.core.models.DepthCoordinate(**kwargs)[source]
A depth vertical position (i.e., the height or depth from the specified reference position) The reference frame or system is specified.
- DATUM_LOCAL_SURFACE = 'LS'
Local surface
- DATUM_MEAN_SEA_LEVEL = 'MSL'
Mean sea level
- DISTANCE_UNITS_FEET = 'feet'
Distance in feet
- DISTANCE_UNITS_METERS = 'meters'
Distance in meters
- ENCODING_ATTRIBUTE = 'ATTRIBUTE'
Attribute values
- ENCODING_EXPLICIT = 'EXPLICIT'
Explicit coordinate included with horizontal coordinates
- ENCODING_IMPLICIT = 'IMPLICIT'
Implicit coordinate
- TYPE_ALTITUDE = 'ALTITUDE'
The distance above or below sea level (elevation)
- TYPE_DEPTH = 'DEPTH'
The distance above (height) or below (depth) of the local surface
- property distance_units: str
The unit of distance. It uses constants prefixed with DISTANCE_UNITS_ from
VerticalCoordinate
- property encoding_method: str
The method for encoding the units of distance. Use constants prefixed with ENCODING_ from
VerticalCoordinate
- property resolution: float
The minimum distance possible between two adjacent depth values, expressed in Distance Units used for Depth
- property type: str
The type of veritical position
VerticalCoordinate.TYPE_ALTITUDEorVerticalCoordinate.TYPE_DEPTH
- class basin3d.core.models.Feature(plugin_access, **kwargs)[source]
A general feature upon which an observation can be made. Loosely after GF_Feature (ISO).
- property feature_type: str
The feature type. For a list of feature types see
basin3d.schema.enum.FeatureTypeEnum.
- property observed_properties: List[MappedAttribute] | List[str]
List of observed properties
- class basin3d.core.models.GeographicCoordinate(**kwargs)[source]
The latitude and longitude which define the position of a point on the Earth’s surface with respect to a reference spheroid. (https://www.fgdc.gov/csdgmgraphical/spref.htm)
- DATUM_NAD27 = 'NAD27'
North American Datum 1927 (NAD27)
- DATUM_NAD83 = 'NAD83'
North American Datum of 1983 (NAD 83)
- DATUM_WGS84 = 'WGS84'
World Geodetic System 1984 (WGS84)
- TYPE_GEOGRAPHIC = 'GEOGRAPHIC'
The quantities of latitude and longitude which define the position of a point on the Earth’s surface with respect to a reference spheroid.
- TYPE_LOCAL = 'LOCAL'
A description of any coordinate system that is not aligned with the surface of the Earth.
- TYPE_PLANAR_GRID = 'PLANAR_GRID'
T plane-rectangular coordinate system usually based on, and mathematically adjusted to, a map projection so that geographic positions can be readily transformed to and from plane coordinates.
- TYPE_PLANAR_LOCAL = 'PLANAR_LOCAL'
Any right-handed planar coordinate system of which the z-axis coincides with a plumb line through the origin that locally is aligned with the surface of the Earth.
- TYPE_PLANAR_MAP_PROJECTION = 'PLANAR_MAP_PROJECTION'
The systematic representation of all or part of the surface of the Earth on a plane or developable surface.
- UNITS_DEC_DEGREES = 'DD'
Decimal degrees
- UNITS_DEC_MINUTES = 'DM'
Decimal minutes
- UNITS_DEC_SECONDS = 'DS'
Decimal seconds
- UNITS_DEGREES_DEC_MINUTES = 'DDM'
Degrees and decimal minutes
- UNITS_DEGREES_MIN_DEC_SECS = 'DMDS'
Degrees, minutes, and decimal second
- UNITS_GRADS = 'Grads'
Grads
- UNITS_RADIANS = 'Radians'
Radians
- property type: str
The type of horizontal coordinates. Use constants prefixed with TYPE_ from
HorizontalCoordinate
- class basin3d.core.models.HorizontalCoordinate(**kwargs)[source]
Generic XY coordinates for a point on earth (https://www.fgdc.gov/csdgmgraphical/spref.htm)
- DATUM_NAD27 = 'NAD27'
North American Datum 1927 (NAD27)
- DATUM_NAD83 = 'NAD83'
North American Datum of 1983 (NAD 83)
- DATUM_WGS84 = 'WGS84'
World Geodetic System 1984 (WGS84)
- TYPE_GEOGRAPHIC = 'GEOGRAPHIC'
The quantities of latitude and longitude which define the position of a point on the Earth’s surface with respect to a reference spheroid.
- TYPE_LOCAL = 'LOCAL'
A description of any coordinate system that is not aligned with the surface of the Earth.
- TYPE_PLANAR_GRID = 'PLANAR_GRID'
T plane-rectangular coordinate system usually based on, and mathematically adjusted to, a map projection so that geographic positions can be readily transformed to and from plane coordinates.
- TYPE_PLANAR_LOCAL = 'PLANAR_LOCAL'
Any right-handed planar coordinate system of which the z-axis coincides with a plumb line through the origin that locally is aligned with the surface of the Earth.
- TYPE_PLANAR_MAP_PROJECTION = 'PLANAR_MAP_PROJECTION'
The systematic representation of all or part of the surface of the Earth on a plane or developable surface.
- property type: str
The type of horizontal coordinates. Use constants prefixed with TYPE_ from
HorizontalCoordinate
- class basin3d.core.models.MappedAttribute(attr_type, attr_mapping)[source]
A data class for an attribute that is translated (i.e., mapped) from a datasource vocabulary to BASIN-3D vocabulary. Note that this model holds an AttributeMapping that maybe compound in nature; however this class specifies only one attribute types. For example, if the AttributeMapping is for a compound mapping of attribute types OBSERVED_PROPERTY:SAMPLING_MEDIUM, then the attr_type field would be either OBSERVED_PROPERTY or SAMPLING_MEDIUM but not both.
- Fields:
attr_type: Attribute Type; e.g., STATISTIC, RESULT_QUALITY, OBSERVED_PROPERTY, etc; single type only
attr_mapping: AttributeMapping as described in the datasource’s (i.e., plugin’s mapping file).
- class basin3d.core.models.MeasurementMetadataMixin(*args, **kwargs)[source]
Metadata attributes for Observations type Measurement
- property sampling_medium: MappedAttribute
Sampling medium in which the observed property was measured
- property statistic: MappedAttribute
The statistical property of the observation result. Use constants prefixed with STATISTIC_ from
MeasurementMetadataMixin
- class basin3d.core.models.MeasurementResultMixin(**kwargs)[source]
Result Mixin: Measurement
- property result: ResultPointFloat
Result
- class basin3d.core.models.MeasurementTimeseriesTVPObservation(plugin_access, **kwargs)[source]
Series of measurement (numerical) observations in TVP format grouped by time (i.e., a timeseries). Anything specified at the group level automatically applies to the individual observation.
- TIME_REFERENCE_END = 'END'
Observation taken at the end
- TIME_REFERENCE_MIDDLE = 'MIDDLE'
Observation taken in the middle
- TIME_REFERENCE_START = 'START'
Observation taken at the start
- TYPE_MEASUREMENT = 'MEASUREMENT'
A measurement
- TYPE_MEASUREMENT_TVP_TIMESERIES = 'MEASUREMENT_TVP_TIMESERIES'
Measurement Time Value Pair Timeseries
- property aggregation_duration: MappedAttribute
Time period represented by the observation. Follows OGC TM_PeriodDuration. Use constants prefixed with AGGREGATION_DURATION from
TimeseriesMetadataMixin
- property feature_of_interest: MonitoringFeature
The feature on which the observed property was observed
- property feature_of_interest_type: FeatureTypeEnum
The type of feature that was observed. See
basin3d.models.FeatureTypeEnum
- property observed_property: MappedAttribute
The property that was observed
- property phenomenon_time: str
datetime of the observation (required OGC attribute timePhenomenon). For timeseries, start and end datetimes can be provided.
- property result: ResultListTVP
A list of results
- property result_quality: List[MappedAttribute]
The result quality assessment. See
ResultQuality
- property sampling_medium: MappedAttribute
Sampling medium in which the observed property was measured
- property statistic: MappedAttribute
The statistical property of the observation result. Use constants prefixed with STATISTIC_ from
MeasurementMetadataMixin
- class basin3d.core.models.MeasurementTimeseriesTVPResultMixin(*args, **kwargs)[source]
Result Mixin: Measurement Timeseries TimeValuePair
- property result: ResultListTVP
A list of results
- class basin3d.core.models.MonitoringFeature(plugin_access, **kwargs)[source]
A feature upon which monitoring is made. OGC Timeseries Profile OM_MonitoringFeature.
- property coordinates: Coordinate
Description of feature location. An instance of
Coordinate
- property feature_type: str
The feature type. For a list of feature types see
basin3d.schema.enum.FeatureTypeEnum.
- property observed_properties: List[MappedAttribute] | List[str]
List of observed properties
list of Person, people or organizations responsible for Feature. To be extended in future to full OGC Responsible_Party
List of related sampling features obj
RelatedSamplingFeature
- class basin3d.core.models.Observation(plugin_access, **kwargs)[source]
- OGC OM_Observation feature type. This is a parent class to which Mixins
should be added to create observation types with metadata and result.
- TYPE_MEASUREMENT = 'MEASUREMENT'
A measurement
- TYPE_MEASUREMENT_TVP_TIMESERIES = 'MEASUREMENT_TVP_TIMESERIES'
Measurement Time Value Pair Timeseries
- property feature_of_interest: MonitoringFeature
The feature on which the observed property was observed
- property feature_of_interest_type: FeatureTypeEnum
The type of feature that was observed. See
basin3d.models.FeatureTypeEnum
- property observed_property: MappedAttribute
The property that was observed
- property phenomenon_time: str
datetime of the observation (required OGC attribute timePhenomenon). For timeseries, start and end datetimes can be provided.
- property result_quality: List[MappedAttribute]
The result quality assessment. See
ResultQuality
- class basin3d.core.models.ObservedProperty(basin3d_vocab='', full_name='', categories=<factory>, units='')[source]
Defining the properties being observed (measured). See http://vocabulary.odm2.org/variablename/ for controlled vocabulary
- Fields:
basin3d_vocab: string,
full_name: string,
categories: List of strings (in order of priority).
units: string
See http://vocabulary.odm2.org/variabletype/ for options, although I think we should have our own list (theirs is a bit funky).
- class basin3d.core.models.RelatedSamplingFeature(plugin_access, **kwargs)[source]
Class that represents a related sampling feature and its role relative to the sampling feature to which it is related. Spatial hierarchies of features are built by specifying related sampling features.
Data model from OGC Observations and Measurements.
- ROLE_PARENT = 'PARENT'
Sampling Feature is a parent
A sampling feature relation
Feature type of the related sampling feature. See
FeatureTypeEnumfor a list of types
- class basin3d.core.models.RepresentativeCoordinate(**kwargs)[source]
Representative coordinates describe the location of a feature by a representative shape / location. For example, a study area may be represented by the center point. The veritical position from a reference position (e.g., height, depth) is also described in this class. Currently representative points are supported. The class is extendable to other forms of representing (e.g., diameter, area, side_length) Representative point types are also expandable as use cases require.
- REPRESENTATIVE_POINT_TYPE_CENTER_LOCAL_SURFACE = 'CENTER LOCAL SURFACE'
Placement of the representative point is the center of a local surface
- REPRESENTATIVE_POINT_TYPE_LOWER_LEFT_CORNER = 'LOWER LEFT CORNER'
Placement of the representative point is the lower left corner (southhwest)
- REPRESENTATIVE_POINT_TYPE_LOWER_RIGHT_CORNER = 'LOWER RIGHT CORNER'
Placement of the representative point is the lower right corner (northeast)
- REPRESENTATIVE_POINT_TYPE_UPPER_LEFT_CORNER = 'UPPER LEFT CORNER'
Placement of the representative point is the upper left corner (northwest)
- REPRESENTATIVE_POINT_TYPE_UPPER_RIGHT_CORNER = 'UPPER RIGHT CORNER'
Placement of the representative point is the upper right corner (northeast)
- property representative_point: AbsoluteCoordinate
A point representation of the feature. obj
AbsoluteCoordinatefor POINT
- property representative_point_type: str
The type of representative point relative to the feature’s geometry Currently the point is assumed to be located at the local surface (CV). Use constants prefixed with REPRESENTATIVE_POINT_TYPE_
- property vertical_position: DepthCoordinate
The vertical position of the feature from a reference position (e.g., height or depth). obj
DepthCoordinate
- class basin3d.core.models.ResultListTVP(plugin_access, **kwargs)[source]
Result Point Float
- property result_quality: List[MappedAttribute]
Result that was measured
- property value: List[TimeValuePair]
Result that was measured
- class basin3d.core.models.ResultPointFloat(plugin_access, **kwargs)[source]
Result Point Float
- property result_quality: MappedAttribute
Result that was measured
- class basin3d.core.models.SamplingFeature(plugin_access, **kwargs)[source]
A feature where sampling is conducted. OGC Observation & Measurements SF_SamplingFeature.
- property feature_type: str
The feature type. For a list of feature types see
basin3d.schema.enum.FeatureTypeEnum.
- property observed_properties: List[MappedAttribute] | List[str]
List of observed properties
List of related sampling features obj
RelatedSamplingFeature
- class basin3d.core.models.SpatialSamplingFeature(plugin_access, **kwargs)[source]
A spatially-defined feature where sampling is conducted. OGC Observation & Measurements SF_SpatialSamplingFeature.
- property coordinates: Coordinate
Description of feature location. An instance of
Coordinate
- property feature_type: str
The feature type. For a list of feature types see
basin3d.schema.enum.FeatureTypeEnum.
- property observed_properties: List[MappedAttribute] | List[str]
List of observed properties
List of related sampling features obj
RelatedSamplingFeature
- class basin3d.core.models.TimeMetadataMixin(*args, **kwargs)[source]
Metadata attributes for Observations with a time
- TIME_REFERENCE_END = 'END'
Observation taken at the end
- TIME_REFERENCE_MIDDLE = 'MIDDLE'
Observation taken in the middle
- TIME_REFERENCE_START = 'START'
Observation taken at the start
- property aggregation_duration: MappedAttribute
Time period represented by the observation. Follows OGC TM_PeriodDuration. Use constants prefixed with AGGREGATION_DURATION from
TimeseriesMetadataMixin
- class basin3d.core.models.TimeValuePair(timestamp, value)[source]
Tuple that represents a time value pair. This will handle timestamp conversion
(timestamp, value)
- count(value, /)
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- timestamp
Alias for field number 0
- value
Alias for field number 1
- class basin3d.core.models.VerticalCoordinate(**kwargs)[source]
The vertical position of the feature (altitudes or depths). The reference frame or system is specified.
- DISTANCE_UNITS_FEET = 'feet'
Distance in feet
- DISTANCE_UNITS_METERS = 'meters'
Distance in meters
- ENCODING_ATTRIBUTE = 'ATTRIBUTE'
Attribute values
- ENCODING_EXPLICIT = 'EXPLICIT'
Explicit coordinate included with horizontal coordinates
- ENCODING_IMPLICIT = 'IMPLICIT'
Implicit coordinate
- TYPE_ALTITUDE = 'ALTITUDE'
The distance above or below sea level (elevation)
- TYPE_DEPTH = 'DEPTH'
The distance above (height) or below (depth) of the local surface
- property distance_units: str
The unit of distance. It uses constants prefixed with DISTANCE_UNITS_ from
VerticalCoordinate
- property encoding_method: str
The method for encoding the units of distance. Use constants prefixed with ENCODING_ from
VerticalCoordinate
- property resolution: float
The minimum distance possible between two adjacent depth values, expressed in Distance Units used for Depth
- property type: str
The type of veritical position
VerticalCoordinate.TYPE_ALTITUDEorVerticalCoordinate.TYPE_DEPTH
- platform:
Unix, Mac
- synopsis:
BASIN-3D
DataSourcetype classes- module author:
Val Hendrix <vhendrix@lbl.gov>
- module author:
Danielle Svehla Christianson <dschristianson@lbl.gov>
- class basin3d.core.types.SpatialSamplingShapes[source]
Spatial sampling shape describing a spatial sampling feature
Controlled CV list as defined by OGC Observation & Measurement GM_Shape.
- SHAPE_CURVE = 'CURVE'
The shape of a spatially extensive sampling feature which provides a complete sampling domain.
- SHAPE_POINT = 'POINT'
The shape of a spatially extensive sampling feature which provides a complete sampling domain.
- SHAPE_SOLID = 'SOLID'
The shape of a spatially extensive sampling feature which provides a complete sampling domain.
- SHAPE_SURFACE = 'SURFACE'
The shape of a spatially extensive sampling feature which provides a complete sampling domain.