@@ -7,25 +7,26 @@ from the workbench or Globus.
77## Getting started
88
99After installing terrautils, you should be able to import the * product* module.
10- ```
10+ ``` {python}
1111from terrautils.products import get_sensor_list, unique_sensor_names
1212from terrautils.products import get_file_listing, extract_file_paths
1313```
1414
15- The get \_ sensor \_ list and get \_ file \_ listing both require connection, url,
15+ The ` get_sensor_list ` and ` get_file_listing ` functions both require connection, url,
1616and key parameters. * Connection* can be 'None', the * url* (called host in the
1717code) should be something like https://terraref.ncsa.illinois.edu/clowder/ .
1818The * key* is a unique access key for the Clowder api.
1919
2020## Getting the sensor list
21+
2122The first thing to get is the sensor name. This can be retreived using the
22- get \_ sensor \_ list function. This function returns the full record which may
23+ ` get_sensor_list ` function. This function returns the full record which may
2324be useful in some cases but primarily includes sensor names that include
24- a plot id number. The utility function unique_sensor_names accpets the
25+ a plot id number. The utility function ` unique_sensor_names ` accpets the
2526sensor list and provides a list of names suitable for use in the
26- get_file_listing function.
27+ ` get_file_listing ` function.
2728
28- ```
29+ ``` {python}
2930sensors = get_sensor_list(None, url, key)
3031names = unique_sensor_names(sensors)
3132```
@@ -36,16 +37,16 @@ geostreams API. The currently available sensors are:
3637* IR Surface Temperature
3738* Thermal IR GeoTIFFs Datasets
3839* flirIrCamera Datasets
39- * (EL) sensor \_ weather \_ station
40+ * (EL) sensor_weather_station
4041* Irrigation Observations
4142* Canopy Cover
4243* Energy Farm Observations SE
43- * (EL) sensor \_ par
44+ * (EL) sensor_par
4445* scanner3DTop Datasets
4546* Weather Observations
4647* Energy Farm Observations NE
4748* RGB GeoTIFFs Datasets
48- * (EL) sensor \_ co2
49+ * (EL) sensor_co2
4950* stereoTop Datasets
5051* Energy Farm Observations CEN
5152
@@ -55,28 +56,30 @@ The geostreams API can be used to get a list of datasets that overlap a
5556specific plot boundary and, optionally, limited by a time range. Iterating
5657over the datasets allows the paths to all the files to be extracted.
5758
58- ```
59+ ``` {python}
5960sensor = 'Thermal IR GeoTIFFs Datasets'
6061sitename = 'MAC Field Scanner Season 1 Field Plot 101 W'
6162datasets = get_file_listing(None, url, key, sensor, sitename)
6263files = extract_file_paths(datasets)
6364```
6465
6566Datasets can be further filtered using the * since* and * until* parameters
66- of get \_ file \_ listing with a date string.
67+ of ` get_file_listing ` with a date string.
6768
68- ```
69+ ``` {python}
6970dataset = get_file_listing(None, url, key, sensor, sitename,
7071 since='2016-06-01', until='2016-06-10')
7172```
7273
7374
7475# Alternative method
76+
7577The following method demonstrates the same approach using the Clowder API. This
7678approach is useful for understanding the data layout and when the Python
7779terrautils package is not available.
7880
7981## Finding plot ID
82+
8083```
8184SENSOR_NAME = "MAC Field Scanner Season 1 Field Plot 101 W"
8285GET https://terraref.ncsa.illinois.edu/clowder/api/geostreams/sensors?sensor_name={SENSOR_NAME}
@@ -85,7 +88,9 @@ GET https://terraref.ncsa.illinois.edu/clowder/api/geostreams/sensors?sensor_nam
8588This returns a JSON object with an 'id' parameter. You can use this ID parameter to specify the right data stream.
8689
8790## Finding stream ID within a plot
91+
8892The names are formatted as "<Sensor Group > Datasets (<Sensor ID >)".
93+
8994```
9095SENSOR_ID = 3355
9196STREAM_NAME = "Thermal IR GeoTIFFs Datasets ({SENSOR_ID})"
@@ -95,13 +100,15 @@ GET https://terraref.ncsa.illinois.edu/clowder/api/geostreams/streams?stream_nam
95100This returns a JSON object with an 'id' parameter. You can use this ID parameter to get the right datapoints.
96101
97102## Listing Clowder file IDs for that plot & sensor stream
103+
98104```
99105STREAM_ID = "11586"
100106GET https://terraref.ncsa.illinois.edu/clowder/api/geostreams/datapoints?stream_id={STREAM_ID}
101107```
102108
103109This returns a list of datapoint JSON objects, each with a 'properties' parameter that looks like:
104- ```
110+
111+ ``` {python}
105112properties: {
106113 dataset_name: "Thermal IR GeoTIFFs - 2016-05-09__12-07-57-990",
107114 source_dataset: "https://terraref.ncsa.illinois.edu/clowder/datasets/59fc9e7d4f0c3383c73d2905"
@@ -111,19 +118,23 @@ properties: {
111118The source_dataset URL can be used to view the dataset in Clowder.
112119
113120You can also filter the datapoints by date:
121+
114122```
115123GET https://terraref.ncsa.illinois.edu/clowder/api/geostreams/datapoints?stream_id={STREAM_ID}&since=2017-01-02&until=2017-06-10
116124```
117125
118126## Getting ROGER file path from dataset
127+
119128Given a source dataset URL, we can call the API to get the files and their paths.
129+
120130```
121131SOURCE_DATASET = "https://terraref.ncsa.illinois.edu/clowder/datasets/59fc9e7d4f0c3383c73d2905"
122132# Add /api after /clowder, and add /files at the end of the URL
123133GET "https://terraref.ncsa.illinois.edu/clowder/api/datasets/59fc9e7d4f0c3383c73d2905/files"
124134```
125135
126136This returns a list of files in the dataset and their paths if available:
137+
127138```
128139[
129140 {
0 commit comments