Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up the schemas and make them compatible with a code generator #350

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ filterwarnings = [
"error::ResourceWarning",
]
asdf_schema_tests_enabled = 'true'
asdf_schema_skip_tests = 'src/rad/resources/schemas/rad_schema-1.0.0.yaml'
asdf_schema_root = 'src/rad/resources/schemas'

[tool.isort]
Expand Down
18 changes: 16 additions & 2 deletions src/rad/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
import importlib.resources as importlib_resources


class RadResourceMapping(DirectoryResourceMapping):
@property
def root(self):
return self._root

@property
def uri_prefix(self):
return self._uri_prefix

def get_file_path(self, uri):
return self._uri_to_file[uri]


def get_resource_mappings():
"""
Get the resource mapping instances for the datamodel schemas
Expand All @@ -23,6 +36,7 @@ def get_resource_mappings():
resources_root = importlib_resources.files(resources)

return [
DirectoryResourceMapping(resources_root / "schemas", "asdf://stsci.edu/datamodels/roman/schemas/", recursive=True),
DirectoryResourceMapping(resources_root / "manifests", "asdf://stsci.edu/datamodels/roman/manifests/"),
RadResourceMapping(resources_root / "schemas", "asdf://stsci.edu/datamodels/roman/schemas/", recursive=True),
RadResourceMapping(resources_root / "manifests", "asdf://stsci.edu/datamodels/roman/manifests/"),
RadResourceMapping(resources_root / "meta_schemas", "asdf://stsci.edu/datamodels/roman/meta_schemas/"),
]
88 changes: 16 additions & 72 deletions src/rad/resources/manifests/datamodels-1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@ asdf_standard_requirement:
gte: 1.1.0
tags:
# Object Modules
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/guidewindow-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/guidewindow-1.0.0
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/data_products/guidewindow-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/data_products/guidewindow-1.0.0
title: Guide window schema
description: |-
Guide window schema
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/ramp-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/ramp-1.0.0
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/data_products/ramp-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/data_products/ramp-1.0.0
title: Ramp schema
description: |-
Ramp schema
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/ramp_fit_output-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/ramp_fit_output-1.0.0
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/data_products/ramp_fit_output-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/data_products/ramp_fit_output-1.0.0
title: Ramp fit output schema
description: |-
Ramp fit output schema
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/wfi_science_raw-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/wfi_science_raw-1.0.0
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/data_products/wfi_science_raw-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/data_products/wfi_science_raw-1.0.0
title: Roman WFI Raw Science Data datamodel
description: |-
Basic Roman Raw Science
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/wfi_image-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/wfi_image-1.0.0
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/data_products/wfi_image-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/data_products/wfi_image-1.0.0
title: Wfi level 2 image information
description: |-
Wfi level 2 image information
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/wfi_mosaic-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/wfi_mosaic-1.0.0
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/data_products/wfi_mosaic-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/data_products/wfi_mosaic-1.0.0
title: Wfi level 3 mosiac information
description: |-
Wfi level 3 mosaic information
Expand Down Expand Up @@ -75,11 +75,6 @@ tags:
title: Photometry information
description: |-
Photometry information
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/source_detection-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/source_detection-1.0.0
title: Source catalog for TweakReg
description: |-
Source catalog for TweakReg
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/coordinates-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/coordinates-1.0.0
title: Coordinate frame information
Expand Down Expand Up @@ -120,11 +115,6 @@ tags:
title: Calibration Step status information
description: |-
Calibration Step status information
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/resample-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/resample-1.0.0
title: Resample information
description: |-
Resample information
# Reference Modules
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/reference_files/dark-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/reference_files/dark-1.0.0
Expand Down Expand Up @@ -197,65 +187,19 @@ tags:
description: |-
WFI imaging photometric flux conversion data model
# Misc
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/associations-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/associations-1.0.0
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/data_products/associations-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/data_products/associations-1.0.0
title: Association table
description: |-
Association table
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/cal_logs-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/cal_logs-1.0.0
title: Calibration log messages
description: |-
Calibration log message
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/ref_file-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/ref_file-1.0.0
title: Calibration reference file names.
description: |-
Calibration reference file names.
# Tagged Scalars
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/calibration_software_version-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/tagged_scalars/calibration_software_version-1.0.0
title: Calibration software version
description: |-
Calibration software version number
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/filename-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/tagged_scalars/filename-1.0.0
title: Name of the file
description: |-
Name of the file
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/file_date-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/tagged_scalars/file_date-1.0.0
title: Date this file was created (UTC)
description: |-
Date this file was created (UTC)
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/model_type-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/tagged_scalars/model_type-1.0.0
title: Type of data model
description: |-
Type of data model
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/origin-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/tagged_scalars/origin-1.0.0
title: Organization responsible for creating file
description: |-
Organization responsible for creating file
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/prd_software_version-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/tagged_scalars/prd_software_version-1.0.0
title: S&OC PRD version number used in data processing
description: |-
S&OC PRD version number used in data processing
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/sdf_software_version-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/tagged_scalars/sdf_software_version-1.0.0
title: SDF software version number
description: |-
SDF software version number
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/telescope-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/tagged_scalars/telescope-1.0.0
title: Telescope used to acquire the data
description: |-
Telescope used to acquire the data
# SSC data models
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/msos_stack-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/msos_stack-1.0.0
- tag_uri: asdf://stsci.edu/datamodels/roman/tags/data_products/msos_stack-1.0.0
schema_uri: asdf://stsci.edu/datamodels/roman/schemas/data_products/msos_stack-1.0.0
title: MSOS Stack Level 3 Schema
description: |-
Level 3 schema for SSC's MSOS stack products
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%YAML 1.1
---
$schema: http://stsci.edu/schemas/yaml-schema/draft-01
id: asdf://stsci.edu/datamodels/roman/schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/meta_schemas/rad_schema-1.0.0

title: Roman Attribute Dictionary metaschema
description: |-
Expand Down
2 changes: 1 addition & 1 deletion src/rad/resources/schemas/aperture-1.0.0.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.1
---
$schema: asdf://stsci.edu/datamodels/roman/schemas/rad_schema-1.0.0
$schema: asdf://stsci.edu/datamodels/roman/meta_schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/schemas/aperture-1.0.0

title: Aperture information
Expand Down
88 changes: 79 additions & 9 deletions src/rad/resources/schemas/basic-1.0.0.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.1
---
$schema: asdf://stsci.edu/datamodels/roman/schemas/rad_schema-1.0.0
$schema: asdf://stsci.edu/datamodels/roman/meta_schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/schemas/basic-1.0.0

title: Common metadata keywords
Expand All @@ -9,21 +9,91 @@ type: object
properties:
# Meta Variables
calibration_software_version:
tag: asdf://stsci.edu/datamodels/roman/tags/calibration_software_version-1.0.0
title: Calibration software version number
type: string
sdf:
special_processing: VALUE_REQUIRED
source:
origin: TBD
archive_catalog:
datatype: nvarchar(120)
destination: [ScienceCommon.calibration_software_version, GuideWindow.calibration_software_version]

filename:
tag: asdf://stsci.edu/datamodels/roman/tags/filename-1.0.0
title: Name of the file
type: string
sdf:
special_processing: VALUE_REQUIRED
source:
origin: TBD
archive_catalog:
datatype: nvarchar(120)
destination: [ScienceCommon.filename, GuideWindow.filename]

file_date:
tag: asdf://stsci.edu/datamodels/roman/tags/file_date-1.0.0
title: Date this file was created (UTC)
tag: tag:stsci.edu:asdf/time/time-1.1.0
sdf:
special_processing: VALUE_REQUIRED
source:
origin: TBD
archive_catalog:
datatype: datetime2
destination: [ScienceCommon.filedate, GuideWindow.filedate]

model_type:
tag: asdf://stsci.edu/datamodels/roman/tags/model_type-1.0.0
title: Type of data model
type: string
sdf:
special_processing: VALUE_REQUIRED
source:
origin: TBD
archive_catalog:
datatype: nvarchar(50)
destination: [ScienceCommon.model_type, GuideWindow.model_type]

origin:
tag: asdf://stsci.edu/datamodels/roman/tags/origin-1.0.0
title: Organization responsible for creating file
type: string
enum: ["STSCI", "IPAC/SSC"]
sdf:
special_processing: VALUE_REQUIRED
source:
origin: TBD
archive_catalog:
datatype: nvarchar(15)
destination: [ScienceCommon.origin, GuideWindow.origin]

prd_software_version:
tag: asdf://stsci.edu/datamodels/roman/tags/prd_software_version-1.0.0
title: S&OC PRD version number used in data processing
type: string
sdf:
special_processing: VALUE_REQUIRED
source:
origin: TBD
archive_catalog:
datatype: nvarchar(120)
destination: [ScienceCommon.prd_software_version, GuideWindow.prd_software_version]

sdf_software_version:
tag: asdf://stsci.edu/datamodels/roman/tags/sdf_software_version-1.0.0
title: SDF software version number
type: string
sdf:
special_processing: VALUE_REQUIRED
source:
origin: TBD
archive_catalog:
datatype: nvarchar(120)
destination: [ScienceCommon.sdf_software_version, GuideWindow.sdf_software_version]

telescope:
tag: asdf://stsci.edu/datamodels/roman/tags/telescope-1.0.0
title: Telescope used to acquire the data
type: string
enum: [ROMAN]
archive_catalog:
datatype: nvarchar(5)
destination: [ScienceCommon.telescope, GuideWindow.telescope]

required: [calibration_software_version, filename, file_date,
model_type, origin, prd_software_version,
sdf_software_version, telescope]
Expand Down
11 changes: 0 additions & 11 deletions src/rad/resources/schemas/cal_logs-1.0.0.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/rad/resources/schemas/cal_step-1.0.0.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.1
---
$schema: asdf://stsci.edu/datamodels/roman/schemas/rad_schema-1.0.0
$schema: asdf://stsci.edu/datamodels/roman/meta_schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/schemas/cal_step-1.0.0

title: Calibration Status
Expand Down
2 changes: 1 addition & 1 deletion src/rad/resources/schemas/common-1.0.0.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.1
---
$schema: asdf://stsci.edu/datamodels/roman/schemas/rad_schema-1.0.0
$schema: asdf://stsci.edu/datamodels/roman/meta_schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/schemas/common-1.0.0

title: Common metadata properties
Expand Down
2 changes: 1 addition & 1 deletion src/rad/resources/schemas/coordinates-1.0.0.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%YAML 1.1
---
$schema: asdf://stsci.edu/datamodels/roman/schemas/rad_schema-1.0.0
$schema: asdf://stsci.edu/datamodels/roman/meta_schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/schemas/coordinates-1.0.0

title: Information about the coordinates in the file
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%YAML 1.1
---
$schema: asdf://stsci.edu/datamodels/roman/schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/schemas/associations-1.0.0
$schema: asdf://stsci.edu/datamodels/roman/meta_schemas/rad_schema-1.0.0
id: asdf://stsci.edu/datamodels/roman/schemas/data_products/associations-1.0.0

title: Association table data model

Expand Down
Loading