This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# 2021-12-21 | |
# B. Malevich <[email protected]> | |
# Launch Argo Workflow end-to-end runs with various parameter files. | |
set -e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get tasmin, tasmax parameter files for each GCM and combine to create DTR parameter file. | |
# This is all rough and likely to break. Sorry. | |
import logging | |
import pathlib | |
import dearprudence | |
import dearprudence.validation | |
PARAMS_DIR = pathlib.Path("/Users/bmalevich/Projects/downscaleCMIP6/workflows/parameters") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# 2021-11-22 | |
# B. Malevich <[email protected]> | |
# Launch Argo Workflow end-to-end runs with various parameter files. | |
set -e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Idea to quickly test that QPLAD adjustment factors (AF) and quantiles are matched correctly. | |
This uses ``dodola`` https://github.com/ClimateImpactLab/dodola/tree/f331623dfaffd3d341d27a3bc36f156646c3620f | |
""" | |
import numpy as np | |
import xarray as xr | |
from dodola.core import ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Example python and numpy function to get the 'inverse longitude' from opposite global hemisphere, from -180 to 180. | |
""" | |
import numpy as np | |
def wraparound_lon(x): | |
"""Get the 'inverse longitude' from opposite global hemisphere, from -180 to 180. | |
I'm not sure what the proper term for this is. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xarray as xr | |
def add_cyclic(ds, dim): | |
""" | |
Adds wrap-around, appending first value to end of data for named dimension. | |
Basically an xarray version of ``cartopy.util.add_cyclic_point()``. | |
""" | |
return ds.map( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove duplicate objects in a JSON file. | |
import json | |
INPATH = "offending.json" | |
OUTPATH = "corrected.json" | |
with open(INPATH, "r") as fl: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# Remove EXIF metadata from IMG_*.jpg files in directory. | |
# Write as 70% *_clean.jpg in same directory. | |
for f in IMG_*.jpg | |
do | |
echo "Processing $f" | |
echo "Writing ${f%.*}_clean.jpg" | |
convert "${f}" -quality 70% -strip "${f%.*}_clean.jpg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Demo using cartopy.util.add_cyclic_point with an xarray Dataset to | |
add a cyclic or wrap-around pixel to the `lon` dimension. This can be useful | |
for plotting with `cartopy` or regridding with `xesmf`. | |
""" | |
import xarray as xr | |
from cartopy.util import add_cyclic_point | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Intake Catalog for the workflow in-progress | |
plugins: | |
source: [ module: intake_xarray ] | |
sources: | |
cmip6_raw: | |
description: Catalog of raw CMIP6 GCM data to be cleaned and prepared | |
metadata: | |
title: Raw CMIP6 GCM data | |
parameters: | |
source_id: |