nsidc.metgen.metgen

Implements all core functionality of the MetGenC utility: logging, metadata generation, CNM message creation, as well as staging the metadata and posting the notification message.

Functions

ancillary_files(dir, suffixes)

apply_schema(schema, json_file, dummy_json)

Apply JSON schema to generated JSON content.

associate_collection(granule, collection)

Associate pre-fetched collection information with the Granule.

banner()

Displays the name of this utility using incredible ASCII-art.

build_trace_message()

Build a trace message with MetGenC version.

checksum(file)

cnms_body_template()

cnms_file_json_parts(staging_bucket_name, ...)

cnms_files_template()

create_cnm(configuration, granule)

Create a CNM submission message for the Granule.

create_ummg(configuration, granule)

Create the UMM-G file for the Granule.

derived_granule_name(granule_regex, ...)

derived_ummg_filename(ummg_path, granule_id)

end_ledger(ledger)

Finalize the Ledger of operations on its Granule.

file_type_path(configuration, content_type)

Return directory containing JSON files to be validated.

find_existing_ummg(configuration, granule)

granule_keys(configuration, file_list)

granule_keys_from_filename(browse_regex, ...)

Identify granules based on unique data file basenames (minus file name extension) in lieu of a "granuleid" regex match group.

granule_keys_from_regex(granule_regex, file_list)

Identify granules based on a "granuleid" regex match group

granule_tuple(granule_key, granule_regex, ...)

Important! granule_regex argument must include a captured match group.

grouped_granule_files(configuration)

Identify file(s) related to each granule.

init_config(configuration_file)

Prompts the user for configuration values and then creates a valid configuration file.

init_logging([configuration])

Initialize the logger for metgenc.

initialize_template(resource_location)

log_ledger(ledger)

Log a Ledger of the operations performed on a Granule.

matched_ancillary_file(granule_key, file_list)

null_operation(_, granule)

populate_additional_attributes(...)

Return a string representation of any additional attributes or platform information found in a premet file.

populate_bounding_rectangle(spatial_values)

Return a string representation of a bounding rectangle

populate_point_or_polygon(spatial_values)

Return a string representation of a point or polygon, based on the length of the spatial_values list.

populate_spatial(spatial_representation, ...)

Return a string representation of a geometry (point, bounding box, gpolygon)

populate_temporal(datetime_values)

Return a string representation of a temporal range or single value, as appropriate.

prepare_granule(_, granule)

Prepare the Granule for creating metadata and submitting it.

previous_failure(last_action)

Determine whether errors were raised during pipeline steps thus far.

process(configuration)

Process all Granules and record the results and summary.

publish_cnm(configuration, granule)

Publish a CNM message to a Kinesis stream.

recorder(fn, ledger)

Higher-order function that, given a granule operation function and a Ledger, will execute the function on the Ledger's granule, record the results, and return the resulting new Ledger.

reference_data_file(regex, data_files)

Identify the file to use as the "reference" file for purposes of extracting granule metadata, in the case of a multi-science-file granule.

s3_object_path(granule, filename)

Returns the full s3 object path for the granule

s3_url(staging_bucket_name, granule, filename)

Returns the full s3 URL for the given file name.

schema_file_path(content_type)

Identify the schema to be used for validation

stage_files(configuration, granule)

Stage a set of files for the Granule in S3.

start_ledger(granule)

Start a new Ledger of the operations on the given Granule.

summarize_results(ledgers)

Log a summary of the operations performed on all Granules.

ummg_additional_attributes_template()

ummg_body_template()

ummg_spatial_gpolygon_template()

ummg_spatial_point_template()

ummg_spatial_rectangle_template()

ummg_temporal_range_template()

ummg_temporal_single_template()

validate(configuration, content_type)

Validate local CNM or UMM-G (JSON) files

validate_collection(configuration, granule)

Confirm collection metadata meet requirements for our granule metadata generation.

validate_collection_spatial(configuration, ...)

Ensure granule spatial representation exists, and verify the collection geometry can be used if a collection geometry override is requested.

validate_collection_temporal(configuration, ...)

Verify collection temporal extent information is usable if a collection temporal override is requested.

write_cnm(configuration, granule)

Write a CNM message to a file.

Classes

Action(name, successful, message, ...)

An audit of a single action performed on a Granule

Granule(producer_granule_id, collection, ...)

Granule to ingest

Ledger(granule, actions, successful, ...)

An audit of the Actions performed on a Granule