# PYTHON

**URL:** https://forum.cmascenter.org/c/python/58.md

[Latest](https://forum.cmascenter.org/latest.md) · [Categories](https://forum.cmascenter.org/categories.md) · [Tags](https://forum.cmascenter.org/tags.md)

---

## [About the PYTHON category](https://forum.cmascenter.org/t/about-the-python-category/2560)

<div class="topic-metadata">

**Author:** [@lizadams](https://forum.cmascenter.org/u/lizadams)\
**Replies:** 0\
**Last updated:** [August 5, 2021, 4:49pm UTC](https://forum.cmascenter.org/t/about-the-python-category/2560 "2021-08-05T16:49:40Z")

</div>

Category to allow discussion and tracking of issues related to Python-based tools.

---

## [CAMx Python Examples](https://forum.cmascenter.org/t/camx-python-examples/6157)

<div class="topic-metadata">

**Author:** [@barronh](https://forum.cmascenter.org/u/barronh)\
**Replies:** 0\
**Last updated:** [March 4, 2026, 10:01pm UTC](https://forum.cmascenter.org/t/camx-python-examples/6157 "2026-03-04T22:01:21Z")

</div>

I recently updated some examples of using Python with CAMx are available that are mostly working for CMAQ too. I hope they are helpful to others. Includes: plotting (CMAQ or CAMx) gridded emission perturbations (CMA…

---

## [I want Tips on Using Python with CMAQ Outputs — Any suggestion?](https://forum.cmascenter.org/t/i-want-tips-on-using-python-with-cmaq-outputs-any-suggestion/5833)

<div class="topic-metadata">

**Author:** [@Catherine](https://forum.cmascenter.org/u/Catherine)\
**Replies:** 1\
**Last updated:** [June 3, 2025, 3:02pm UTC](https://forum.cmascenter.org/t/i-want-tips-on-using-python-with-cmaq-outputs-any-suggestion/5833 "2025-06-03T15:02:10Z")

</div>

Hey everyone, I am new to CMAQ & trying to get a better handle on analyzing model outputs using Python. I have seen a bunch of tools and scripts floating around but I am a bit overwhelmed on where to start when it comes…

---

## [AttributeError when running CMAQ\_DMS\_ChlorA.ipynb](https://forum.cmascenter.org/t/attributeerror-when-running-cmaq-dms-chlora-ipynb/5746)

<div class="topic-metadata">

**Author:** [@Huazhen](https://forum.cmascenter.org/u/Huazhen)\
**Replies:** 4\
**Last updated:** [May 7, 2025, 4:55pm UTC](https://forum.cmascenter.org/t/attributeerror-when-running-cmaq-dms-chlora-ipynb/5746 "2025-05-07T16:55:41Z")

</div>

Hi, The error is shown as the Figure. I’m new to python. I’d like to ask how to resolve this error. Thanks, Huazhen

---

## [OCEAN file with DMS and CHLO](https://forum.cmascenter.org/t/ocean-file-with-dms-and-chlo/5627)

<div class="topic-metadata">

**Author:** [@amin](https://forum.cmascenter.org/u/amin)\
**Replies:** 4\
**Last updated:** [March 21, 2025, 7:45pm UTC](https://forum.cmascenter.org/t/ocean-file-with-dms-and-chlo/5627 "2025-03-21T19:45:58Z")

</div>

I have a ocean file named ocean.txt that is in the attachment. I used: to add DMS and CHLO to this file. My new ocean file is in the attachment with name ocean\_new.txt. Then I compare the new ocean file with the ocea…

---

## [Custom CMAQ File from Python](https://forum.cmascenter.org/t/custom-cmaq-file-from-python/4563)

<div class="topic-metadata">

**Author:** [@barronh](https://forum.cmascenter.org/u/barronh)\
**Replies:** 0\
**Last updated:** [December 6, 2023, 3:45pm UTC](https://forum.cmascenter.org/t/custom-cmaq-file-from-python/4563 "2023-12-06T15:45:52Z")

</div>

Several different groups have reached out to me to find out how to quickly make an IOAPI-like file from custom data using Python. There are lots of ways to get this done – I am putting one online for reference. The scri…

---

## [Some useful examples](https://forum.cmascenter.org/t/some-useful-examples/2666)

<div class="topic-metadata">

**Author:** [@barronh](https://forum.cmascenter.org/u/barronh)\
**Replies:** 0\
**Last updated:** [September 24, 2021, 8:18pm UTC](https://forum.cmascenter.org/t/some-useful-examples/2666 "2021-09-24T20:18:13Z")

</div>

Hi Python users! I’m excited to be the first to post in the forum. Over the next couple weeks, I am going to post some python examples that can be useful for CAMx, CMAQ, and GEOS-Chem model pre and post processing. Toda…

---

## [Extracting text/info from a PDF file](https://forum.cmascenter.org/t/extracting-text-info-from-a-pdf-file/2937)

<div class="topic-metadata">

**Author:** [@bukim1](https://forum.cmascenter.org/u/bukim1)\
**Replies:** 0\
**Last updated:** [December 30, 2021, 1:22pm UTC](https://forum.cmascenter.org/t/extracting-text-info-from-a-pdf-file/2937 "2021-12-30T13:22:34Z")

</div>

This code reads a PDF file (see an example pdf input file below and the instruction) and parse texts to produce a list of monitor locations in a csv file. eanet\_site\_info\_pdf\_reader.py (3.5 KB) Note that pdfminder.six …

---

## [Heatmap Plotter](https://forum.cmascenter.org/t/heatmap-plotter/2936)

<div class="topic-metadata">

**Author:** [@bukim1](https://forum.cmascenter.org/u/bukim1)\
**Replies:** 0\
**Last updated:** [December 30, 2021, 12:36pm UTC](https://forum.cmascenter.org/t/heatmap-plotter/2936 "2021-12-30T12:36:39Z")

</div>

I am sharing a code that can be used to create “heatmap” plots to show data with two temporal scales (e.g., day of month vs month). MakeHeatmapPlot.py (7.1 KB) For plots with days of month, the code will handle the lea…

---

## [Shapefile creator for modeling domains](https://forum.cmascenter.org/t/shapefile-creator-for-modeling-domains/2678)

<div class="topic-metadata">

**Author:** [@bukim1](https://forum.cmascenter.org/u/bukim1)\
**Replies:** 9\
**Last updated:** [December 16, 2021, 10:56pm UTC](https://forum.cmascenter.org/t/shapefile-creator-for-modeling-domains/2678 "2021-12-16T22:56:00Z")

</div>

Hi all modelers using (or will use) Python! I start posting some of my Python scripts (likely short ones) that help my routine tasks at my work. Today’s code is the 1st script. This script generates three shapefiles ba…

---

## ["4-panel" plot for emission data QA](https://forum.cmascenter.org/t/4-panel-plot-for-emission-data-qa/2838)

<div class="topic-metadata">

**Author:** [@bukim1](https://forum.cmascenter.org/u/bukim1)\
**Replies:** 0\
**Last updated:** [November 22, 2021, 3:59pm UTC](https://forum.cmascenter.org/t/4-panel-plot-for-emission-data-qa/2838 "2021-11-22T15:59:23Z")

</div>

four\_panel\_emission\_inventory\_qa\_plotter.20211122.py (21.4 KB) This script generates “4-panel” plots that can be used to review two emission scenarios. The script will produces PNG files and PDF files for each category …

---

## [netCDF Wrapper Library for Gridded I/O API-like files](https://forum.cmascenter.org/t/netcdf-wrapper-library-for-gridded-i-o-api-like-files/2778)

<div class="topic-metadata">

**Author:** [@james.beidler](https://forum.cmascenter.org/u/james.beidler)\
**Replies:** 3\
**Last updated:** [November 10, 2021, 1:58pm UTC](https://forum.cmascenter.org/t/netcdf-wrapper-library-for-gridded-i-o-api-like-files/2778 "2021-11-10T13:58:47Z")

</div>

This is a really simple wrapper for the python netCDF4 library designed mostly for manipulating gridded I/O API emissions files. It can also read in the GRIDDESC format to set grid dimensions and projections. I use this …

---

## [Monthly Average of AQS Data](https://forum.cmascenter.org/t/monthly-average-of-aqs-data/2782)

<div class="topic-metadata">

**Author:** [@barronh](https://forum.cmascenter.org/u/barronh)\
**Replies:** 3\
**Last updated:** [November 8, 2021, 2:28pm UTC](https://forum.cmascenter.org/t/monthly-average-of-aqs-data/2782 "2021-11-08T14:28:09Z")

</div>

Some one recently asked how to create monthly means from daily AQS data. Here’s an easy example that should work for any system with pandas and matplotlib. import pandas as pd import matplotlib.pyplot as plt YYYY = 201…

---

## [Jupyter Interface to AQS](https://forum.cmascenter.org/t/jupyter-interface-to-aqs/2760)

<div class="topic-metadata">

**Author:** [@barronh](https://forum.cmascenter.org/u/barronh)\
**Replies:** 0\
**Last updated:** [October 29, 2021, 6:52pm UTC](https://forum.cmascenter.org/t/jupyter-interface-to-aqs/2760 "2021-10-29T18:52:34Z")

</div>

The Jupyter Notebook linked below shows how to programmatically download AQS data using python. This can obviously be coupled with CMAQ or CAMx data for evaluation. https://gist.github.com/barronh/ce818df08c6efb03568596…

---

## [Python Multi-domain Plotter](https://forum.cmascenter.org/t/python-multi-domain-plotter/2759)

<div class="topic-metadata">

**Author:** [@barronh](https://forum.cmascenter.org/u/barronh)\
**Replies:** 0\
**Last updated:** [October 29, 2021, 6:49pm UTC](https://forum.cmascenter.org/t/python-multi-domain-plotter/2759 "2021-10-29T18:49:49Z")

</div>

The notebook linked below creates domain plots. It can be run in the cloud or on your machine. Or, you can copy the code and run as a script. The only information you need is the domain origins in LCC, the number of row…

---

## [Soccer plotter - Example](https://forum.cmascenter.org/t/soccer-plotter-example/2694)

<div class="topic-metadata">

**Author:** [@bukim1](https://forum.cmascenter.org/u/bukim1)\
**Replies:** 0\
**Last updated:** [October 8, 2021, 5:01pm UTC](https://forum.cmascenter.org/t/soccer-plotter-example/2694 "2021-10-08T17:01:03Z")

</div>

MakeSoccerPlot.20211008.py creates the figure shown in this page from January\_Somewhere.csv file. January\_Somewhere.csv (106 Bytes) MakeSoccerPlot.20211008.py (2.0 KB)

---

## [Hodogram (Wind-Pollutant Timeseries on polar axis)](https://forum.cmascenter.org/t/hodogram-wind-pollutant-timeseries-on-polar-axis/2693)

<div class="topic-metadata">

**Author:** [@bukim1](https://forum.cmascenter.org/u/bukim1)\
**Replies:** 0\
**Last updated:** [October 8, 2021, 4:55pm UTC](https://forum.cmascenter.org/t/hodogram-wind-pollutant-timeseries-on-polar-axis/2693 "2021-10-08T16:55:07Z")

</div>

“WindHodogramPlot.py” generates the figure shown in this page from an Excel file that contains time series data. Currently, the code is very strict about filename of Excel file and the structure of data in the Excel as w…

---

## [BuglePlotter - Example (English)](https://forum.cmascenter.org/t/bugleplotter-example-english/2703)

<div class="topic-metadata">

**Author:** [@bukim1](https://forum.cmascenter.org/u/bukim1)\
**Replies:** 0\
**Last updated:** [October 12, 2021, 1:16pm UTC](https://forum.cmascenter.org/t/bugleplotter-example-english/2703 "2021-10-12T13:16:26Z")

</div>

MakeBuglePlot.py creates the following figures from “Sometime\_Somewhere\_FB.csv” and “Sometime\_Somewhere\_FE.csv”. MakeBuglePlot.Eng.py (3.5 KB) Sometime\_Somewhere\_FB.csv (119 Bytes) Sometime\_Somewhere\_FE.csv (120 Bytes…

---

## [BuglePlotter - Example (non-English)](https://forum.cmascenter.org/t/bugleplotter-example-non-english/2696)

<div class="topic-metadata">

**Author:** [@bukim1](https://forum.cmascenter.org/u/bukim1)\
**Replies:** 0\
**Last updated:** [October 8, 2021, 5:26pm UTC](https://forum.cmascenter.org/t/bugleplotter-example-non-english/2696 "2021-10-08T17:26:33Z")

</div>

MakeBuglePlot.py creates the following figures from “1월\_서울\_FB.csv” and “1월\_서울\_FE.csv”. This script is also an example showing how various languages (e.g., Korean in this case) can be used in files and figures too. MakeB…

---

## [Scripts for Google Traffic Map Capture/Process](https://forum.cmascenter.org/t/scripts-for-google-traffic-map-capture-process/2695)

<div class="topic-metadata">

**Author:** [@bukim1](https://forum.cmascenter.org/u/bukim1)\
**Replies:** 2\
**Last updated:** [October 12, 2021, 11:14am UTC](https://forum.cmascenter.org/t/scripts-for-google-traffic-map-capture-process/2695 "2021-10-12T11:14:44Z")

</div>

get\_google\_traffic\_map\_once.py captures Google Traffic images as shown below: Currently, the script takes screen shots every 10 min. get\_google\_traffic\_map\_once.py (1.1 KB) preprocessing\_pngs.py crops the captured …
