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

Proposed static spec #33

Merged
merged 7 commits into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added __init__.py
Empty file.
Empty file added static-catalog/__init__.py
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import json
from jsonschema import validate, RefResolver

# find our schema root folder
schema_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "json-schema"))
schema_root_url = "file:///{}/".format(schema_folder.replace('\\', '/'))

# get the schema and the reference resolver
with open(os.path.join(schema_folder, 'spatiotemporal_feature.json')) as schema_file:
schema = json.load(schema_file)
resolver = RefResolver(schema_root_url, schema)

# for each example file in the folder validate against the schema
example_directory = os.path.join(os.path.dirname(__file__), '..', 'examples')
for filename in os.listdir(example_directory):
with open(os.path.join(example_directory, filename)) as example_file:
example = json.load(example_file)

# validate against the schema
validate(example, schema, resolver=resolver)
print('validated {}'.format(filename))



Original file line number Diff line number Diff line change
@@ -0,0 +1,320 @@
{
"id": "103001004B316600",
"type": "Feature",
"schema": "DigitalGlobeAcquisition",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
-104.9506689,
38.96469654
],
[
-105.1608127,
38.95840828
],
[
-105.1610212,
39.00241359
],
[
-105.1609342,
39.04661305
],
[
-105.1605798,
39.09107845
],
[
-105.1603734,
39.13571925
],
[
-105.1606414,
39.18033946
],
[
-105.160482,
39.22534091
],
[
-105.1617257,
39.26986031
],
[
-105.1614253,
39.31538951
],
[
-105.1608883,
39.3612619
],
[
-105.1613922,
39.40685628
],
[
-105.163213,
39.45187733
],
[
-105.1635238,
39.4980186
],
[
-105.1622525,
39.54545705
],
[
-105.1624777,
39.59229898
],
[
-105.1624785,
39.63959411
],
[
-105.1636219,
39.68637975
],
[
-105.1634848,
39.73439091
],
[
-105.1637438,
39.78249578
],
[
-105.1642909,
39.83069735
],
[
-105.1649241,
39.87919405
],
[
-105.165344,
39.92821627
],
[
-105.1659454,
39.97750376
],
[
-105.1659608,
40.02059078
],
[
-104.9357658,
40.04463773
],
[
-104.9362418,
40.00097208
],
[
-104.9371883,
39.95044437
],
[
-104.9376547,
39.90071155
],
[
-104.9380541,
39.85136537
],
[
-104.9387179,
39.80218228
],
[
-104.9394349,
39.75327832
],
[
-104.9400211,
39.70483598
],
[
-104.9406978,
39.65662621
],
[
-104.9412063,
39.60882697
],
[
-104.94199,
39.56114115
],
[
-104.9429155,
39.51371447
],
[
-104.9433825,
39.46682092
],
[
-104.9436075,
39.42030036
],
[
-104.9441694,
39.37382041
],
[
-104.9450015,
39.32748833
],
[
-104.9454518,
39.28152803
],
[
-104.9459165,
39.23581207
],
[
-104.9476415,
39.18976879
],
[
-104.9485045,
39.14430328
],
[
-104.9491347,
39.09911019
],
[
-104.9500794,
39.05402796
],
[
-104.9507337,
39.00920829
],
[
-104.9506689,
38.96469654
]
]
]
]
},
"properties": {
"bands": [
{
"common_name": "COASTAL",
"gsd": 2.047,
"center_wavelength": 427.0,
"effective_bandwidth": 62.0
},
{
"common_name": "Blue",
"gsd": 2.047,
"center_wavelength": 478.0,
"effective_bandwidth": 73.0
},
{
"common_name": "Green",
"gsd": 2.047,
"center_wavelength": 546.0,
"effective_bandwidth": 80.0
},
{
"common_name": "Yellow",
"gsd": 2.047,
"center_wavelength": 608.0,
"effective_bandwidth": 48.0
},
{
"common_name": "Red",
"gsd": 2.047,
"center_wavelength": 659.0,
"effective_bandwidth": 70.0
},
{
"common_name": "RedEdge",
"gsd": 2.047,
"center_wavelength": 724.0,
"effective_bandwidth": 50.0
},
{
"common_name": "NIR",
"gsd": 2.047,
"center_wavelength": 833.0,
"effective_bandwidth": 136.0
},
{
"common_name": "NIR",
"gsd": 2.047,
"center_wavelength": 949.0,
"effective_bandwidth": 187.0
},
{
"common_name": "PAN",
"gsd": 0.512,
"center_wavelength": 627.0,
"effective_bandwidth": 361.0
}
],
"startDateTime": "2015-11-09T18:04:44.203Z",
"endDateTime": "2015-11-09T18:04:44.203Z",
"links": [
{
"rel": "self",
"href": "uri of self"
}
],
"feature_type": [
"GBDXCatalogRecord",
"Acquisition",
"DigitalGlobeAcquisition",
"WV02"
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea in the feature_type that the above feature_type's would all have schemas that fields in this record would validate against? Or is it just meant to be informative in some way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That list is more because that is how our current catalog "tags" the records, so that you can search for and find all WV02 related records (not just acquisitions) for instance. There is a singular type, DigitialGlobeAcquisition that this record would validate against.

"offNadirAngle_min": 17.4232692718506,
"offNadirAngle_start": 17.4232692718506,
"targetAzimuth_min": 39.8670921325684,
"multiResolution_min": 2.01992535591125,
"cloudCover": 8,
"sunAzimuth_max": 168.897964477539,
"targetAzimuth": 52.0153427124023,
"multiResolution": 2.11924600601196,
"catalogID": "103001004B316600",
"panResolution_max": 0.562737643718719,
"timestamp": "2015-11-09T18:04:44.203Z",
"sunAzimuth_min": 168.697967529297,
"targetAzimuth_max": 68.5699844360352,
"sunAzimuth": 168.800811767578,
"sunElevation_min": 32.4971733093262,
"offNadirAngle": 21.3762378692627,
"stereoPair": null,
"platformName": "WORLDVIEW02",
"multiResolution_start": 2.01992535591125,
"sunElevation": 33.0273399353027,
"scanDirection": "Reverse",
"panResolution_end": 0.562737643718719,
"panResolution_start": 0.505126416683197,
"targetAzimuth_end": 39.8670921325684,
"panResolution_min": 0.505126416683197,
"offNadirAngle_max": 25.6806030273438,
"multiResolution_end": 2.24830341339111,
"multiResolution_max": 2.24830341339111,
"sunElevation_max": 33.5694541931152,
"offNadirAngle_end": 25.6806030273438,
"panResolution": 0.530210316181183,
"footprintWkt": "MULTIPOLYGON(((-104.9506689 38.96469654, -105.1608127 38.95840828, -105.1610212 39.00241359, -105.1609342 39.04661305, -105.1605798 39.09107845, -105.1603734 39.13571925, -105.1606414 39.18033946, -105.160482 39.22534091, -105.1617257 39.26986031, -105.1614253 39.31538951, -105.1608883 39.3612619, -105.1613922 39.40685628, -105.163213 39.45187733, -105.1635238 39.4980186, -105.1622525 39.54545705, -105.1624777 39.59229898, -105.1624785 39.63959411, -105.1636219 39.68637975, -105.1634848 39.73439091, -105.1637438 39.78249578, -105.1642909 39.83069735, -105.1649241 39.87919405, -105.165344 39.92821627, -105.1659454 39.97750376, -105.1659608 40.02059078, -104.9357658 40.04463773, -104.9362418 40.00097208, -104.9371883 39.95044437, -104.9376547 39.90071155, -104.9380541 39.85136537, -104.9387179 39.80218228, -104.9394349 39.75327832, -104.9400211 39.70483598, -104.9406978 39.65662621, -104.9412063 39.60882697, -104.94199 39.56114115, -104.9429155 39.51371447, -104.9433825 39.46682092, -104.9436075 39.42030036, -104.9441694 39.37382041, -104.9450015 39.32748833, -104.9454518 39.28152803, -104.9459165 39.23581207, -104.9476415 39.18976879, -104.9485045 39.14430328, -104.9491347 39.09911019, -104.9500794 39.05402796, -104.9507337 39.00920829, -104.9506689 38.96469654)))",
"targetAzimuth_start": 68.5699844360352,
"sensorPlatformName": "WORLDVIEW02",
"plaform": "WV02",
"instrument": "VNIR",
"provider": "DigitalGlobe",
"license": "(C) COPYRIGHT 2016 DigitalGlobe, Inc., Longmont CO USA 80503"
}
}
Loading