Collection Resource
- pydantic model geometamaker.models.CollectionResource[source]
Class for metadata for a collection resource.
In the spatial properties of a collection, the bounding box is the union of the bounding boxes of all the items in the collection. If all items share the same CRS, the collection’s bounding box will match that CRS. If items use a different CRS from each other, bounding boxes are transformed to WGS84 before unioning.
Show JSON schema
{ "title": "CollectionResource", "description": "Class for metadata for a collection resource.\n\nIn the spatial properties of a collection, the bounding box is the\nunion of the bounding boxes of all the items in the collection.\nIf all items share the same CRS, the collection's bounding box\nwill match that CRS. If items use a different CRS from each other,\nbounding boxes are transformed to WGS84 before unioning.", "type": "object", "properties": { "contact": { "$ref": "#/$defs/ContactSchema", "description": "Contact information for the data author." }, "license": { "$ref": "#/$defs/LicenseSchema", "description": "Data license information." }, "metadata_path": { "default": "", "title": "Metadata Path", "type": "string" }, "geometamaker_version": { "default": "", "description": "The version of geometamaker used to create this metadata resource.", "title": "Geometamaker Version", "type": "string" }, "bytes": { "default": 0, "description": "File size of the resource in bytes.", "title": "Bytes", "type": "integer" }, "format": { "default": "", "description": "File format of the resource.", "title": "Format", "type": "string" }, "uid": { "default": "", "description": "Unique identifier for the resource.", "title": "Uid", "type": "string" }, "path": { "default": "", "description": "Path to the resource being described.", "title": "Path", "type": "string" }, "scheme": { "default": "", "description": "File protocol for opening the resource.", "title": "Scheme", "type": "string" }, "type": { "default": "", "description": "The type of resource being described.", "title": "Type", "type": "string" }, "last_modified": { "default": "", "description": "Last modified time of the file at ``path``.", "title": "Last Modified", "type": "string" }, "citation": { "default": "", "description": "A citation for the resource.", "title": "Citation", "type": "string" }, "description": { "default": "", "description": "A text description of the resource.", "title": "Description", "type": "string" }, "doi": { "default": "", "description": "A digital object identifier for the resource.", "title": "Doi", "type": "string" }, "edition": { "default": "", "description": "A string representing the edition, or version, of the resource.", "title": "Edition", "type": "string" }, "keywords": { "description": "A list of keywords that describe the subject-matter of the resource.", "items": { "type": "string" }, "title": "Keywords", "type": "array" }, "lineage": { "default": "", "description": "A text description of how the resource was created.", "title": "Lineage", "type": "string" }, "placenames": { "description": "A list of geographic places associated with the resource.", "items": { "type": "string" }, "title": "Placenames", "type": "array" }, "purpose": { "default": "", "description": "The author's stated purpose for the resource.", "title": "Purpose", "type": "string" }, "title": { "default": "", "description": "The title of the resource.", "title": "Title", "type": "string" }, "url": { "default": "", "description": "A URL where the resource is available.", "title": "Url", "type": "string" }, "spatial": { "anyOf": [ { "$ref": "#/$defs/SpatialSchema" }, { "type": "null" } ], "default": null, "description": "An object for describing spatial properties of the resource." }, "items": { "description": "Files in collection.", "items": { "$ref": "#/$defs/CollectionItemSchema" }, "title": "Items", "type": "array" } }, "$defs": { "BoundingBox": { "description": "Class for a spatial bounding box.", "properties": { "xmin": { "title": "Xmin", "type": "number" }, "ymin": { "title": "Ymin", "type": "number" }, "xmax": { "title": "Xmax", "type": "number" }, "ymax": { "title": "Ymax", "type": "number" } }, "required": [ "xmin", "ymin", "xmax", "ymax" ], "title": "BoundingBox", "type": "object" }, "CollectionItemSchema": { "additionalProperties": false, "description": "Class for metadata for collection items.", "properties": { "path": { "default": "", "description": "Path to the resource being described.", "title": "Path", "type": "string" }, "description": { "default": "", "description": "A text description of the resource.", "title": "Description", "type": "string" }, "metadata": { "default": "", "description": "Path to metadata document describing resource", "title": "Metadata", "type": "string" } }, "title": "CollectionItemSchema", "type": "object" }, "ContactSchema": { "additionalProperties": false, "description": "Class for storing contact information of data author.", "properties": { "email": { "default": "", "title": "Email", "type": "string" }, "organization": { "default": "", "title": "Organization", "type": "string" }, "individual_name": { "default": "", "title": "Individual Name", "type": "string" }, "position_name": { "default": "", "title": "Position Name", "type": "string" } }, "title": "ContactSchema", "type": "object" }, "LicenseSchema": { "additionalProperties": false, "description": "Class for storing data license information.", "properties": { "path": { "default": "", "description": "URL that describes the license.", "title": "Path", "type": "string" }, "title": { "default": "", "description": "Name of a license, such as one from http://licenses.opendefinition.org/", "title": "Title", "type": "string" } }, "title": "LicenseSchema", "type": "object" }, "SpatialSchema": { "additionalProperties": false, "description": "Class for keeping track of spatial info.", "properties": { "bounding_box": { "$ref": "#/$defs/BoundingBox", "description": "Spatial extent [xmin, ymin, xmax, ymax]." }, "crs": { "description": "Coordinate Reference System.", "title": "Crs", "type": "string" }, "crs_units": { "description": "Units of measure for coordinates in the CRS.", "title": "Crs Units", "type": "string" } }, "required": [ "bounding_box", "crs", "crs_units" ], "title": "SpatialSchema", "type": "object" } }, "additionalProperties": false }
- field bytes: int = 0
File size of the resource in bytes.
- field citation: str = ''
A citation for the resource.
- field contact: ContactSchema [Optional]
Contact information for the data author.
- field description: str = ''
A text description of the resource.
- field doi: str = ''
A digital object identifier for the resource.
- field edition: str = ''
A string representing the edition, or version, of the resource.
- field format: str = ''
File format of the resource.
- field geometamaker_version: str = ''
The version of geometamaker used to create this metadata resource.
- field items: list[CollectionItemSchema] [Optional]
Files in collection.
- field keywords: list[str] [Optional]
A list of keywords that describe the subject-matter of the resource.
- field last_modified: str = ''
Last modified time of the file at
path.
- field license: LicenseSchema [Optional]
Data license information.
- field lineage: str = ''
A text description of how the resource was created.
- field metadata_path: str = ''
- field path: str = ''
Path to the resource being described.
- field placenames: list[str] [Optional]
A list of geographic places associated with the resource.
- field purpose: str = ''
The author’s stated purpose for the resource.
- field scheme: str = ''
File protocol for opening the resource.
- field spatial: SpatialSchema | None = None
An object for describing spatial properties of the resource.
- field title: str = ''
The title of the resource.
- field type: str = ''
The type of resource being described.
- field uid: str = ''
Unique identifier for the resource.
- field url: str = ''
A URL where the resource is available.
- classmethod load(filepath)
Load metadata document from a yaml file.
- Parameters:
filepath (str) – path to yaml file
- Returns:
instance of the class
- Raises:
FileNotFoundError if filepath does not exist –
ValueError if the metadata is found to be incompatible with – geometamaker.
- get_citation()
Get the citation for the dataset.
- get_contact()
Get metadata from a contact section.
- Returns:
ContactSchema
- get_description()
Get the description for the dataset.
- get_doi()
Get the doi for the dataset.
- get_edition()
Get the edition of the dataset.
- Returns:
str or
Noneifeditiondoes not exist.
- get_keywords()
Get the keywords describing the dataset.
- Returns:
list
- get_license()
Get
licensefor the dataset.- Returns:
models.LicenseSchema
- get_lineage()
Get the lineage statement of the dataset.
- Returns:
str
- get_placenames()
Get the placenames describing the dataset.
- Returns:
list
- get_purpose()
Get
purposefor the dataset.- Returns:
str
- get_title()
Get the title for the dataset.
- get_url()
Get the url for the dataset.
- replace(other)
Replace attribute values with those from another instance.
Only attributes that exist in
selfwill exist in the returned instance. Only attribute values that are not empty inotherwill be used to replace values inself.- Parameters:
other (BaseMetadata)
- Returns:
an instance of same type as
self- Raises:
TypeError if other is not an instance of BaseMetadata. –
- set_citation(citation)
Add a citation string for the dataset.
- Parameters:
citation (str)
- set_contact(organization=None, individual_name=None, position_name=None, email=None)
Add a contact section.
- Parameters:
organization (str) – name of the responsible organization
individual_name (str) – name of the responsible person
position_name (str) – role or position of the responsible person
email (str) – address of the responsible organization or individual
- set_description(description)
Add a description for the dataset.
- Parameters:
description (str)
- set_doi(doi)
Add a doi string for the dataset.
- Parameters:
doi (str)
- set_edition(edition)
Set the edition for the dataset.
- Parameters:
edition (str) – version of the cited resource
- set_keywords(keywords)
Describe a dataset with a list of keywords.
- Parameters:
keywords (list) – sequence of strings
- set_license(title=None, path=None)
Add a license for the dataset.
Either or both title and path are required if there is a license. Call with no arguments to remove license info.
- Parameters:
title (str) – human-readable title of the license
path (str) – url for the license
- set_lineage(statement)
Set the lineage statement for the dataset.
- Parameters:
statement (str) – general explanation describing the lineage or provenance of the dataset
- set_placenames(placenames)
Describe the geography of a dataset with a list of placenames.
- Parameters:
places (list) – sequence of strings
- set_purpose(purpose)
Add a purpose for the dataset.
- Parameters:
purpose (str) – description of the purpose of the source dataset
- set_spatial(spatial: SpatialSchema)[source]
Set spatial properties of a resource.
- set_title(title)
Add a title for the dataset.
- Parameters:
title (str)
- set_url(url)
Add a url for the dataset.
- Parameters:
url (str)
- write(workspace=None, backup=True)
Write metadata yaml to disk.
This creates sidecar files with ‘.yml’ appended to the full filename of the data source. For example,
‘myraster.tif’
‘myraster.tif.yml’
For a
CollectionResource, the name of the target YML document can be specified with thetarget_filenameargument ofdescribe_collection.- Parameters:
workspace (str) – if
None, files write to the same location as the source data. If notNone, a path to a local directory to write the file. Use this option if the source data is not on the local filesystem.backup (bool) – whether to write a backup of a pre-existing metadata file before ovewriting it in cases where that file is not a valid geometamaker document.