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

add WIS2 GDC practical exercise #120

Merged
merged 1 commit into from
Oct 9, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
title: Discovering datasets from the WIS2 Global Discovery Catalogue
---

# Discovering datasets from the WIS2 Global Discovery Catalogue

!!! abstract "Learning outcomes!"

By the end of this practical session, you will be able to:

- use pywiscat to discover datasets from the Global Discovery Catalogue

## Introduction

In this session you will learn how to discover data from the WIS2 Global Discovery Catalogue (GDC).

At the moment, the following GDCs are available:

- Environment and Climate Change Canada, Meteorological Service of Canada: <https://wis2-gdc.weather.gc.ca>
- China Meteorological Administration: <https://gdc.wis.cma.cn/api>
- Deutscher Wetterdienst: <https://wis2.dwd.de/gdc>

For this exercise, we will use the WIS2 GDC setup as part of the training, found at <http://192.168.7.153>.

## Preparation

!!! note
Before starting please login to your student VM.

## Installing pywiscat

Use the `pip3` Python package installer to install pywiscat on your VM:
```bash
pip3 install pywiscat
```

Verify that the installation was successful:

```bash
pywiscat --version
```

## Finding data with pywiscat

By default, pywiscat connects to Canada's Global Discovery Catalogue. Let's configure pywiscat to query the training GDC by setting the `PYWISCAT_GDC_URL` environment variable:

```bash
export PYWISCAT_GDC_URL=http://192.168.7.153
```

Let's use [pywiscat](https://github.com/wmo-im/pywiscat) to query the GDC setup as part of the training.

```bash
pywiscat search --help
```

Now search the GDC for all records:

```bash
pywiscat search
```

!!! question

How many records are returned from the search?

??? success "Click to reveal answer"
There should be over 40 records returned

Let's try querying the GDC with a keyword:

```bash
pywiscat search -q observations
```

!!! question

What is the data policy of the results?

??? success "Click to reveal answer"
All data returned should specify "core" data

Try additional queries with `-q`

!!! tip

The `-q` flag allows for the following syntax:

- `-q synop`: find all records with the word "synop"
- `-q temp`: find all records with the word "temp"
- `-q "observations AND fiji"`: find all records with the words "observations" and "fiji"
- `-q "observations NOT fiji"`: find all records that contain the word "observations" but not the word "fiji"
- `-q "synop OR temp"`: find all records with both "synop" or "temp"
- `-q "obs~"`: fuzzy search

When searching for terms with spaces, enclose in double quotes.

Let's get more details on a specific search result that we are interested in:

```bash
pywiscat get <id>
```

!!! tip

Use the `id` value from the previous search.


## Conclusion

!!! success "Congratulations!"

In this practical session, you learned how to:

- use pywiscat to discover datasets from the WIS2 Global Discovery Catalogue

1 change: 1 addition & 0 deletions documentation/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ nav:
- Adding GTS-headers to WIS2 notifications: practical-sessions/adding-gts-headers-to-wis2-notifications.md
- Setting up a recommended dataset with access control: practical-sessions/datasets-with-access-control.md
- Downloading data from WIS2: practical-sessions/downloading-data-from-wis2.md
- Discovering datasets from the WIS2 Global Discovery Catalogue: practical-sessions/discovering-datasets-from-wis2-gdc.md
#- Querying data using the wis2box API: practical-sessions/querying-data-using-the-wis2box-api.md
#- Working with BUFR data: practical-sessions/bufr-command-line-tools.md
- Cheatsheets:
Expand Down
Loading