Skip to content

Commit

Permalink
Merge pull request #20 from stactools-packages/release-0.2.0
Browse files Browse the repository at this point in the history
Update version number to v0.2.0, goes extension and other minor updates
  • Loading branch information
m-mohr authored Sep 23, 2022
2 parents d366322 + f4ed138 commit 3dde3d0
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 105 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,38 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [0.2.0]

### Added

- New option `fixnetcdf` for Item creation (see issue [#17](https://github.com/stactools-packages/goes-glm/issues/17) for details)
- New option `appendctime` for Item creation (see issue [#19](https://github.com/stactools-packages/goes-glm/issues/19) for details)
- Handle GOES-Test correctly

### Changed

- Use snake case instead of kebab case in all `goes:` field names
- `goes-glm:` prefiexed fields use now the `goes:` prefix

### Deprecated

- Nothing.

### Removed

- Nothing.
- `goes-glm:product_time` doesn't get exported any longer. Use STAC's native datetime fields instead.

### Fixed

- Handle missing `...frame_time_offset...` variables correctly
- Handle inconsistencies in the `..._count` variables better
- Handle netCDF files with no events/flashes correctly
- Added GOES extension in `stac_extensions`

## [0.1.0]

- First release

[Unreleased]: <https://github.com/stactools-packages/goes-glm/tree/main/>
[0.2.0]: <https://github.com/stactools-packages/goes-glm/tree/v0.2.0/>
[0.1.0]: <https://github.com/stactools-packages/goes-glm/tree/v0.1.0/>
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
- [proj](https://github.com/stac-extensions/projection/)
- [table](https://github.com/stac-extensions/table/) (for geoparquet only)
- Extra fields:
- Prefix `goes:`: They have been defined in the [GOES extension](https://github.com/stac-extensions/goes/) so that they can be shared across multiple GOES products.
- Prefix `goes-glm:`: Variables with valid scalar values / without dimensions are added to the Item properties. The variable name is used as the property key after the prefix, e.g. `goes-glm:event_count`.
- Prefix `goes:`: As defined in the [GOES extension](https://github.com/stac-extensions/goes/).
All variables with valid scalar values / without dimensions are added to the Item properties with a `goes:` prefix.
The variable name is used as the property key after the prefix, e.g. `goes:event_count`.

A stactools package for the Geostationary Lightning Mapper (GLM) dataset, which is on the GOES-16/R and GOES-17/S satellites.
GLM detects all forms of lightning during both day and night, continuously, with a high spatial resolution and detection efficiency.
Expand Down
9 changes: 5 additions & 4 deletions examples/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
"rel": "item",
"href": "./item.json",
"type": "application/geo+json",
"title": "OR_GLM-L2-LCFA_G16_s20203662359400_e20210010000004_c20210010000030"
"title": "OR_GLM-L2-LCFA_G16_s20203662359400_e20210010000004"
},
{
"rel": "item",
"href": "./item2.json",
"type": "application/geo+json",
"title": "OR_GLM-L2-LCFA_G17_s20221542100000_e20221542100200_c20221542100217"
"title": "OR_GLM-L2-LCFA_G17_s20221542100000_e20221542100200"
},
{
"rel": "item",
"href": "./item3.json",
"type": "application/geo+json",
"title": "OR_GLM-L2-LCFA_G17_s20221542100000_e20221542100200_c20221542100217"
"title": "OR_GLM-L2-LCFA_G17_s20221542100000_e20221542100200"
},
{
"rel": "root",
Expand Down Expand Up @@ -62,6 +62,7 @@
}
],
"stac_extensions": [
"https://stac-extensions.github.io/goes/v1.0.0/schema.json",
"https://stac-extensions.github.io/processing/v1.1.0/schema.json",
"https://stac-extensions.github.io/scientific/v1.0.0/schema.json",
"https://stac-extensions.github.io/table/v1.2.0/schema.json",
Expand Down Expand Up @@ -197,7 +198,7 @@
"processing:level": [
"L2"
],
"goes:orbital-slot": [
"goes:orbital_slot": [
"West",
"East",
"Test"
Expand Down
30 changes: 15 additions & 15 deletions examples/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
"gsd": 8000,
"processing:level": "L2",
"processing:facility": "WCDAS",
"goes:orbital-slot": "East",
"goes:system-environment": "OR",
"goes-glm:product_time": 662731180.0,
"goes-glm:lightning_wavelength": 777.3699951171875,
"goes-glm:group_time_threshold": 0.0,
"goes-glm:flash_time_threshold": 3.3299999237060547,
"goes-glm:event_count": 11236,
"goes-glm:group_count": 3706,
"goes-glm:flash_count": 179,
"goes-glm:percent_navigated_L1b_events": 1.0,
"goes-glm:yaw_flip_flag": 0,
"goes-glm:nominal_satellite_subpoint_lat": 0.0,
"goes-glm:nominal_satellite_height": 35786.0234375,
"goes-glm:nominal_satellite_subpoint_lon": -75.19999694824219,
"goes-glm:percent_uncorrectable_L0_errors": 0.0,
"goes:orbital_slot": "East",
"goes:system_environment": "OR",
"goes:lightning_wavelength": 777.3699951171875,
"goes:group_time_threshold": 0.0,
"goes:flash_time_threshold": 3.3299999237060547,
"goes:event_count": 11236,
"goes:group_count": 3706,
"goes:flash_count": 179,
"goes:percent_navigated_L1b_events": 1.0,
"goes:yaw_flip_flag": 0,
"goes:nominal_satellite_subpoint_lat": 0.0,
"goes:nominal_satellite_height": 35786.0234375,
"goes:nominal_satellite_subpoint_lon": -75.19999694824219,
"goes:percent_uncorrectable_L0_errors": 0.0,
"proj:epsg": 4326,
"proj:centroid": {
"lat": 0.0,
Expand Down Expand Up @@ -663,6 +662,7 @@
66.56
],
"stac_extensions": [
"https://stac-extensions.github.io/goes/v1.0.0/schema.json",
"https://stac-extensions.github.io/processing/v1.1.0/schema.json",
"https://stac-extensions.github.io/projection/v1.0.0/schema.json",
"https://stac-extensions.github.io/table/v1.2.0/schema.json",
Expand Down
30 changes: 15 additions & 15 deletions examples/item2.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
"gsd": 8000,
"processing:level": "L2",
"processing:facility": "WCDAS",
"goes:orbital-slot": "West",
"goes:system-environment": "OR",
"goes-glm:product_time": 707562000.0,
"goes-glm:lightning_wavelength": 777.3699951171875,
"goes-glm:group_time_threshold": 0.0,
"goes-glm:flash_time_threshold": 3.3299999237060547,
"goes-glm:event_count": 1229,
"goes-glm:group_count": 811,
"goes-glm:flash_count": 117,
"goes-glm:percent_navigated_L1b_events": 1.0,
"goes-glm:yaw_flip_flag": 0,
"goes-glm:nominal_satellite_subpoint_lat": 0.0,
"goes-glm:nominal_satellite_height": 35786.0234375,
"goes-glm:nominal_satellite_subpoint_lon": -137.1999969482422,
"goes-glm:percent_uncorrectable_L0_errors": 0.0,
"goes:orbital_slot": "West",
"goes:system_environment": "OR",
"goes:lightning_wavelength": 777.3699951171875,
"goes:group_time_threshold": 0.0,
"goes:flash_time_threshold": 3.3299999237060547,
"goes:event_count": 1229,
"goes:group_count": 811,
"goes:flash_count": 117,
"goes:percent_navigated_L1b_events": 1.0,
"goes:yaw_flip_flag": 0,
"goes:nominal_satellite_subpoint_lat": 0.0,
"goes:nominal_satellite_height": 35786.0234375,
"goes:nominal_satellite_subpoint_lon": -137.1999969482422,
"goes:percent_uncorrectable_L0_errors": 0.0,
"proj:epsg": 4326,
"proj:centroid": {
"lat": 0.0,
Expand Down Expand Up @@ -685,6 +684,7 @@
66.56
],
"stac_extensions": [
"https://stac-extensions.github.io/goes/v1.0.0/schema.json",
"https://stac-extensions.github.io/processing/v1.1.0/schema.json",
"https://stac-extensions.github.io/projection/v1.0.0/schema.json",
"https://stac-extensions.github.io/table/v1.2.0/schema.json",
Expand Down
28 changes: 14 additions & 14 deletions examples/item3.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@
"gsd": 8000,
"processing:level": "L2",
"processing:facility": "WCDAS",
"goes:orbital-slot": "Test",
"goes:system-environment": "OR",
"goes-glm:product_time": 592440420.0,
"goes-glm:lightning_wavelength": 777.3699951171875,
"goes-glm:group_time_threshold": 0.0,
"goes-glm:flash_time_threshold": 3.3299999237060547,
"goes-glm:event_count": 6687,
"goes-glm:group_count": 6171,
"goes-glm:flash_count": 123,
"goes-glm:percent_navigated_L1b_events": 1.0,
"goes-glm:nominal_satellite_subpoint_lat": 0.0,
"goes-glm:nominal_satellite_height": 35786.0234375,
"goes-glm:nominal_satellite_subpoint_lon": -89.5,
"goes-glm:percent_uncorrectable_L0_errors": 0.0,
"goes:orbital_slot": "Test",
"goes:system_environment": "OR",
"goes:lightning_wavelength": 777.3699951171875,
"goes:group_time_threshold": 0.0,
"goes:flash_time_threshold": 3.3299999237060547,
"goes:event_count": 6687,
"goes:group_count": 6171,
"goes:flash_count": 123,
"goes:percent_navigated_L1b_events": 1.0,
"goes:nominal_satellite_subpoint_lat": 0.0,
"goes:nominal_satellite_height": 35786.0234375,
"goes:nominal_satellite_subpoint_lon": -89.5,
"goes:percent_uncorrectable_L0_errors": 0.0,
"proj:epsg": 4326,
"proj:centroid": {
"lat": 0.0,
Expand Down Expand Up @@ -606,6 +605,7 @@
66.56
],
"stac_extensions": [
"https://stac-extensions.github.io/goes/v1.0.0/schema.json",
"https://stac-extensions.github.io/processing/v1.1.0/schema.json",
"https://stac-extensions.github.io/projection/v1.0.0/schema.json",
"https://stac-extensions.github.io/table/v1.2.0/schema.json",
Expand Down
2 changes: 1 addition & 1 deletion src/stactools/goes_glm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def register_plugin(registry: Registry) -> None:
registry.register_subcommand(commands.create_goesglm_command)


__version__ = "0.1.0"
__version__ = "0.2.0"
41 changes: 26 additions & 15 deletions src/stactools/goes_glm/stac.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import math
import os
import re
from datetime import datetime, timezone
Expand Down Expand Up @@ -87,14 +88,13 @@ def create_collection(
"instruments": constants.INSTRUMENTS,
"gsd": [constants.RESOLUTION],
"processing:level": [constants.PROCESSING_LEVEL],
"goes:orbital-slot": [e.value for e in constants.OrbitalSlot],
"goes:orbital_slot": [e.value for e in constants.OrbitalSlot],
}
)

collection = Collection(
stac_extensions=[
# todo: add extension again once released #12
# constants.GOES_EXTENSION,
constants.GOES_EXTENSION,
constants.PROCESSING_EXTENSION,
],
id=id,
Expand All @@ -108,7 +108,8 @@ def create_collection(
catalog_type=CatalogType.RELATIVE_PUBLISHED,
)

collection.add_link(Link(target=license, rel=RelType.LICENSE, title="License"))
if license is not None:
collection.add_link(Link(target=license, rel=RelType.LICENSE, title="License"))
collection.add_link(constants.LINK_LANDING_PAGE)
collection.add_link(constants.LINK_USER_GUIDE_MAIN)
collection.add_link(constants.LINK_USER_GUIDE_L2_PRODUCTS)
Expand Down Expand Up @@ -247,8 +248,8 @@ def create_item(
"gsd": constants.RESOLUTION,
"processing:level": constants.PROCESSING_LEVEL,
"processing:facility": dataset.production_site,
"goes:orbital-slot": slot,
"goes:system-environment": sys_env,
"goes:orbital_slot": slot,
"goes:system_environment": sys_env,
}

if slot == constants.OrbitalSlot.GOES_East:
Expand All @@ -266,21 +267,31 @@ def create_item(

centroid = {}
for key, var in dataset.variables.items():
if len(var.dimensions) != 0:
if len(var.dimensions) != 0 or var.name == "product_time":
continue

ma = var[...]
if var.name == "lat_field_of_view":
centroid["lat"] = ma.tolist()
elif var.name == "lon_field_of_view":
centroid["lon"] = ma.tolist()
elif ma.count() > 0:
properties[f"goes-glm:{var.name}"] = ma.tolist()
if ma.count() == 1:
val = ma.tolist()
name = f"goes:{var.name}"
if var.name == "lat_field_of_view":
centroid["lat"] = val
elif var.name == "lon_field_of_view":
centroid["lon"] = val
elif var.name.endswith("_count") or var.name == "yaw_flip_flag":
val = val
if val >= 0:
properties[name] = val
elif var.name.startswith("nominal_") or var.name.startswith("precent_"):
val = val
if not math.isclose(val, -999.0):
properties[name] = val
else:
properties[name] = val

item = Item(
stac_extensions=[
# todo: add extension again once released #12
# constants.GOES_EXTENSION,
constants.GOES_EXTENSION,
constants.PROCESSING_EXTENSION,
],
id=id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
"gsd": 8000,
"processing:level": "L2",
"processing:facility": "WCDAS",
"goes:orbital-slot": "East",
"goes:system-environment": "OR",
"goes-glm:product_time": 662731180.0,
"goes-glm:lightning_wavelength": 777.3699951171875,
"goes-glm:group_time_threshold": 0.0,
"goes-glm:flash_time_threshold": 3.3299999237060547,
"goes-glm:event_count": 11236,
"goes-glm:group_count": 3706,
"goes-glm:flash_count": 179,
"goes-glm:percent_navigated_L1b_events": 1.0,
"goes-glm:yaw_flip_flag": 0,
"goes-glm:nominal_satellite_subpoint_lat": 0.0,
"goes-glm:nominal_satellite_height": 35786.0234375,
"goes-glm:nominal_satellite_subpoint_lon": -75.19999694824219,
"goes-glm:percent_uncorrectable_L0_errors": 0.0,
"goes:orbital_slot": "East",
"goes:system_environment": "OR",
"goes:lightning_wavelength": 777.3699951171875,
"goes:group_time_threshold": 0.0,
"goes:flash_time_threshold": 3.3299999237060547,
"goes:event_count": 11236,
"goes:group_count": 3706,
"goes:flash_count": 179,
"goes:percent_navigated_L1b_events": 1.0,
"goes:yaw_flip_flag": 0,
"goes:nominal_satellite_subpoint_lat": 0.0,
"goes:nominal_satellite_height": 35786.0234375,
"goes:nominal_satellite_subpoint_lon": -75.19999694824219,
"goes:percent_uncorrectable_L0_errors": 0.0,
"proj:epsg": 4326,
"proj:centroid": {
"lat": 0.0,
Expand Down Expand Up @@ -663,6 +662,7 @@
66.56
],
"stac_extensions": [
"https://stac-extensions.github.io/goes/v1.0.0/schema.json",
"https://stac-extensions.github.io/processing/v1.1.0/schema.json",
"https://stac-extensions.github.io/projection/v1.0.0/schema.json",
"https://stac-extensions.github.io/table/v1.2.0/schema.json",
Expand Down
Binary file not shown.
Loading

0 comments on commit 3dde3d0

Please sign in to comment.