Skip to content
forked from scotthosking/baspy

Making it far easier to read in and work with large volumes of climate model output from CMIP5/6

Notifications You must be signed in to change notification settings

ai4er-cdt/baspy

 
 

Repository files navigation

BASpy

baspy is a python package to make it easier to analyse large climate datasets using Xarray (http://xarray.pydata.org), Iris (http://scitools.org.uk/iris/), or any other python package that can read in netcdf/PP/grib/HDF files.

1. Setup package

Setup your PYTHONPATH to point to your directory of python scripts. Then download (or git clone) baspy python package.

    $> mkdir ~/PYTHON
    $> export PYTHONPATH="$HOME/PYTHON"  # <- add to ~/.bashrc
    $> cd $PYTHONPATH
    $> git clone https://github.com/scotthosking/baspy.git

2. Define the directory and filename structures of your local datasets

see and edit datasets.py

Once you have set this up all file loading should become transparent

3. Usage

Reading data:

    import baspy as bp
 
    ### Retrieve a filtered version of the CMIP5 catalogue as a Pandas DataFrame
    df = bp.catalogue(dataset='cmip5', Model='HadGEM2-CC', RunID='r1i1p1', 
                        Experiment='historical', Var=['tas', 'pr'], 
                        Frequency='mon')

    ### Iterate over rows in catalogue
    for index, row in df.iterrows():

        ### In Xarray
        ds = bp.open_dataset(row)

        ### Or... In Iris
        cubes = bp.get_cube(row)

Other Examples:

About

Making it far easier to read in and work with large volumes of climate model output from CMIP5/6

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 71.4%
  • Jupyter Notebook 28.6%