Skip to content

Commit

Permalink
chore: Update earthquake extension examples and validation schema URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Jul 16, 2024
1 parent 602c9ad commit db77283
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 144 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

[Unreleased]: <https://github.com/stac-extensions/template/compare/v1.0.0...HEAD>
[Unreleased]: <https://github.com/stac-extensions/earthquake/compare/v1.0.0...HEAD>
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ The fields in the table below can be used in these parts of STAC documents:
- [ ] Assets (for both Collections and Items, incl. Item Asset Definitions in Collections)
- [ ] Links

| Field Name | Type | Description |
| ----------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| eq:magnitude | \[number] | **REQUIRED**. The magnitude for the event. See also magnitude_type. |
| eq:magnitude_type | string | The type of magnitude. Default to `mww`. |
| eq:places | \[string] | The list of places referencing locations in relation with the event |
| eq:felt | number | The number of felt reports. |
| eq:status | string | Indicates whether the event has been reviewed by a human. Possible value: `automatic`, `reviewed`, `deleted` |
| eq:tsunami | boolean | This flag is set to `true` for large events in oceanic regions and `false` otherwise. |
| eq:sources | \[[source object](#eqsource)] | **REQUIRED**. A unique identifier for the event. This is the current preferred id for the event, and may change over time, the |
| eq:depth | number | The depth of the event in kilometers. |
| Field Name | Type | Description |
| ----------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| eq:magnitude | \[number] | **REQUIRED**. The magnitude for the event. See also magnitude_type. |
| eq:magnitude_type | string | The type of magnitude. Default to `mww`. |
| eq:places | \[string] | The list of places referencing locations in relation with the event |
| eq:felt | number | The number of felt reports. |
| eq:status | string | Indicates whether the event has been reviewed by a human. Possible value: `automatic`, `reviewed`, `deleted` |
| eq:tsunami | boolean | This flag is set to `true` for large events in oceanic regions and `false` otherwise. |
| eq:sources | \[[source object](#eqsources)] | **REQUIRED**. A unique identifier for the event. This is the current preferred id for the event, and may change over time, the |
| eq:depth | number | The depth of the event in kilometers. |

### Additional Field Information

Expand Down Expand Up @@ -85,7 +85,8 @@ The following table list the catalogs that are currently identified:

### USGS Earthquake GeoJSON Summary Feed

The following table gives the mapping between the fields in the [USGS Earthquake GeoJSON Summary Feed](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php) and the STAC model.
The following table gives the mapping between the fields in the
[USGS Earthquake GeoJSON Summary Feed](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php) and the STAC model.

| ComCat Field Name | STAC Field Name | Description |
| -------------------------------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -107,7 +108,8 @@ The following table gives the mapping between the fields in the [USGS Earthquake

### EMSC Earthquake Catalog

The following table gives the mapping between the fields in the [EMSC FDSN-EVENT web service](https://www.emsc-csem.org/Files/epos/specifications/Specs_fdsnevent-WS.pdf) and the STAC model.
The following table gives the mapping between the fields in the
[EMSC FDSN-EVENT web service](https://www.emsc-csem.org/Files/epos/specifications/Specs_fdsnevent-WS.pdf) and the STAC model.

| EMSC Field Name | STAC Field Name | Description |
| --------------- | --------------- | ----------- |
Expand Down
4 changes: 3 additions & 1 deletion examples/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
},
"item_assets": {
"data": {
"title": "Earthquake information in QuakeML",
"type": "application/xml",
"roles": [
"data"
]
Expand All @@ -42,7 +44,7 @@
"maximum": "2023-12-31T23:59:59Z"
},
"eq:magnitude": {
"minimum": 5.0,
"minimum": 5,
"maximum": 9.2
}
},
Expand Down
8 changes: 8 additions & 0 deletions examples/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
10
]
},
"bbox": [
37.0143,
37.2256,
10,
37.0143,
37.2256,
10
],
"properties": {
"datetime": "2023-02-06T01:17:34Z",
"title": "M 7.8 - Pazarcik earthquake, Kahramanmaras earthquake sequence",
Expand Down
223 changes: 96 additions & 127 deletions json-schema/schema.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://stac-extensions.github.io/template/v1.0.0/schema.json#",
"title": "Template Extension",
"description": "STAC Template Extension for STAC Items and STAC Collections.",
"$id": "https://stac-extensions.github.io/earthquake/v1.0.0/schema.json#",
"title": "Earthquake Extension",
"description": "STAC Earthquake Extension for STAC Items.",
"oneOf": [
{
"$comment": "This is the schema for STAC Items. Remove this object if this extension only applies to Collections.",
"$comment": "This is the schema for STAC Items.",
"allOf": [
{
"$ref": "#/definitions/stac_extensions"
},
{
"type": "object",
"required": [
Expand All @@ -22,122 +19,49 @@
"const": "Feature"
},
"properties": {
"allOf": [
{
"$comment": "Require fields here for Item Properties.",
"required": [
"template:new_field"
]
},
{
"$ref": "#/definitions/fields"
}
]
"$ref": "#/definitions/fields"
},
"assets": {
"$comment": "This validates the fields in Item Assets, but does not require them.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/fields"
}
}
}
},
{
"$ref": "#/definitions/stac_extensions"
}
]
},
{
"$comment": "This is the schema for STAC Collections.",
"type": "object",
"allOf": [
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"const": "Collection"
}
}
},
{
"$ref": "#/definitions/stac_extensions"
}
],
"anyOf": [
{
"$comment": "This is the schema for the top-level fields in a Collection. Remove this if this extension does not define top-level fields for Collections.",
"allOf": [
{
"$comment": "Require fields here for Collections (top-level).",
"required": [
"template:new_field"
]
},
{
"$ref": "#/definitions/fields"
}
]
},
{
"$comment": "This validates the fields in Collection Assets, but does not require them.",
"required": [
"assets"
],
"properties": {
"assets": {
"type": "object",
"not": {
"additionalProperties": {
"not": {
"allOf": [
{
"$ref": "#/definitions/require_any_field"
},
{
"$ref": "#/definitions/fields"
}
]
}
}
"additionalProperties": {
"$ref": "#/definitions/fields"
}
}
}
},
{
"$comment": "This is the schema for the fields in Item Asset Definitions. It doesn't require any fields.",
"required": [
"item_assets"
],
"properties": {
},
"item_assets": {
"type": "object",
"not": {
"additionalProperties": {
"not": {
"allOf": [
{
"$ref": "#/definitions/require_any_field"
},
{
"$ref": "#/definitions/fields"
}
]
}
}
"additionalProperties": {
"$ref": "#/definitions/fields"
}
}
}
},
{
"$comment": "This is the schema for the fields in Summaries. By default, only checks the existence of the properties, but not the schema of the summaries.",
"required": [
"summaries"
],
"properties": {
"summaries": {
"$ref": "#/definitions/require_any_field"
}
}
"$ref": "#/definitions/stac_extensions"
}
]
}
Expand All @@ -152,58 +76,103 @@
"stac_extensions": {
"type": "array",
"contains": {
"const": "https://stac-extensions.github.io/template/v1.0.0/schema.json"
"const": "https://stac-extensions.github.io/earthquake/v1.0.0/schema.json"
}
}
}
},
"require_any_field": {
"$comment": "Please list all fields here so that we can force the existence of one of them in other parts of the schemas.",
"anyOf": [
{"required": ["template:new_field"]},
{"required": ["template:xyz"]},
{"required": ["template:another_one"]}
]
},
"fields": {
"$comment": "Add your new fields here. Don't require them here, do that above in the corresponding schema.",
"type": "object",
"properties": {
"template:new_field": {
"type": "string"
"eq:magnitude": {
"title": "Magnitude",
"type": "number",
"minimum": 0,
"maximum": 20
},
"template:xyz": {
"type": "object",
"required": [
"x",
"y",
"z"
],
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"z": {
"type": "number"
}
}
"eq:magnitude_type": {
"title": "Magnitude Type",
"type": "string",
"enum": [
"mww",
"mwc",
"mwb",
"ms",
"mb",
"mfa",
"ml",
"mlg",
"md",
"mwp",
"me",
"mh"
]
},
"template:another_one": {
"eq:places": {
"title": "Places",
"type": "array",
"items": {
"type": "number"
"type": "string"
}
},
"eq:felt": {
"title": "Number of felt reports",
"type": "integer"
},
"eq:status": {
"title": "Status",
"type": "string",
"enum": [
"automatic",
"reviewed",
"deleted"
]
},
"eq:tsunami": {
"title": "Tsunami",
"type": "boolean"
},
"eq:sources": {
"$ref": "#/definitions/sources"
},
"eq:depth": {
"title": "Depth",
"type": "number"
}
},
"patternProperties": {
"^(?!template:)": {
"$comment": "Above, change `template` to the prefix of this extension"
}
"^(?!eq:)": {}
},
"additionalProperties": false
},
"sources": {
"title": "Sources",
"type": "array",
"minItems": 1,
"items": {
"title": "Source",
"type": "object",
"minProperties": 2,
"required": [
"name",
"code"
],
"properties": {
"name": {
"title": "Name of the source",
"type": "string"
},
"code": {
"title": "Code of the source",
"type": "string"
},
"catalog": {
"title": "Id of the catalog",
"type": "string",
"minLength": 1
}
}
}
}
}
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "stac-extension-template",
"name": "stac-extension-earthquake",
"version": "1.0.0",
"scripts": {
"test": "npm run check-markdown && npm run check-examples",
"check-markdown": "remark . -f -r .github/remark.yaml",
"check-examples": "stac-node-validator . --lint --verbose --schemaMap https://stac-extensions.github.io/template/v1.0.0/schema.json=./json-schema/schema.json",
"format-examples": "stac-node-validator . --format --schemaMap https://stac-extensions.github.io/template/v1.0.0/schema.json=./json-schema/schema.json"
"check-examples": "stac-node-validator . --lint --verbose --schemaMap https://stac-extensions.github.io/earthquake/v1.0.0/schema.json=./json-schema/schema.json",
"format-examples": "stac-node-validator . --format --schemaMap https://stac-extensions.github.io/earthquake/v1.0.0/schema.json=./json-schema/schema.json"
},
"dependencies": {
"remark-cli": "^12.0.0",
Expand Down

0 comments on commit db77283

Please sign in to comment.