acgc API documentation

# acgc

Data analysis programs from the ACGC research group

# Installation

For conda users:

`conda install -c conda-forge acgc`

For pip users:

`pip install acgc`

### For developers

If you plan to modify or improve the acgc package, an editable installation may be better: `pip install -e git+https://github.com/cdholmes/acgc-python` Your local files can then be managed with git, including keeping up-to-date with the github source repository (e.g. `git pull`).

# Get started

Submodules within `acgc` contain all the capabilities of the package. Submodules are imported via `import acgc.<submodule>` or `from acgc import <submodule>`.

## Better looking figures

The default appearance of figures from Matplotlib doesn't meet the standards of most scientific journals (high-resolution, Helvetica-like font). With the `acgc.figstyle` module, figures meet these criteria. Simply use `from acgc import figstyle` before creating your figures.

Example using acgc.figstyle

## Bivariate statistics

The `BivariateStatistics` class makes it easy to compute and display a large number of bivariate statistics, including line fitting and weighted statistics. Results can be easily formatted into tables or inset in figures. Use `from acgc.stats import BivariateStatistics` See `acgc.stats.bivariate.BivariateStatistics` for documentation.

Example using BivariateStatistics

## Standard major axis (SMA) line fitting

SMA line fitting (also called reduced major axis or RMA) quantifies the linear relationship between variables in which neither one depends on the other. It is available via `from acgc.stats import sma`.

Example using SMA

# Demos

The demo folder contains examples of how to accomplish common data analysis and visualization tasks. The examples include uses of the `acgc` library as well as other libraries for geospatial data analysis.

# Quick summary of submodules

## Key submodules

- `acgc.figstyle`
  Style settings for matplotlib, for publication-ready figures. demo

- `acgc.stats`
  Collection of statistical methods. demo

## Other submodules

- `acgc.erroranalysis`
  Propagation of error through complex numerical models

- `acgc.geoschem` or `acgc.gc`
  Tools for GEOS-Chem grids (e.g. indexing, remapping, interpolating)

- `acgc.hysplit`
  Read HYSPLIT output and write HYSPLIT CONTROL files

- `acgc.icartt`
  Read and write ICARTT format files

- `acgc.igra`
  Read IGRA radiosonde data files

- `acgc.mapping`
  Distance calculation, scale bar for display on maps

- `acgc.met`
  Miscelaneous functions for PBL properties

- `acgc.modetools`
  Visualization of eigenmode systems

- `acgc.netcdf`
  High-level functions for reading and writing netCDF files. Legacy code. `acgc.netcdf.write_geo_nc` is still useful for concisely creating netCDF files, but xarray is better for reading netCDF.

- `acgc.solar`
  Solar zenith angle, azimuth, declination, equation of time

- `acgc.time`
  Functions for manimulating times and dates. Legacy code.

View Source

      1'''Data analysis programs from the ACGC research group
      2
      3# Installation
      4
      5For conda users:
      6
      7 `conda install -c conda-forge acgc`
      8
      9For pip users:
     10
     11 `pip install acgc`
     12
     13### For developers
     14If you plan to modify or improve the acgc package, an editable installation may be better:
     15`pip install -e git+https://github.com/cdholmes/acgc-python`
     16Your local files can then be managed with git, including keeping up-to-date with the
     17github source repository (e.g. `git pull`).
     18
     19<!-- ----------------------- SECTION BREAK ----------------------- -->
     20
     21# Get started
     22
     23Submodules within `acgc` contain all the capabilities of the package.
     24Submodules are imported via `import acgc.<submodule>` or `from acgc import <submodule>`.
     25
     26## Better looking figures
     27
     28The default appearance of figures from Matplotlib doesn't meet the standards of most
     29scientific journals (high-resolution, Helvetica-like font). With the `acgc.figstyle` module,
     30figures meet these criteria. Simply use `from acgc import figstyle` before creating your figures.
     31
     32[Example using acgc.figstyle](https://github.com/cdholmes/acgc-python/blob/main/demo/demo_figstyle.ipynb)
     33
     34## Bivariate statistics
     35
     36The `BivariateStatistics` class makes it easy to compute and display a large number of
     37bivariate statistics, including line fitting and weighted statistics.
     38Results can be easily formatted into tables or inset in figures. Use `from acgc.stats import BivariateStatistics`
     39See `acgc.stats.bivariate.BivariateStatistics` for documentation.
     40
     41[Example using BivariateStatistics](https://github.com/cdholmes/acgc-python/blob/main/demo/demo_stats.ipynb)
     42
     43## Standard major axis (SMA) line fitting
     44
     45SMA line fitting (also called reduced major axis or RMA) quantifies the linear relationship
     46between variables in which neither one depends on the other.
     47It is available via `from acgc.stats import sma`.
     48
     49[Example using SMA](https://github.com/cdholmes/acgc-python/blob/main/demo/demo_sma.ipynb)
     50
     51<!-- ----------------------- SECTION BREAK ----------------------- -->
     52
     53# Demos
     54The [demo](https://github.com/cdholmes/acgc-python/blob/main/demo)
     55folder contains examples of how to accomplish common data analysis and visualization tasks.
     56The examples include uses of the `acgc` library as well as other libraries for
     57geospatial data analysis.
     58
     59<!-- ----------------------- SECTION BREAK ----------------------- -->
     60
     61# Quick summary of submodules
     62
     63## Key submodules
     64
     65- `acgc.figstyle`
     66Style settings for matplotlib, for publication-ready figures.
     67[demo](https://github.com/cdholmes/acgc-python/blob/main/demo/demo_figstyle.ipynb)
     68
     69- `acgc.stats`
     70Collection of statistical methods.
     71[demo](https://github.com/cdholmes/acgc-python/blob/main/demo/demo_stats.ipynb)
     72
     73## Other submodules
     74
     75- `acgc.erroranalysis`
     76Propagation of error through complex numerical models
     77
     78- `acgc.geoschem` or `acgc.gc`
     79Tools for GEOS-Chem grids (e.g. indexing, remapping, interpolating)
     80
     81- `acgc.hysplit`
     82Read HYSPLIT output and write HYSPLIT CONTROL files
     83
     84- `acgc.icartt`
     85Read and write ICARTT format files
     86
     87- `acgc.igra`
     88Read IGRA radiosonde data files
     89
     90- `acgc.mapping`
     91Distance calculation, scale bar for display on maps
     92
     93- `acgc.met`
     94Miscelaneous functions for PBL properties
     95
     96- `acgc.modetools`
     97Visualization of eigenmode systems
     98
     99- `acgc.netcdf`
    100High-level functions for reading and writing netCDF files. Legacy code.
    101`acgc.netcdf.write_geo_nc` is still useful for concisely creating netCDF files,
    102but xarray is better for reading netCDF.
    103
    104- `acgc.solar`
    105Solar zenith angle, azimuth, declination, equation of time
    106
    107- `acgc.time`
    108Functions for manimulating times and dates. Legacy code.
    109'''
    110
    111def _package_version(package_name):
    112    '''Find version string for package name'''
    113    from importlib.metadata import version, PackageNotFoundError
    114    try:
    115        result = version(package_name)
    116    except PackageNotFoundError:
    117        result = "unknown version"
    118    return result
    119
    120__version__ = _package_version('acgc')
    121
    122__all__ = [
    123    'erroranalysis',
    124    'figstyle',
    125    'gc',
    126    'geoschem',
    127    'hysplit',
    128    'icartt',
    129    'igra',
    130    'mapping',
    131    'met',
    132    'modetools',
    133    'netcdf',
    134    'stats',
    135    'solar',
    136    'time'
    137]