Spyfit

spyfit is a Python package that provides a set of tools for easy handling of FTIR retrieval data and for flexible setup and execution of retrieval processing pipelines.

Our goal with spyfit is to provide deep integration with the libraries of the Python scientific stack and to promote the use of standard data models. Through the use of the xarray Python package, we adopt the Common Data Model for self-describing retrieval data (it can be viewed as an in-memory representation of a netCDF file).

NOTE: This package is currently under heavy development! API is not stable.

Documentation

Installation

Required dependencies

  • Python 3.4 or 3.5.
  • numpy (1.7 or later)
  • pandas (0.15.0 or later)
  • xarray (0.7.0 or later)

Optional dependencies

For netCDF and IO
  • netCDF4: used by xarray to read/write netCDF4 files
  • scipy: used by xarray for reading/writing netCDF3
  • h5netcdf: an alternative library for reading and writing netCDF4 files that does not use the netCDF-C libraries
  • HDF4 and pyhdf or python-hdf4: if you want to read/write HDF4 GEOMS files
For plotting

Instructions

There is currently no spyfit release available at PyPi or Anaconda.

Be sure you have the required dependencies (numpy, pandas and xarray) installed first. You might consider using conda to install them:

$ conda install xarray netcdf4 pip

Then you can clone the spyfit git repository and install it using pip:

$ git clone https://github.com/girpas-ulg/spyfit
$ cd spyfit
$ pip install .

For development purpose, use the following command:

$ pip install -e .

API reference

This page provides an auto-generated summary of spyfit’s API. For more details and examples, refer to the relevant chapters in the main part of the documentation.

Retrievals

load_dataset(filename_or_path[, fmt]) Load a retrieval dataset stored in a given format.

SFIT4

Load SFIT4 dataset
io.sfit4.load_sfit4(ctl_filename) Load data from a SFIT4 run.
Read SFIT4 output files
io.sfit4.read_matrix(filename[, var_name, dims]) Read a single matrix (or a single vector) in SFIT4 output ascii files.
io.sfit4.read_ak_matrix(filename[, ldim, kdim]) Read averaging kernel matrix.
io.sfit4.read_seinv_vector(filename[, ddim]) Read seinv.
io.sfit4.read_table(filename[, var_name, ...]) Read (labeled) tabular data in SFIT4 output ascii files.
io.sfit4.read_profiles(filename[, ...]) Read a-priori or retrieved profiles in SFIT4 output ascii files.
io.sfit4.read_aprfs(filename[, ldim]) Read a-priori profiles in SFIT4 output ascii files.
io.sfit4.read_rprfs(filename[, ldim]) Read retrieved profiles in SFIT4 output ascii files.
io.sfit4.read_state_vector(filename[, ldim, ...]) Read the state vector in SFIT4 output ascii files.
io.sfit4.read_param_iterations(filename[, ...]) Read the state vector for each iteration in SFIT4 ascii output files.
io.sfit4.read_spectra(filename[, spdim, ...]) Read observed and fitted spectra in SFIT4 ascii files.
io.sfit4.read_single_spectrum(filename[, ...]) Read a single spectrum in a SFIT4 output ascii files.
io.sfit4.read_single_spectra(filename[, ...]) Read single spectra in a SFIT4 output ascii files.
io.sfit4.read_solar_spectrum(filename[, ...]) Read a calculated sol ar spectrum in SFIT4 output ascii files.
io.sfit4.read_summary(filename[, spdim, ...]) Read retrieval summary in SFIT4 output ascii files.
Read SFIT4 input files
io.sfit4.read_ctl(filename[, ldim]) Read control file.
io.sfit4.read_layers(filename[, ldim]) Read profile layers.
io.sfit4.read_ref_profiles(filename[, rdim]) Read coordinates, atmosphere and gas reference profiles.
io.sfit4.read_spectrum(filename[, spdim, ...]) Read a spectrum (bands and scans data).
Write SFIT4 input files
io.sfit4.write_reference(dataset, filename, ...) Export reference ZPT and gas profiles to SFIT4 ascii format.

Contributing

Contributions are welcome, and they are greatly appreciated!

You can contribute either by reporting bugs or submitting feedback at https://github.com/girpas-ulg/spyfit/issues or by sending pull requests through the spyfit repository on GitHub.

Get Started!

Ready to contribute? Here’s how to set up spyfit for local development.

  1. Fork the spyfit repo on GitHub.

  2. Clone your fork locally:

    $ git clone git@github.com:your_name_here/spyfit.git
    
  3. Install your local copy (you might consider creating first a new virtual environment using either conda or virtualenv):

    $ python setup.py develop
    
  4. Create a branch for local development:

    $ git checkout -b name-of-your-bugfix-or-feature
    

    Now you can make your changes locally.

  1. Commit your changes and push your branch to GitHub:

    $ git add .
    $ git commit -m "Your detailed description of your changes."
    $ git push origin name-of-your-bugfix-or-feature
    
  2. Submit a pull request through the GitHub website.

Get in touch

  • Report bugs, suggest feature ideas or view the source code on GitHub.

License

spyfit is available under the open-source GNU General Public License (GPLv3).

About

spyfit is part of various Python tools developped for FTIR spectroscopy and atmospheric chemistry modelling at the Infrared Group of Atmospheric and Solar Physics - GIRPAS laboratory (University of Liege, Belgium).