|
// Copyright 2021 Google LLC. |
|
// SPDX-License-Identifier: Apache-2.0 |
|
|
|
// Demonstrate templating for multiple outputs that are similar. |
|
// Generates 4 STAC Collection JSON files for Earth Engine ImageCollections. |
|
|
|
local stac_const = import "stac_const.libsonnet"; |
|
local stac = import "stac_lib.libsonnet"; |
|
|
|
// Constants specific to NOAA GOES and FDC Fire/Hot Spot |
|
local noaa_fdc_url = |
|
'https://data.noaa.gov/dataset/dataset/' + |
|
'noaa-goes-r-series-advanced-baseline-imager-abi-level-2' + |
|
'-fire-hot-spot-characterization-fdc'; |
|
|
|
local goes_keywords = [ |
|
'abi', |
|
'climate', |
|
'goes', |
|
'nesdis', |
|
'noaa', |
|
'ospo', |
|
]; |
|
|
|
local fdc_keywords = goes_keywords + [ |
|
'fdc', |
|
'fire', |
|
'hotspot', |
|
'wildfire' |
|
]; |
|
|
|
local sat_info = { |
|
'16': { region: 'goes-east', letter: 'goes-r'}, |
|
'17': { region: 'goes-west', letter: 'goes-s'}, |
|
}; |
|
|
|
// local sat_region = { '16': 'goes-east', '17': 'goes-west' }; |
|
// local sat_letter = { '16': 'goes-r', '17': 'goes-s' }; |
|
|
|
local start_16 = '2017-05-24T00:00:00Z'; |
|
local start_17 = '2018-08-27T00:00:00Z'; |
|
local extents = { |
|
FDCC_16: stac.extent(-152.11, 14.0, -49.18, 56.77, start_16, null), |
|
FDCF_16: stac.extent_global(start_16, null), |
|
FDCC_17: stac.extent(-180, 14.57, 180, 53.51, start_17, null), |
|
FDCF_17: stac.extent_global(start_17, null), |
|
}; |
|
|
|
local primary_doi = '10.1175/BAMS'; |
|
|
|
local goes_id(sat, product) = 'NOAA/GOES/'+ sat +'/' + product; |
|
|
|
// Primary template. |
|
local goes_fdc_template(sat, product) = { |
|
local basename = 'NOAA_GOES_' + sat + '_' + product, |
|
local basefilename = basename + '.json', |
|
local self_ee_catalog_url = stac_const.ee_catalog_url + basename, |
|
local self_url = stac_const.catalog_base + basefilename, |
|
|
|
local sample_url = stac_const.sample_url(basename), |
|
|
|
local gcs_bucket = 'gcp-public-data-goes-' + sat, |
|
local gcs_path = stac_const.gcs_base + gcs_bucket + '/ABI-L2-' + product, |
|
|
|
id: goes_id(sat, product), |
|
'gee:type': 'image_collection', |
|
stac_version: stac_const.stac_version, |
|
stac_extensions: ['scientific'], |
|
title: 'GOES-' + sat + ' ' + product + ' Series ABI Level 2 Fire/Hot Spot', |
|
description: ||| |
|
[GOES](https://www.goes.noaa.gov) satellites are geostationary weather |
|
satellites run by NOAA. |
|
|
|
The Fire (HSC) product contains four images: one in the form of a fire |
|
mask and the other three with pixel values identifying fire temperature, |
|
fire area, and fire radiative power. |
|
|
|
The ABI L2+ FHS metadata mask assigns a flag to every earth-navigated |
|
pixel that indicates its disposition with respect to the FHS |
|
algorithm. Operational users who have the lowest tolerance for false |
|
alarms should focus on the "processed" and "saturated" categories (mask |
|
codes 10, 11, 30, and 31), but within these categories there can still |
|
be false alarms. |
|
|
|
[README](https://www.ncdc.noaa.gov/data-access/satellite-data/goes-r-series-satellites#FDC) |
|
|
|
NOAA provides the following scripts for suggested categories, color |
|
maps, and visualizations: |
|
|
|
- [GOES-16-17_FireDetection.js](https://github.com/google/earthengine-community/blob/master/datasets/scripts/GOES-16-17_FireDetection.js) |
|
- [GOES-16-17_FireReclassification.js](https://github.com/google/earthengine-community/blob/master/datasets/scripts/GOES-16-17_FireReclassification.js) |
|
|||, |
|
// TODO(schwehr): Can we use https://spdx.org/licenses/CC0-1.0.html for GOES? |
|
license: 'proprietary', |
|
links: [ |
|
{rel: 'self', href: self_url}, |
|
{rel: 'parent', href: stac_const.catalog_url}, |
|
{rel: 'root', href: stac_const.catalog_url}, |
|
{rel: 'preview', href: sample_url}, |
|
{rel: 'license', href: self_ee_catalog_url + '#terms-of-use'}, |
|
{rel: 'source', href: gcs_path}, |
|
{rel: 'cite-as', href: stac.doi_url(primary_doi)} |
|
], |
|
|
|
local this_sat = sat_info[std.toString(sat)], |
|
keywords: fdc_keywords + [ |
|
'goes-' + sat, |
|
this_sat['letter'], |
|
this_sat['region'], |
|
], |
|
providers: [ |
|
stac.producer_provider('NOAA', noaa_fdc_url), |
|
stac.host_provider(self_ee_catalog_url), |
|
], |
|
extent: extents[product + '_' + std.toString(sat)], |
|
properties: { |
|
gsd: 2000.0, |
|
'eo:bands': [ |
|
{ |
|
name: 'Area', |
|
description: 'Fire area', |
|
'gee:unit': 'm^2', |
|
'gee:scale': 60.98, |
|
'gee:offset': 4000.0 |
|
}, |
|
{ |
|
name: 'Mask', |
|
description: ||| |
|
Fire mask categories. Pixel values in the fire mask image identify a |
|
fire category and diagnostic information associated with algorithm |
|
execution. The six fire categories include: Good quality or temporally |
|
filtered good quality fire pixel; Saturated fire pixel or temporally |
|
filtered saturated fire pixel; Cloud contaminated or temporally |
|
filtered cloud contaminated fire pixel; High probability or temporally |
|
filtered high probability fire pixel; Medium probability or temporally |
|
filtered high probability fire pixel; Low probability or temporally |
|
filtered high probability fire. Temporally filtered fire pixels are |
|
those resulting from fire pixels that are in close proximity in both |
|
space and time. |
|
|||, |
|
'gee:classes': [ |
|
stac.class_entry(10, 'red', 'Processed fire'), |
|
stac.class_entry(11, 'white', 'Saturated fire'), |
|
// [SNIP] |
|
stac.class_entry(35, 'darkblue', 'Low probability fire, filtered'), |
|
] |
|
}, |
|
// SNIP |
|
], |
|
'gee:cadence': 'minutes', |
|
'gee:terms_of_use': 'NOAA data, information, and products, [SNIP]', |
|
'gee:visualizations': [ |
|
{ |
|
display_name: 'Data Quality Flags (DQF)', |
|
lookat: { lon: -75.0, zoom: 3 }, |
|
image_visualization: { /* SNIP */ } |
|
} |
|
], |
|
}, |
|
'sci:citation': 'Early characterization of the active [SNIP]', |
|
'sci:publications': [ |
|
{ |
|
citation: 'Schmit, T., Griffith, P., et al, (2016), A [SNIP]', |
|
doi: '10.1175/BAMS' |
|
} |
|
], |
|
summaries: { |
|
Area: stac.stats_obj(0, 16723, true), |
|
Temp: stac.stats_obj(0, 32642, true), |
|
Power: stac.stats_obj(0, 200000, false), |
|
DQF: stac.stats_obj(0, 5, false), |
|
}, |
|
}; |
|
|
|
// Generate the files. |
|
{ |
|
['NOAA_GOES_' + sat + '_' + product + '.json']: goes_fdc_template(sat, product) |
|
for sat in [16, 17] |
|
for product in ['FDCC', 'FDCF'] |
|
} |