Skip to content

Instantly share code, notes, and snippets.

View barronh's full-sized avatar

Barron H. Henderson barronh

View GitHub Profile
@barronh
barronh / tempo_cloudrasterformat.ipynb
Created March 26, 2025 20:40
TEMPO_CloudRasterFormat.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barronh
barronh / emgsatemis.py
Created March 12, 2025 13:20
Satellite Derived Emissions from Exponentially Modified Gaussian
__version__ = '0.2.0'
__doc__ = """EMG Satellite-derived Emissions
===============================
EMG Satellite-derived Emissions (emgsatemis) is designed to estimate emissions
from satellite data following many previous studies based on Bierle et al.
Functions:
- to_polar(x, y, degrees=False)
- to_cartesian(r, alpha, theta=0, degrees=False)
@barronh
barronh / ember.py
Last active February 12, 2025 13:40
Plots from EMBER
__version__ = '0.1.0'
__doc__ = """
Demonstrating how to work with EMBER files from doi:10.5281/zenodo.13737754
Requires requests, xarray, pandas, netcdf4, pyproj, pycno, and pyrsig
For example, install with pip:
python -m pip install -qq xarray pandas netcdf4 pyproj pycno pyrsig
Functions
@barronh
barronh / matplotlibjs.html
Created January 14, 2025 17:31
matplotib-like basic plotting in javascript
<html>
<head>
<script>
class Axes {
constructor(axname, xmin, xmax, ymin, ymax, wm=0.1, hm=0.1) {
this.axname = axname
var canvas = document.getElementById(this.axname);
var ctx = canvas.getContext("2d");
this.ctx = ctx;
this.w = canvas.width;
@barronh
barronh / cfcsv.py
Last active December 31, 2024 21:33
Climate Forecasting CSV
__version__ = '0.1.0'
__doc__ = """
Contents
========
df2ds : function
convert pandas.DataFrame with properties to xarray.Dataset
ds2df : function
convert xarray.Dataset to pandas.DataFrame with properties
read_csv : function
@barronh
barronh / tempocmaq.py
Last active December 4, 2024 13:51
CMAQ AMFs for TEMPO
__version__ = '0.3.1'
__doc__ = """
CMAQ AMF calculator
===================
---
author: Barron H. Henderson
last updated: 2024-12-03
---
@barronh
barronh / pmnowcast.py
Last active November 21, 2024 19:14
Python PM Nowcast
def pmnowcast(x, mdl=0):
"""
Arguments
---------
x : array-like
Should be 12-hours of particulate matter
Returns
-------
nc : array-like
@barronh
barronh / geoschem_atombalance.ipynb
Created June 26, 2024 14:17
GEOSChem_AtomBalance.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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.