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

Init dataset/layer config for seal tag data pulled from ADC #808

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
64 changes: 64 additions & 0 deletions qgreenland/config/cfg-lock.json
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This lockfile provides a json representation of the config that's defined using Python. This allows us to quickly be able to assess the results of config changes against previous state.

Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,26 @@
"title": "Sea Ice Index, Version 3"
}
},
"seal_tag_measurements": {
"assets": {
"only": {
"id": "only",
"urls": [
"https://arcticdata.io/metacat/d1/mn/v2/object/urn%3Auuid%3A31162eb9-7e3b-4b88-948f-f4c99f13a83f"
],
"verify_tls": true
}
},
"id": "seal_tag_measurements",
"metadata": {
"abstract": "This project involves a marine-mammal sensor-tagging\napproach that will allow for sustained oceanographic observations along\nthe periphery of the Greenland Ice Sheet. This effort is motivated by a\nsuccessful pilot project involving ringed seals in two Greenland fjords\nthis past summer. The pilot proved the viability of the technique, which\nmakes use of ringed seals who spend the majority of their time in such\nfjords and who may be appropriately equipped with integrated,\nlocation-tracking, CTD, and satellite communication instrumentation. The\nobservations, which will be collected in partnership with colleagues at\nthe Greenland Institute of Natural Resources, will be archived in\nnational data bases, on a project website, and made widely available to\nothers in near real-time. This project will address a currently missing,\ncritical component of the Arctic Observing Network, namely observations\nof ocean temperatures and salinities along the periphery of the\nGreenland Ice Sheet. The methodology will lead to a practical,\nsustainable data stream for hydrographic properties in the notoriously\ndifficult to access regions of the Greenland inner fjords, thus further\nfilling out the overall Arctic Observing Network data portfolio. Such\nobservations are needed to develop improved physics that can\nsubsequently be directly used in IPCC class, coupled climate models. The\ndata collection will also be of immense value to researchers studying\nthe behavior of the ringed seals in Greenland. Virtually no behavioral\ndata exists for these seals in the ice-ocean fjords, and the project\ndata can be used to learn about the habitat and distribution of the\nseals, and ultimately of their possible vulnerability to climate\nchange.",
"citation": {
"text": "David Holland. (2018). Water temperature, salinity, and\nposition-geographic data taken from seal tags, in coastal Greenland\nfrom 2010-08-31 to 2012-05-14. Arctic Data\nCenter. urn:uuid:1f3f702f-9594-4293-8cbd-07932e54e8ed.",
"url": "https://arcticdata.io/catalog/view/urn%3Auuid%3A1f3f702f-9594-4293-8cbd-07932e54e8ed"
},
"title": "Water temperature, salinity, and position-geographic data taken from seal tags, in coastal Greenland from 2010-08-31 to 2012-05-14"
}
},
"seismograph_stations": {
"assets": {
"only": {
Expand Down Expand Up @@ -24770,6 +24790,49 @@
},
{
"children": [
{
"layer_cfg": {
"description": "Locaitons of seal tag measurements with temperature and salinity in coastal Greenland from 2010-08-31 to 2012-05-14.",
"id": "seal_tag_measurements",
"in_package": true,
"input": {
"asset": {
"id": "only"
},
"dataset": {
"id": "seal_tag_measurements"
}
},
"show": false,
"steps": [
{
"args": [
"ogr2ogr",
"-lco",
"ENCODING=UTF-8",
"-t_srs",
"EPSG:3413",
"-clipdst",
"{assets_dir}/latitude_shape_40_degrees.geojson",
"-makevalid",
"-s_srs",
"EPSG:4326",
"-oo",
"X_POSSIBLE_NAMES=Longitude",
"-oo",
"Y_POSSIBLE_NAMES=Latitude",
"{output_dir}/final.gpkg",
"{input_dir}/*.csv"
],
"type": "command"
}
],
"style": null,
"tags": [],
"title": "Seal tag water measurements"
},
"name": "seal_tag_measurements"
},
{
"children": [
{
Expand Down Expand Up @@ -26615,6 +26678,7 @@
"settings": {
"expand": false,
"order": [
":seal_tag_measurements",
"Undersea feature names",
"Seawater temperature (25km)",
"Seawater salinity (25km)",
Expand Down
54 changes: 54 additions & 0 deletions qgreenland/config/datasets/seal_tag_water_measurements.py
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we define a new dataset for the layer we're adding. I manually pulled this information directly from the ADC dataset landing page.

For our QGreenland-Net processing, this information can be extracted programmatically from the metadata.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from qgreenland.models.config.asset import HttpAsset
from qgreenland.models.config.dataset import Dataset

dataset = Dataset(
id="seal_tag_measurements",
assets=[
HttpAsset(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This dataset has just a single file (asset) we're interested in pulling (the ct71_0DV.csv). Note there are other files associated with the dataset on the ADC landing page, but we don't need those in QGreenland (e.g., a browse .png image).

id="only",
urls=[
"https://arcticdata.io/metacat/d1/mn/v2/object/urn%3Auuid%3A31162eb9-7e3b-4b88-948f-f4c99f13a83f",
],
),
],
metadata={
"title": "Water temperature, salinity, and position-geographic data taken from seal tags, in coastal Greenland from 2010-08-31 to 2012-05-14",
"abstract": (
"""This project involves a marine-mammal sensor-tagging
approach that will allow for sustained oceanographic observations along
the periphery of the Greenland Ice Sheet. This effort is motivated by a
successful pilot project involving ringed seals in two Greenland fjords
this past summer. The pilot proved the viability of the technique, which
makes use of ringed seals who spend the majority of their time in such
fjords and who may be appropriately equipped with integrated,
location-tracking, CTD, and satellite communication instrumentation. The
observations, which will be collected in partnership with colleagues at
the Greenland Institute of Natural Resources, will be archived in
national data bases, on a project website, and made widely available to
others in near real-time. This project will address a currently missing,
critical component of the Arctic Observing Network, namely observations
of ocean temperatures and salinities along the periphery of the
Greenland Ice Sheet. The methodology will lead to a practical,
sustainable data stream for hydrographic properties in the notoriously
difficult to access regions of the Greenland inner fjords, thus further
filling out the overall Arctic Observing Network data portfolio. Such
observations are needed to develop improved physics that can
subsequently be directly used in IPCC class, coupled climate models. The
data collection will also be of immense value to researchers studying
the behavior of the ringed seals in Greenland. Virtually no behavioral
data exists for these seals in the ice-ocean fjords, and the project
data can be used to learn about the habitat and distribution of the
seals, and ultimately of their possible vulnerability to climate
change."""
),
"citation": {
"text": (
"""David Holland. (2018). Water temperature, salinity, and
position-geographic data taken from seal tags, in coastal Greenland
from 2010-08-31 to 2012-05-14. Arctic Data
Center. urn:uuid:1f3f702f-9594-4293-8cbd-07932e54e8ed."""
),
"url": "https://arcticdata.io/catalog/view/urn%3Auuid%3A1f3f702f-9594-4293-8cbd-07932e54e8ed",
},
},
)
2 changes: 2 additions & 0 deletions qgreenland/config/layers/Oceanography/__settings__.py
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Beginning of the layer configuration. Each subdirectory under layers has a __settings__.py that defines layer and subgroup ordering. More info here.

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from qgreenland.models.config.layer_group import (
LayerGroupIdentifier,
LayerGroupSettings,
LayerIdentifier,
)

settings = LayerGroupSettings(
order=[
LayerIdentifier("seal_tag_measurements"),
LayerGroupIdentifier("Undersea feature names"),
LayerGroupIdentifier("Seawater temperature (25km)"),
LayerGroupIdentifier("Seawater salinity (25km)"),
Expand Down
31 changes: 31 additions & 0 deletions qgreenland/config/layers/Oceanography/seal_tag_measurements.py
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the configuration for the layer itself. This includes the layer title (what it'll be called in the QGIS layers panel), description, style (not currently defined here, but normally we add a style file for each dataset to make it look nice by default), the dataset/asset used as input to create the layer, and the steps required to make it QGreenland-ready.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from qgreenland.config.datasets.seal_tag_water_measurements import dataset
from qgreenland.config.helpers.steps.ogr2ogr import ogr2ogr
from qgreenland.models.config.layer import Layer, LayerInput

layer = Layer(
id="seal_tag_measurements",
title="Seal tag water measurements",
description=(
"""Locaitons of seal tag measurements with temperature and salinity in coastal Greenland from 2010-08-31 to 2012-05-14."""
),
tags=[],
in_package=True,
input=LayerInput(
dataset=dataset,
asset=dataset.assets["only"],
),
steps=[
*ogr2ogr(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This helper function runs ogr2ogr under the hood and includes default options that we normally want for all of our vector layers (e.g., reproject to our project projection). You can find the implementation for this helper here: https://github.com/nsidc/qgreenland/blob/main/qgreenland/config/helpers/steps/ogr2ogr.py#L18-L46

input_file="{input_dir}/*.csv",
output_file="{output_dir}/final.gpkg",
ogr2ogr_args=(
"-s_srs",
"EPSG:4326",
"-oo",
"X_POSSIBLE_NAMES=Longitude",
"-oo",
"Y_POSSIBLE_NAMES=Latitude",
),
),
],
)
Loading