-
Notifications
You must be signed in to change notification settings - Fork 5
Ghgc 632/scheduled worldview nrt collection update #378
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
Open
sanzog03
wants to merge
42
commits into
dev
Choose a base branch
from
GHGC-632/scheduled_worldview_nrt_collection_update
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
d7812f7
create a dag to handle the daily scheduled nightlight NRT data. The d…
sanzog03 06a517a
update the nrt update check and nrt data update task
sanzog03 0426b14
refactor to use the date extracted from metadata, into the collection…
sanzog03 77d8fd6
replace space with underscore on id
sanzog03 157f85d
update code into more granular subgroups. also moved nrt update speci…
sanzog03 5a76e33
removed unnecessary import
sanzog03 dc8602f
fix proper scoping on the branch_task return, enabling followup task
sanzog03 9264cc3
refactor dag to use taskflow api completely. added docstring to the t…
sanzog03 a12768f
add stac_extension to include web map links used by wmts capabilities.
sanzog03 92b911b
generic def names
sanzog03 d68f9ea
task group taking whatever is needed via parameters instead of global
sanzog03 95a7d64
modified dag creation with the thought of re-useability
sanzog03 ad97e93
generate dag docs based on the reused dag
sanzog03 fcaba93
add veda_worldview_nrt_data_collection_update_dag_creator to generate…
sanzog03 358e1e1
changed variables names and dag id generation to be more semantic
sanzog03 86b258c
change the taskgroupid to be generic
sanzog03 5026a63
add relevant dag tags
sanzog03 c1a6d19
fix collection config
sanzog03 2b6bcf1
added some comments
sanzog03 73ee5e8
renamed the dags and configs for better clarity
sanzog03 9646c50
Merge branch 'dev' into GHGC-632/scheduled_worldview_nrt_collection_u…
sanzog03 0a72f8b
remove unnecessary code
sanzog03 dd30c6b
take schedule from generate dag config. better namings
sanzog03 260324f
add ability to ingest wmts without gibs
sanzog03 82987e9
remove unwanted extensions from wmts config json
sanzog03 7e09e8b
adhere to the return type
sanzog03 e5b16e3
single task instantiation for whatever is necessary
sanzog03 c5208a7
refactor for better task arrangement and readability
sanzog03 fa67e1b
import error
sanzog03 94ae24f
1. made gibs url and schedule optional.
sanzog03 0e16bb1
wmts and gibs branching fix
sanzog03 d58dc2f
rename to make the dag generic for all wmts and not just gibs wmts
sanzog03 6cf67d9
update doc string
sanzog03 2f0ffd9
1. add validation task which validates if the json config is as per t…
sanzog03 087b486
remove comment
sanzog03 f1fb195
corrected import for tests
sanzog03 c33b58c
update wmts with validator
kyle-lesinger a1f3d5a
update pytests
kyle-lesinger ed6d435
add slack fail alert
kyle-lesinger 0d61a5f
add value error messages
kyle-lesinger b2249b9
reduce number of logging statements
kyle-lesinger 4a240f1
update generate dags
kyle-lesinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
dags/veda_data_pipeline/veda_worldview_nrt_collection_update_pipeline.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import pendulum | ||
| from datetime import timedelta | ||
| from airflow import DAG | ||
| from airflow.operators.empty import EmptyOperator | ||
| from airflow.utils.trigger_rule import TriggerRule | ||
| from veda_data_pipeline.groups.collection_group import worldview_collection_update_task_group | ||
|
|
||
|
|
||
| VIIRS_SNPP_NRT_collection = { | ||
| "assets": {}, | ||
| "collection": "VIIRS_SNPP_DayNightBand_At_Sensor_Radiance", | ||
| "dashboard:is_periodic": True, | ||
| "dashboard:time_density": "day", | ||
| "dashboard:time_interval": "P1D", | ||
| "data_type": "cog", | ||
| "description": "The Black Marble Nighttime At Sensor Radiance (Day/Night Band) layer is created from NASA’s Black Marble daily at-sensor top-of-atmosphere nighttime radiance product (VNP46A1). It is displayed as a grayscale image. The layer is expressed in radiance units (nW/(cm2 sr)) with log10 conversion. It is stretched up to 38 nW/(cm2 sr) resulting in improvements in capturing city lights in greater spatial detail than traditional Nighttime Imagery resampled at 0-255 (e.g., Day/Night Band, Enhanced Near Constant Contrast).The ultra-sensitivity of the VIIRS Day/Night Band enables scientists to capture the Earth’s surface and atmosphere in low light conditions, allowing for better monitoring of nighttime phenomena. These images are also useful for assessing anthropogenic sources of light emissions under varying illumination conditions. For instance, during partial to full moon conditions, the layer can identify the location and features of clouds and other natural terrestrial features such as sea ice and snow cover, while enabling temporal observations in urban regions, regardless of moonlit conditions. As such, the layer is particularly useful for detecting city lights, lightning, auroras, fires, gas flares, and fishing fleets.The Black Marble Nighttime At Sensor Radiance (Day/Night Band) layer is available in near real-time from the Visible Infrared Imaging Radiometer Suite (VIIRS) aboard the joint NASA/NOAA Suomi National Polar orbiting Partnership (Suomi NPP) satellite. The sensor resolution is 750 m at nadir, imagery resolution is 500 m, and the temporal resolution is daily.", | ||
| "extent": { | ||
| "spatial": { | ||
| "bbox": [ | ||
| [ | ||
| -180, | ||
| -90, | ||
| 180, | ||
| 90 | ||
| ] | ||
| ] | ||
| }, | ||
| "temporal": { | ||
| "interval": [ | ||
| [ | ||
| "2020-11-10T00:00:00Z", | ||
| "2025-04-14T00:00:00Z" | ||
| ] | ||
| ] | ||
| } | ||
| }, | ||
| "is_periodic": True, | ||
| "item_assets": { | ||
| "cog_default": { | ||
| "description": "Cloud optimized default layer to display on map", | ||
| "roles": [ | ||
| "data", | ||
| "layer" | ||
| ], | ||
| "title": "Default COG Layer", | ||
| "type": "image/tiff; application=geotiff; profile=cloud-optimized" | ||
| } | ||
| }, | ||
| "license": "MIT", | ||
| "links": [ | ||
| { | ||
| "href": "https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/wmts.cgi", | ||
| "href:servers": [ | ||
| "https://gibs-a.earthdata.nasa.gov/wmts/epsg3857/best/wmts.cgi", | ||
| "https://gibs-b.earthdata.nasa.gov/wmts/epsg3857/best/wmts.cgi" | ||
| ], | ||
| "rel": "wmts", | ||
| "title": "Visualized through a WMTS", | ||
| "type": "image/png", | ||
| "wmts:dimensions": [ | ||
| "default" | ||
| ], | ||
| "wmts:layers": [ | ||
| "VIIRS_SNPP_DayNightBand_At_Sensor_Radiance" | ||
| ] | ||
| } | ||
| ], | ||
| "product_level": "L2", | ||
| "providers": [], | ||
| "renders": {}, | ||
| "stac_extensions": [ | ||
| "https://stac-extensions.github.io/render/v1.0.0/schema.json", | ||
| "https://stac-extensions.github.io/item-assets/v1.0.0/schema.json" | ||
| ], | ||
| "stac_version": "1.1.0", | ||
| "temporal_frequency": "twenty four hours", | ||
| "time_density": "day", | ||
| "time_interval": "P1D", | ||
| "title": "Black Marble Nighttime At Sensor Radiance (Day/Night Band)", | ||
| "type": "Collection", | ||
| "units": "m·s⁻¹" | ||
| } | ||
|
|
||
| dag_doc_md = f""" | ||
| ### This DAG handles VIIRS_SNPP_DayNightBand_At_Sensor_Radiance NRT dataset update. | ||
| It checks if the NRT data hosted by earthdata is avaialble for the latest available date | ||
| via. https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/1.0.0/WMTSCapabilities.xml | ||
| If available, it overrides the VIIRS_SNPP_DayNightBand_At_Sensor_Radiance collection | ||
| with the updated temporal extent and ingests into the catalog. | ||
| #### Notes | ||
| - This DAG can uses the following configuration for VIIRS_SNPP_DayNightBand_At_Sensor_Radiance NRT collection <br> | ||
| ```json | ||
| {VIIRS_SNPP_NRT_collection} | ||
| ``` | ||
| """ | ||
|
|
||
| dag_args = { | ||
| "start_date": pendulum.today("UTC").add(days=-1), | ||
| "catchup": False, | ||
| "doc_md": dag_doc_md, | ||
| "tags": ["collection"], | ||
| } | ||
|
|
||
| with DAG( | ||
sanzog03 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "veda_worldview_nrt_data_collection_update", | ||
| schedule_interval=timedelta(days=1), | ||
| render_template_as_native_obj=True, | ||
| **dag_args | ||
| ) as dag: | ||
| start = EmptyOperator(task_id="start", dag=dag) | ||
| end = EmptyOperator(task_id="end", trigger_rule=TriggerRule.NONE_FAILED_MIN_ONE_SUCCESS, dag=dag) | ||
|
|
||
| collection_grp = worldview_collection_update_task_group(VIIRS_SNPP_NRT_collection=VIIRS_SNPP_NRT_collection) | ||
|
|
||
| start >> collection_grp >> end | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.