Skip to content

Instantly share code, notes, and snippets.

View barronh's full-sized avatar

Barron H. Henderson barronh

View GitHub Profile
@barronh
barronh / conc2photdiag.py
Created July 17, 2026 17:57
conc2photdiag.py
__doc__ = """
INTEGRATE CMAQ Columns
======================
---
author: Barron H. Henderson
last-updated: 2026-07-17
---
Integrate columns from CMAQ using GRIDCRO2D, METCRO3D, and CONC files.
@barronh
barronh / animate_airfuse.py
Created July 10, 2026 12:45
Animate AirFuse
__doc__ = """
Requires pycno, pandas, matplotlib, xarray and the airnowcompare.py gist.
pip install pycno pyproj pandas matplotlib xarray
wget -N https://gist.githubusercontent.com/barronh/945df1b465905b0f5454258b317cee1b/raw/airnowcompare.py
"""
import airnowcompare
import pycno
import pandas as pd
import matplotlib.animation as ani
@barronh
barronh / get_temposubset.py
Created July 8, 2026 21:20
Harmony TEMPO Subset
#!/usr/bin/python
__doc__ = """
Relies on NASA credentials in .netrc and tested with
harmony-py==1.3.4
pandas==2.3.1
"""
import logging
from harmony import BBox, Client, Collection, Request, Environment
import os
import pandas as pd
@barronh
barronh / nasa_gibs_colormaps.py
Last active June 9, 2026 14:47
NASA GIBS Colormaps for Python
def xmlcmap2cmap(xmlcmap):
import numpy as np
import matplotlib.colors as mc
inf = np.inf
nan = np.nan
for elem in xmlcmap:
if elem.tag == 'Entries':
los = []
his = []
rgbs = []
@barronh
barronh / cmaq_gdal_translate.sh
Last active June 2, 2026 15:50
GDAL Convert CMAQ to GeoTIFF
#!/usr/bin/env bash
INPATH=${1?Required input CMAQ File}
if [[ ${INPATH} == "-h" || ${INPATH} == "--help" ]]; then
echo $0 [-h] INPATH INVAR [OUTPATH]
echo "Convert CMAQ IOAPI meta data to SRS and create raster using gdal_translate"
echo " -h --help: print this help menu"
echo " INPATH : path to CMAQ input/output file"
echo " INVAR : name of variable in INPATH"
echo " OUTPATH : Path for output raster (default: INPATH_INVAR.tif)"
exit
@barronh
barronh / epacolors.py
Created November 7, 2025 16:06
matplotlib aqi colorscale
def get_epacmapnorm(spc, freq):
"""
Arguments
---------
spc : str
choices 'pm25' or 'o3'
freq : str
choices '1h', '24h' (pm-only), '8h' (o3-only), 'mda8' (o3-only)
Returns
@barronh
barronh / cmaq2geotiff.py
Created September 5, 2025 14:28
CMAQ to GeoTIFF
"""
# Convert a CMAQ IOAPI File to a GeoTiff
---
author: Barron H. Henderson
last updated: 2025-09-05
---
Demonstrates converting a CMAQ file to a GeoTiff. GeoTiff is useful for ArcGIS or QGIS.
@barronh
barronh / csv2inln.py
Created May 23, 2025 20:10
Convert a CSV File into a CMAQ-ready point source files.
__all__ = ['open_griddesc', 'csv2inln', 'templatecsv']
__doc__ = """
csv2inln
========
This module is meant to help make CMAQ-ready point source emission files from
a CSV file. By default, the emissions are time-independent for a day. However,
a tfactor_utc variable can be supplied to add a diurnal scaling factor.
Prerequisites
@barronh
barronh / README.md
Last active May 22, 2025 17:59
EQUATES Evaluation

EQUATES Evaluation Quick Hits

@barronh
barronh / airnowcompare.py
Last active April 26, 2025 15:08
Compare AirNow and NAQFC
__version__ = "1.0.0"
__all__ = ['open_remote', 'open_naqfc', 'open_airnow', 'open_airfuse']
__doc__ = """
Utility for Comparing AirNow Surfaces
=====================================
Using AirNow grib2 AQI files as reference. Can compare to NAQFC from NOAA or
the AirFuse from AirNow. For simplicity, NAQFC and AirFuse are converted to
a Nowcast by averaging the last 3 time steps. The Nowcast is then put into AQI
units for comparison.