Skip to content

Commit 1666ee6

Browse files
committed
Add docs
1 parent f4e1f52 commit 1666ee6

3 files changed

Lines changed: 68 additions & 0 deletions

File tree

docs/contributing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ If you are working elsewhere, you may need to modify the paths slightly.
107107
e.g. `bash scripts/pmount-database-generation/db-add-tree.sh /PATH-TO-DATA-ROOT/input4MIPs/CMIP6Plus/CMIP/UofMD/`.
108108
On perlmutter, this is something like
109109
`bash scripts/pmount-database-generation/db-add-tree.sh /global/cfs/projectdirs/m4931/gsharing/user_pub_work/input4MIPs/...`
110+
1. Update the direct download links.
111+
Do this by running the following command from the root of this repository:
112+
`python direct-download-info/generate-direct-download-links.py <root-of-tree-to-generate-from>`
113+
e.g. `python direct-download-info/generate-direct-download-links.py /data/store/input4MIPs/CMIP7`
114+
On perlmutter, this is something like
115+
`python direct-download-info/generate-direct-download-links.py /global/cfs/projectdirs/m4931/gsharing/user_pub_work/input4MIPs/CMIP7`.
110116
1. (Not compulsory, but recommended because it makes it easier to see changes later)
111117
Commit the changes to the database
112118
1. If needed, add the source ID entry for the new files to `CVs/input4MIPs_source_id.json`

docs/direct-download-links.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Direct download links
2+
3+
There have been some issues accessing the data via metagrid.
4+
Here we demonstrate how direct download links can be obtained from the links provided in
5+
[github.com/PCMDI/input4MIPs_CVs/blob/main/direct-download-info/direct-download-info.json](https://github.com/PCMDI/input4MIPs_CVs/blob/main/direct-download-info/direct-download-info.json).
6+
We will attempt to keep this file up-to-date as files are published
7+
as a backup to finding files via metagrid
8+
or globus (see [https://app.globus.org/file-manager?origin_id=904ff241-867c-404e-b355-64b701ba6ac1&origin_path=%2Fuser_pub_work%2Finput4MIPs%2FCMIP7%2F](https://app.globus.org/file-manager?origin_id=904ff241-867c-404e-b355-64b701ba6ac1&origin_path=%2Fuser_pub_work%2Finput4MIPs%2FCMIP7%2F)).
9+
10+
To get your direct download links, a script like the following will work.
11+
12+
```python
13+
import json
14+
import urllib.request
15+
16+
direct_download_info_url = "https://raw.githubusercontent.com/PCMDI/input4MIPs_CVs/refs/heads/direct-download-links/direct-download-info/direct-download-info.json"
17+
with urllib.request.urlopen(direct_download_info_url) as response:
18+
raw_response = response.read()
19+
direct_download_info = json.loads(raw_response)
20+
21+
data_of_interest = [
22+
v for v in direct_download_info if v["source_id"] == "FZJ-CMIP-ozone-vl-1-0"
23+
]
24+
download_links = [v["download_link"] for v in data_of_interest]
25+
print("You can then download the links with your tool of choice")
26+
for dl in download_links:
27+
print(f"- {dl}")
28+
```
29+
30+
At the time of writing, this produced the following output
31+
32+
```sh
33+
You can then download the links with your tool of choice
34+
- https://esgf-node.ornl.gov/thredds/fileServer/user_pub_work/input4MIPs/CMIP7/ScenarioMIP/FZJ/FZJ-CMIP-ozone-vl-1-0/atmos/mon/zmta/gn/v20260409/zmta_input4MIPs_ozone_ScenarioMIP_FZJ-CMIP-ozone-vl-1-0_gn_202201-210012.nc
35+
- https://esgf-node.ornl.gov/thredds/fileServer/user_pub_work/input4MIPs/CMIP7/ScenarioMIP/FZJ/FZJ-CMIP-ozone-vl-1-0/atmos/mon/vmro3/gn/v20260409/vmro3_input4MIPs_ozone_ScenarioMIP_FZJ-CMIP-ozone-vl-1-0_gn_206001-210012.nc
36+
- https://esgf-node.ornl.gov/thredds/fileServer/user_pub_work/input4MIPs/CMIP7/ScenarioMIP/FZJ/FZJ-CMIP-ozone-vl-1-0/atmos/mon/vmro3/gn/v20260409/vmro3_input4MIPs_ozone_ScenarioMIP_FZJ-CMIP-ozone-vl-1-0_gn_202201-205912.nc
37+
```
38+
39+
If you're familiar with [pandas](https://pandas.pydata.org/),
40+
you can also make your data exploration slightly more straightforward
41+
with code like the below
42+
43+
```python
44+
import pandas as pd
45+
46+
# Building on the code above
47+
# (you can also initialise the DataFrame directly from the URL if you wish)
48+
direct_download_info_df = pd.DataFrame(direct_download_info)
49+
50+
# For example
51+
direct_download_info_df[
52+
(direct_download_info_df["source_id"] == "CR-vl-1-1-0")
53+
& (direct_download_info_df["variable_id"] == "co2")
54+
]
55+
direct_download_info_df[
56+
(direct_download_info_df["source_id"] == "CR-vl-1-1-0")
57+
& (direct_download_info_df["frequency"] == "yr")
58+
& (direct_download_info_df["variable_id"] == "co2")
59+
& (direct_download_info_df["grid_label"] == "gm")
60+
]
61+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ nav:
4040
- Source ID-level CMIP7Plus: database-views/input4MIPs_source-id_CMIP7Plus.html
4141
- Dataset-level CMIP7Plus: database-views/input4MIPs_datasets_CMIP7Plus.html
4242
- File-level CMIP7Plus: database-views/input4MIPs_files_CMIP7Plus.html
43+
- Direct download links: direct-download-links.md
4344
- Archive of email updates sent by CMIP IPO: forcings-email-archive/
4445
- Extracting scenario from source ID: extracting-scenario-from-source-id.md
4546
- Source ID landing pages: source-id-landing-pages/

0 commit comments

Comments
 (0)