|
| 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 | +``` |
0 commit comments