AC_tools
Contains functions and scripts used for working with atmospheric model output and observational data.
https://github.com/tsherwen/AC_tools
Category: Atmosphere
Sub Category: Atmospheric Composition and Dynamics
Keywords
atmospheric-chemistry ctm geos-cf geos-chem geos5 hemco kpp scientific-computing
Keywords from Contributors
atmospheric-modelling atmospheric-composition cloud-computing pbs simulations slurm aerosols atmospheric-chemistry-modeling carbon-cycle climate
Last synced: about 2 hours ago
JSON representation
Repository metadata
Module for working with global/regional Chemical Transport Model (CTM) output and observations
- Host: GitHub
- URL: https://github.com/tsherwen/AC_tools
- Owner: tsherwen
- License: mit
- Created: 2015-09-24T14:16:58.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2023-03-02T15:59:27.000Z (almost 3 years ago)
- Last Synced: 2025-12-22T06:31:49.714Z (5 days ago)
- Topics: atmospheric-chemistry, ctm, geos-cf, geos-chem, geos5, hemco, kpp, scientific-computing
- Language: Python
- Homepage:
- Size: 4.43 MB
- Stars: 14
- Watchers: 7
- Forks: 10
- Open Issues: 9
- Releases: 5
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
README.rst
AC_tools: Atmospheric Chemistry (AC) tools
======================================
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4789901.svg
:target: https://doi.org/10.5281/zenodo.4789901
**Atmospheric Chemistry Tools (AC_Tools)** contains functions and scripts used for
working with atmospheric model output and observational data.
Many functions are included for working with global and regional
chemical transport model (CTM) ouput from the GEOS-Chem model.
This package started as a just collection of scripts that were
found to be useful for work in atmospheric chemistry and now
simply aims to contain functionality outside the remit of the
more specialised community packages (e.g PyGChem_, xbpch_, and
gcpy_) and use the existing Python stack (e.g. dask_, xarray_,
pandas_).
`Please raise any questions/comments or bugs as issues here on GitHub `_
and `pull requests are welcome! `_
Installation
------------
**AC_Tools** is currently only installable from source. To do this, you
can either install directly via pip (recommended and this includes any dependencies)::
$ pip install git+https://github.com/tsherwen/AC_tools.git
or (not recommended), clone the source directory and manually install::
$ git clone https://github.com/tsherwen/AC_tools.git
$ cd AC_tools
$ python setup.py install
If you specifically wish to use the legacy "bpch to NetCDF" (`bpch2netCDF`_) capability, you will need to run AC_tools in a Python2 environment due to use of an `iris`_ backend via `PyGChem`_. In this specific case, please install using the later method and ensure that you have `iris`_ (version 1.13.0) installed. You will also need to install `PyGChem`_ (version 0.3.0) by the same route.
Quick Start
-----------
Functions within **AC_Tools** can be used for various tasks for handling model output and observations.
An example would be importing NetCDF files or converting ctm.bpch files from a directory of GEOS-Chem_ output (with ``tracerinfo.dat`` and ``diaginfo.dat`` files). Or using GEOS-Chem_ NetCDF output to make a quick plot of surface ozone.
If using within a python3 environment and GEOS-Chem
.. code:: python
import AC_tools as AC
folder = ''
# Get the GEOS-Chem NetCDF output as a xarray dataset object
# NOTE: this is just a wrapper of get_GEOSChem_files_as_ds, which can retrieve GEOS-Chem NetCDFs as a dataset
ds = AC.GetSpeciesConcDataset(wd=folder)
# Average dataset over time
ds = ds.mean(dim='time')
# Select the surface level
ds = ds.sel( lev=ds.lev[0] )
# Select ozone and do plot basic plot
spec = 'O3'
#ds['SpeciesConc_'+spec].plot() # very simple plot
AC.quick_map_plot( ds, var2plot='SpeciesConc_'+spec) # basic lat-lon plot
plt.show()
# Get global average surface CO
spec = 'CO'
ratio = (ds['SpeciesConc_'+spec] * ds['AREA']).sum() / ds['AREA'].sum()
ratio = float(ratio.values)
# Make a formatted string and then print using this to screen
prt_str = "The global average surface mixing ratio of {spec} (ppbv) is: {ratio}"
print(prt_str.format(spec=spec, ratio=ratio*1E9))
If using within a python2 environment, the below example is a way of accessing GEOS-Chem data. The data is converted from bpch to NetCDF by default via an iris backend through PyGChem (using bpch2netCDF.py).
.. code:: python
import AC_tools as AC
folder = ''
# Get the atmospheric ozone burden in Gg O3 as a np.array
array = AC.get_O3_burden_bpch(folder)
print( "The ozone burden is: {burden}".format(burden=array.sum()))
# Get surface area for resolution
s_area = get_surface_area(res)[..., 0] # m2 land map
# Get global average surface CO
spec = 'CO'
array = AC.get_GC_output(wd=folder, vars=['IJ_AVG_S__{}'.format(spec)])
ratio = AC.get_2D_arr_weighted_by_X(array, res='4x5', s_area=s_area)
# Make a formatted string and then print using this to screen
prt_str = "The global average surface mixing ratio of {spec} (ppbv) is: {ratio}"
print( prt_str.format(spec=spec, ratio=ratio*1E9))
Usage
------------
Example analysis code for using AC_tools is available in the
scripts folder.
For more information, please visit the AC_tools_wiki_.
License
-------
Copyright (c) 2015 `Tomas Sherwen`_
This work is licensed under a permissive MIT License.
Contact
-------
`Tomas Sherwen`_ - tomas.sherwen@york.ac.uk
.. _`Tomas Sherwen`: http://github.com/tsherwen
.. _conda: http://conda.pydata.org/docs/
.. _dask: http://dask.pydata.org/
.. _licensed: LICENSE
.. _GEOS-Chem: http://www.geos-chem.org
.. _xarray: http://xarray.pydata.org/
.. _pandas: https://pandas.pydata.org/
.. _gcpy: https://github.com/geoschem/gcpy
.. _PyGChem: https://github.com/benbovy/PyGChem
.. _xbpch: https://github.com/darothen/xbpch
.. _iris: https://scitools.org.uk/iris/docs/latest/
.. _bpch2netCDF: https://github.com/tsherwen/AC_tools/blob/master/Scripts/bpch2netCDF.py
.. _AC_tools_wiki: https://github.com/tsherwen/AC_tools/wiki
Owner metadata
- Name:
- Login: tsherwen
- Email:
- Kind: user
- Description:
- Website:
- Location: York & London
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/4687500?v=4
- Repositories: 41
- Last ynced at: 2024-06-11T15:36:51.942Z
- Profile URL: https://github.com/tsherwen
GitHub Events
Total
- Watch event: 1
Last Year
Committers metadata
Last synced: 1 day ago
Total Commits: 931
Total Committers: 7
Avg Commits per committer: 133.0
Development Distribution Score (DDS): 0.163
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Tomas Sherwen | t****n@y****k | 779 |
| Ben Newsome | b****6@y****k | 146 |
| Tomas Sherwen | t****n@T****l | 2 |
| wolfiex | d****h@g****m | 1 |
| Killian Murphy | k****y@y****k | 1 |
| Ryan Pound | r****9@y****k | 1 |
| Matthew Rowlinson | m****n@y****k | 1 |
Committer domains:
- york.ac.uk: 5
Issue and Pull Request metadata
Last synced: 3 days ago
Total issues: 43
Total pull requests: 57
Average time to close issues: 11 months
Average time to close pull requests: 4 days
Total issue authors: 6
Total pull request authors: 4
Average comments per issue: 1.16
Average comments per pull request: 0.05
Merged pull request: 53
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- tsherwen (27)
- BenNewsome (12)
- jinlx (1)
- kilicomu (1)
- Portaler (1)
- iriadigos (1)
Top Pull Request Authors
- tsherwen (45)
- BenNewsome (9)
- kilicomu (2)
- r-pound (1)
Top Issue Labels
- enhancement (24)
- bug (6)
- help wanted (2)
- question (2)
Top Pull Request Labels
- enhancement (1)
Package metadata
- Total packages: 2
- Total downloads: unknown
- Total dependent packages: 0 (may contain duplicates)
- Total dependent repositories: 0 (may contain duplicates)
- Total versions: 10
proxy.golang.org: github.com/tsherwen/AC_tools
- Homepage:
- Documentation: https://pkg.go.dev/github.com/tsherwen/AC_tools#section-documentation
- Licenses: mit
- Latest release: v0.1.3 (published over 4 years ago)
- Last Synced: 2025-12-23T20:00:38.531Z (3 days ago)
- Versions: 5
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.395%
- Average: 5.576%
- Dependent repos count: 5.758%
proxy.golang.org: github.com/tsherwen/ac_tools
- Homepage:
- Documentation: https://pkg.go.dev/github.com/tsherwen/ac_tools#section-documentation
- Licenses: mit
- Latest release: v0.1.3 (published over 4 years ago)
- Last Synced: 2025-12-23T20:00:38.672Z (3 days ago)
- Versions: 5
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.395%
- Average: 5.576%
- Dependent repos count: 5.758%
Dependencies
- cartopy
- matplotlib
- netcdf4
- numpy
- pandas
- pytest
- python 3.7.*
- pyyaml
- scipy
- xarray
Score: -Infinity