Skip to content

Commit

Permalink
Update code snippets and output
Browse files Browse the repository at this point in the history
  • Loading branch information
corentinmusard committed Aug 23, 2024
1 parent 8dd71f9 commit 969099b
Show file tree
Hide file tree
Showing 7 changed files with 326 additions and 273 deletions.
4 changes: 2 additions & 2 deletions api-reference/datasets/accessing-dataset.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Once you have listed all available datasets, you can access a specific dataset b
<RequestExample>

```python Python (Sync)
dataset = datasets.open_data.asf.sentinel1_sar
dataset = datasets.open_data.copernicus.sentinel1_sar
# or any other dataset available to you
```

```python Python (Async)
dataset = datasets.open_data.asf.sentinel1_sar
dataset = datasets.open_data.copernicus.sentinel1_sar
# or any other dataset available to you
```

Expand Down
Binary file added assets/data/example_satellite_data.nc
Binary file not shown.
40 changes: 22 additions & 18 deletions datasets/collections.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,24 @@ Each dataset has a list of collections associated with it. You can list the coll
<CodeGroup>

```python Python (Sync)
dataset = datasets.open_data.asf.sentinel1_sar
dataset = datasets.open_data.copernicus.landsat8_oli_tirs
collections = dataset.collections()
print(collections)
```

```python Python (Async)
dataset = datasets.open_data.asf.sentinel1_sar
dataset = datasets.open_data.copernicus.landsat8_oli_tirs
collections = await dataset.collections()
print(collections)
```

</CodeGroup>

```txt Output
{'Sentinel-1A': Collection Sentinel-1A: [2014-06-15T03:44:43.000 UTC, 2022-12-31T23:57:59.000 UTC] (1209636 data points),
'Sentinel-1B': Collection Sentinel-1B: [2016-09-26T00:02:34.000 UTC, 2021-12-23T06:53:08.000 UTC] (657674 data points)}
{'L1GT': Collection L1GT: [2013-03-25T12:08:43.699 UTC, 2024-08-19T12:57:32.456 UTC],
'L1T': Collection L1T: [2013-03-26T09:33:19.763 UTC, 2020-08-24T03:21:50.000 UTC],
'L1TP': Collection L1TP: [2013-03-24T00:25:55.457 UTC, 2024-08-19T12:58:20.229 UTC],
'L2SP': Collection L2SP: [2015-01-01T07:53:35.391 UTC, 2024-08-12T12:52:03.243 UTC]}
```

The `collections` variable is a dictionary, where the keys are the names of the collections and the values are
Expand All @@ -79,22 +81,24 @@ method.
<CodeGroup>

```python Python (Sync)
dataset = datasets.open_data.asf.sentinel1_sar
dataset = datasets.open_data.copernicus.landsat8_oli_tirs
collections = dataset.collections(availability=True, count=True)
print(collections)
```

```python Python (Async)
dataset = datasets.open_data.asf.sentinel1_sar
dataset = datasets.open_data.copernicus.landsat8_oli_tirs
collections = await dataset.collections(availability=True, count=True)
print(collections)
```

</CodeGroup>

```txt Output
{'Sentinel-1A': Collection Sentinel-1A: [2014-06-15T03:44:43.000 UTC, 2022-12-31T23:57:59.000 UTC] (1209636 data points),
'Sentinel-1B': Collection Sentinel-1B: [2016-09-26T00:02:34.000 UTC, 2021-12-23T06:53:08.000 UTC] (657674 data points)}
{'L1GT': Collection L1GT: [2013-03-25T12:08:43.699 UTC, 2024-08-19T12:57:32.456 UTC] (154288 data points),
'L1T': Collection L1T: [2013-03-26T09:33:19.763 UTC, 2020-08-24T03:21:50.000 UTC] (87958 data points),
'L1TP': Collection L1TP: [2013-03-24T00:25:55.457 UTC, 2024-08-19T12:58:20.229 UTC] (322041 data points),
'L2SP': Collection L2SP: [2015-01-01T07:53:35.391 UTC, 2024-08-12T12:52:03.243 UTC] (191110 data points)}
```

## Accessing individual collections
Expand All @@ -108,22 +112,22 @@ You can then use the `info()` method on the collection object to get information

```python Python (Sync)
collections = dataset.collections()
sat1 = collections["Sat-1"]
collection_info = sat1.info(availability=True, count=True)
terrain_correction = collections["L1GT"]
collection_info = terrain_correction.info(availability=True, count=True)
print(collection_info)
```

```python Python (Async)
collections = await dataset.collections()
sat1 = collections["Sat-1"]
collection_info = await sat1.info(availability=True, count=True)
terrain_correction = collections["L1GT"]
collection_info = await terrain_correction.info(availability=True, count=True)
print(collection_info)
```

</CodeGroup>

```txt Output
Collection Sat-1: [2019-03-07T16:09:17.773000 UTC, 2021-05-23T19:17:23.472000 UTC] (910245 data points)
L1GT: [2013-03-25T12:08:43.699 UTC, 2024-08-19T12:57:32.456 UTC] (154288 data points)
```

You can also access a specific collection by using the `collection` method on the dataset object as well.
Expand All @@ -132,21 +136,21 @@ This has the advantage that you can directly access the collection without havin
<CodeGroup>

```python Python (Sync)
sat1 = dataset.collection("Sat-1")
collection_info = sat1.info(availability=True, count=True)
terrain_correction = dataset.collection("L1GT")
collection_info = terrain_correction.info(availability=True, count=True)
print(collection_info)
```

```python Python (Async)
sat1 = dataset.collection("Sat-1")
collection_info = await sat1.info(availability=True, count=True)
terrain_correction = dataset.collection("L1GT")
collection_info = await terrain_correction.info(availability=True, count=True)
print(collection_info)
```

</CodeGroup>

```txt Output
Collection Sat-1: [2019-03-07T16:09:17.773000 UTC, 2021-05-23T19:17:23.472000 UTC] (910245 data points)
L1GT: [2013-03-25T12:08:43.699 UTC, 2024-08-19T12:57:32.456 UTC] (154288 data points)
```

## Errors you may encounter
Expand Down
Loading

0 comments on commit 969099b

Please sign in to comment.