From faa8c113146c811a1c329ad86c15e4694ed73451 Mon Sep 17 00:00:00 2001 From: Max Burnette Date: Wed, 15 Nov 2017 15:37:27 -0600 Subject: [PATCH 1/2] add geostreams tutorial --- sensors/06-list-datasets-by-plot.md | 67 +++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sensors/06-list-datasets-by-plot.md diff --git a/sensors/06-list-datasets-by-plot.md b/sensors/06-list-datasets-by-plot.md new file mode 100644 index 0000000..c4ab6d9 --- /dev/null +++ b/sensors/06-list-datasets-by-plot.md @@ -0,0 +1,67 @@ +# Generating file lists by plot + +## Finding plot ID +``` +SENSOR_NAME = "MAC Field Scanner Season 1 Field Plot 101 W" +GET https://terraref.ncsa.illinois.edu/clowder/api/geostreams/sensors?sensor_name={SENSOR_NAME} +``` + +This returns a JSON object with an 'id' parameter. You can use this ID parameter to specify the right data stream. + +## Finding stream ID within a plot +The names are formatted as " Datasets ()". +``` +SENSOR_ID = 3355 +STREAM_NAME = "Thermal IR GeoTIFFs Datasets ({SENSOR_ID})" +GET https://terraref.ncsa.illinois.edu/clowder/api/geostreams/streams?stream_name={STREAM_NAME} +``` + +This returns a JSON object with an 'id' parameter. You can use this ID parameter to get the right datapoints. + +## Listing Clowder file IDs for that plot & sensor stream +``` +STREAM_ID = "11586" +GET https://terraref.ncsa.illinois.edu/clowder/api/geostreams/datapoints?stream_id={STREAM_ID} +``` + +This returns a list of datapoint JSON objects, each with a 'properties' parameter that looks like: +``` +properties: { + dataset_name: "Thermal IR GeoTIFFs - 2016-05-09__12-07-57-990", + source_dataset: "https://terraref.ncsa.illinois.edu/clowder/datasets/59fc9e7d4f0c3383c73d2905" +}, +``` + +The source_dataset URL can be used to view the dataset in Clowder. + +## Getting ROGER file path from dataset +Given a source dataset URL, we can call the API to get the files and their paths. +``` +SOURCE_DATASET = "https://terraref.ncsa.illinois.edu/clowder/datasets/59fc9e7d4f0c3383c73d2905" +# Add /api after /clowder, and add /files at the end of the URL +GET "https://terraref.ncsa.illinois.edu/clowder/api/datasets/59fc9e7d4f0c3383c73d2905/files" +``` + +This returns a list of files in the dataset and their paths if available: +``` +[ + { + size: "346069", + date-created: "Fri Nov 03 11:51:13 CDT 2017", + id: "59fc9e814f0c3383c73d2962", + filepath: "/home/clowder/sites/ua-mac/Level_1/ir_geotiff/2016-05-09/2016-05-09__12-07-57-990/ir_geotiff_L1_ua-mac_2016-05-09__12-07-57-990.png", + contentType: "image/png", + filename: "ir_geotiff_L1_ua-mac_2016-05-09__12-07-57-990.png" + }, + { + size: "1231298", + date-created: "Fri Nov 03 11:51:16 CDT 2017", + id: "59fc9e844f0c3383c73d2980", + filepath: "/home/clowder/sites/ua-mac/Level_1/ir_geotiff/2016-05-09/2016-05-09__12-07-57-990/ir_geotiff_L1_ua-mac_2016-05-09__12-07-57-990.tif", + contentType: "image/tiff", + filename: "ir_geotiff_L1_ua-mac_2016-05-09__12-07-57-990.tif" + } +] +``` + +Depending on permissions you may need to provide authentication to get this list. From 3accf02eafa06e3a776b4e7ec2fe4abeaee18dcd Mon Sep 17 00:00:00 2001 From: Max Burnette Date: Wed, 15 Nov 2017 15:41:23 -0600 Subject: [PATCH 2/2] add date filter --- sensors/06-list-datasets-by-plot.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sensors/06-list-datasets-by-plot.md b/sensors/06-list-datasets-by-plot.md index c4ab6d9..8e7d24c 100644 --- a/sensors/06-list-datasets-by-plot.md +++ b/sensors/06-list-datasets-by-plot.md @@ -34,6 +34,11 @@ properties: { The source_dataset URL can be used to view the dataset in Clowder. +You can also filter the datapoints by date: +``` +GET https://terraref.ncsa.illinois.edu/clowder/api/geostreams/datapoints?stream_id={STREAM_ID}&since=2017-01-02&until=2017-06-10 +``` + ## Getting ROGER file path from dataset Given a source dataset URL, we can call the API to get the files and their paths. ```