From 69d36c9c380dc6b2ecb048363d616a1cda7b5fb1 Mon Sep 17 00:00:00 2001 From: Robert Pincus Date: Mon, 20 Apr 2020 14:31:34 -0400 Subject: [PATCH] Updating comparision script for RFMIP example to fix broken link --- .../rfmip-clear-sky/compare-to-reference.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/rfmip-clear-sky/compare-to-reference.py b/examples/rfmip-clear-sky/compare-to-reference.py index 42d3039cc..f1b87e66c 100755 --- a/examples/rfmip-clear-sky/compare-to-reference.py +++ b/examples/rfmip-clear-sky/compare-to-reference.py @@ -10,8 +10,15 @@ import urllib.request tst_dir = "." -rrtmg_suffix = "_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc" +rrtmgp_suffix = "_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc" +# +# Construct URL for RTE+RRTMGP results for RFMIP from ESGF +# +def construct_esgf_file(var): + esgf_url_base = "http://esgf3.dkrz.de/thredds/fileServer/cmip6/RFMIP/RTE-RRTMGP-Consortium/RTE-RRTMGP-181204/rad-irf/r1i1p1f1/Efx/" + esgf_url_ver = "gn/v20191007/" + return (os.path.join(esgf_url_base, var, esgf_url_ver, var+rrtmgp_suffix)) # # Comparing reference and test results # @@ -30,21 +37,14 @@ vars = ['rlu', 'rld', 'rsu', 'rsd'] # Download reference data # If versions of all files exist in the reference directory, no need to download (can be over-ridden) - if not all([os.path.exists(os.path.join(args.ref_dir, v + rrtmg_suffix)) for v in vars]) or args.download_reference: + if not all([os.path.exists(os.path.join(args.ref_dir, v + rrtmgp_suffix)) for v in vars]) or args.download_reference: print("Dowloading reference data") os.makedirs(args.ref_dir, exist_ok=True) - urllib.request.urlretrieve("https://owncloud.gwdg.de/index.php/s/kbhl3JOSccGtR0m/download", \ - os.path.join(args.ref_dir, "rld_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc")) - urllib.request.urlretrieve("https://owncloud.gwdg.de/index.php/s/5DbhryVSfztioPG/download", \ - os.path.join(args.ref_dir, "rlu_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc")) - urllib.request.urlretrieve("https://owncloud.gwdg.de/index.php/s/uCemCHlGxbGK0gJ/download", \ - os.path.join(args.ref_dir, "rsd_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc")) - urllib.request.urlretrieve("https://owncloud.gwdg.de/index.php/s/l8ZG28j9ttZWD9r/download", \ - os.path.join(args.ref_dir, "rsu_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc")) - + for v in vars: + urllib.request.urlretrieve(construct_esgf_file(v), os.path.join(args.ref_dir, v+rrtmgp_suffix)) - tst = xr.open_mfdataset(os.path.join( tst_dir, "r??" + rrtmg_suffix), combine='by_coords') - ref = xr.open_mfdataset(os.path.join(args.ref_dir, "r??" + rrtmg_suffix), combine='by_coords') + tst = xr.open_mfdataset(os.path.join( tst_dir, "r??" + rrtmgp_suffix), combine='by_coords') + ref = xr.open_mfdataset(os.path.join(args.ref_dir, "r??" + rrtmgp_suffix), combine='by_coords') failed = False for v in vars: