Skip to content

Instantly share code, notes, and snippets.

View barronh's full-sized avatar

Barron H. Henderson barronh

View GitHub Profile
@barronh
barronh / animate_cmaq.py
Created June 5, 2024 10:16
CMAQ Animation
import time
import glob
import cmaqsatproc as csp
import matplotlib.pyplot as plt
import matplotlib.colors as mc
import matplotlib.animation as animation
import numpy as np
# Get a list of paths
pat = '/work/ROMO/2021_MP/cmaq54mp/2021hb_MP_cb6r5ae7_21k/12US1/output/CCTM_CGRID_2021hb_MP_cb6r5ae7_21k.12US1_35_2021010?.nc'
@barronh
barronh / cmaq2wrf.py
Last active June 4, 2024 18:33
CMAQ to WRF
__doc__ = """
# Make CMAQ WRF-Like
author: Barron H. Henderson
date: 2020-07-30
updated: 2024-06-04
# Overview
* Need: Many tools exist for WRFChem that we would like to use with CMAQ.
@barronh
barronh / tempo_geoxo_meeting.ipynb
Last active May 9, 2024 17:09
TEMPO_GeoXO_Meeting.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barronh
barronh / backup.py
Last active April 12, 2024 17:02
Backup Project Scripts
#!/usr/bin/env python
__doc__ = """
Overview
========
Module designed to make backups of scripts (.sh, .csh, .py), makefiles,
configuration files, and README files.
Contents
--------
@barronh
barronh / cmaq_dust.py
Last active April 23, 2024 16:07
Offline CMAQ Dust Emulator
__doc__ = """
Offline CMAQ Python WBD approximator
====================================
github.com/USEPA/CMAQ/emis/emis/DUST_EMIS.F routines and functions converted
from Fortran to Python. All modules are replaced by inline code and direct
access to MCIP files. The original DUST_EMIS.F was developed by Foroutan et
al. (https://dx.doi.org/10.1002/2016MS0008230.
To-Do:
@barronh
barronh / pair_rsigcmaq.py
Last active March 7, 2024 21:44
Pair RSIG data with CMAQ
__all__ = ['pair_rsigcmaq']
__doc__ = """
pair_rsigcmaq is designed to pair RSIG data with CMAQ files.
Example:
from pair_rsigcmaq import pair_rsigcmaq
import pandas a pd
outpath = pair_rsigcmaq('CMAQ_ACONC_20160101', 'O3', 'airnow.ozone')
@barronh
barronh / rundayenv.sh
Created March 6, 2024 16:17
Run Scripts with strftime to make day-specific environments from a template file.
#!/bin/bash
POSITIONAL_ARGS=()
PREFIX="ENV"
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
echo "Usage"
echo "-----"
echo " $0 [--prefix=PREFIX] TEMPLATE_ENV STARTDAY [ENDDAY [SCRIPT]]"
@barronh
barronh / cmaq_taylor_example.py
Last active February 7, 2024 14:32
Python Taylor Diagram
"""
This example calculates statistics for a single day from the EPA EQUATES CMAQ simulation for 2018-06-14
and creates a taylor diagram.
"""
import pyrsig
import pandas as pd
import pyproj
import taylordiagram as td
@barronh
barronh / hrrr.py
Created November 29, 2023 15:35
Retrieve HRRR via Open Data on AWS and Zarr
__doc__ = """
# Overview
This example shows how to open High Resolution Rapid Refresh (HRRR) meteorology
"surfaces." These surfaces are slices in vertical space to create single level
maps of variables like temperature, wind speed components, pressure, etc. Each
surface is opened using the Zarr archive described in Amazon's opendata registry
described at https://registry.opendata.aws/noaa-hrrr-pds/.
# Examples
@barronh
barronh / lonlatarea.py
Created October 5, 2023 14:05
Area on a regular lat/lon grid
__all__ = ['getarea']
def getarea(nlat, nlon, late=None, R=6371000.):
"""
Arguments
---------
nlat : int
Number of latitude bands
nlon : int