Skip to content

Instantly share code, notes, and snippets.

View barronh's full-sized avatar

Barron H. Henderson barronh

View GitHub Profile
@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.
@barronh
barronh / gridcensus.py
Last active April 18, 2025 16:52
Create gridded CENSUS metrics that are useful for Health Benefit Assessments
__doc__ = """
Grid US Census Demographic Profile
==================================
Produce gridded TIGER Demographic Profile files for a subset of variables in
the an American Community Survey from either a 1-year or 5-year input files.
Requires:
- python>=3.7
- numpy
@barronh
barronh / quicksummary.py
Last active April 24, 2025 22:41
Summary of Criteria or Hazardous Air Pollutants by 60 EIS sectors.
__doc__ = """
NEI Emission Summary
====================
---
author: Barron H. Henderson
last updated: 2025-04-17
---
Simple script to get Criteria or Hazardous Air Pollutants by 60 EIS emission
@barronh
barronh / README.md
Last active April 9, 2025 17:40
Monitor Coverage

#0000000001111111111222222222233333333334444444444555555555566666666667777777777 #1234567890123456789012345678901234567890123456789012345678901234567890123456789

County and Population Coverge of Monitors

The incomplete spatial coverage of monitors is a good motivation for data fusion. Monitors cover less than 30% of US counties, but more like 70% of the population. This is because dense populations often coincide with sources of polution and, therefore, are better monitored. The precise coverage of

@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;