Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
doc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

reflexible

Github: https://github.com/spectraphilic/reflexible

Travis CI

Coverage Status

About

reflexible is a complete rewrite of the pflexible module that was orginally written to work with FLEXPART model output. The new design goals of reflexible will drive significant changes from the prior module but provide greater flexibility.

The reflexible module is being developed to provide an unified data analysis tool for working with geophysical model data. FLEXPART tools will be the initial target group, but other models (WRF, ENKI hydrologic model, etc.) are included in the development plans.

The main paradigm of development and the data model is to work on top of netcdf files. Specific 'Headers' will be created for relevant models. If the data is not natively in netcdf format from the model, it will be converted. The user will have the option to save this converted output for later use.

Initially we aim to provide:

  • an interface to read model output and provide general information about the simulation
  • tools for simple access to the data
  • simple visualization tools

Some routines were initially created to work with FLEXPART model ouput. FLEXPART is a Lagrangian particle dispersion model.

This software was written for the purposes of conducting research and displaying model results for publications. More information can be found on my homepage.

Contact, Issues, and Discussion

A maillist has been set up for users at sourceforge. Please direct inquiries via the reflexible_maillist

As for Issues, please use the tool at github.

Direct inquiries may be sent to:

John F Burkhart, University of Oslo
[john.burkhart](mailto://john.burkhart@geo.uio.no)

Sphinx Documentation

The documentation is hosted at readthedocs.

Working with reflexible

Clone the github repository into a folder in your PYTHONPATH:

$ git clone https://github.com/spectraphilic/reflexible.git

Optionally create a conda environment:

$ conda create --name reflexible
$ conda activate reflexible

Install the requirements:

$ conda install --file requirements.txt -c conda-forge

Now compile the library:

$ python setup.py build_ext --inplace

This will compile the pflexcy.pyx file into a pflexcy.so module that can be imported and used by the pf.readgrid function. A series of tests are run to try and determine the best module to use -- somewhat transparently to the user. See the reflexible.readgridV8 function for more information.

Possible issues

There are a few 'gotchas' when using the module. First, you will likely have to recompile (f2py) the FortFlex.f file and create a FortFlex.so module for whatever computer you're using. For this you need a Fortran compiler (gfortran) installed, so sometimes that can be an issue.

An alternative 'BinaryFile' class has been created so one can work with pure Python. Alone, it is significantly slower than the FortFlex module, however, if you use the dumpgrid module, significant speedups can be achieved.

Primary functionality comes from the readheaderV8 function and the readgridV8 function. I have created a "Header" class that can be used for some typical analysis. See the examples directory, and don't forget to read the source code and the getting started documentation.

Testing reflexible

reflexible comes with a suite of test units that you can run in a series of ways after you compiled the extensions and before you install it:

$ PYTHONPATH=. python -c "import reflexible; reflexible.test()"

or:

$ PYTHONPATH=. python reflexible/tests/all.py

or using the excellent py.test (recommended for developers):

$ py.test

Installation

If all is working correctly, then you can install it (you might need to be superuser here):

$ python setup.py install

And hopefully everything works!.

Reporting problems

When you run into problems it is always nice that when you are filing a ticket you would add the information about the versions you are using. You can do that via the pf.print_versions(). Here it is an output example:

$ python -c "import reflexible; reflexible.print_versions()"
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
reflexible version: 0.5.0
NumPy version:     1.12.0
Python version:    3.5.3 | packaged by conda-forge | (default, Feb  9 2017, 14:37:12)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]
Platform:          linux-x86_64
Byte-ordering:     little
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Key Tools

The primary workflow and usefulness of reflexible comes from the read_header and read_grid routines, which are designed to help ultimately with plotting and data analysis of the FLEXPART output.

To get started, at least become familiar with:

  • Header class
  • read_header
  • read_grid
  • fill_backward
  • plot_sensitivity

NOTE: the other plotting functions are mostly wrappers which ultimately make a call to plot_sensitivity.

Disclaimer

About the mapping.py module, it is primarily designed as some convenience routines for working with basemap.

All these routines were written 'on the fly', without a design plan or test cases. Everything probably could use a rewrite!

About

Package for plotting and analysis of geophysical model data

Resources

License

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •