stormtracks API — stormtracks 0.5.2.3-alpha documentation

# stormtracks API

Contents

- stormtracks API
  - Running
    - `stormtracks.download` – Download Necessary Data
  - Main Modules
    - `stormtracks.analysis` – Analysis of results
    - `stormtracks.c20data` – C20 Reanalysis Data
    - `stormtracks.ibtracsdata` – IBTrACS Data
    - `stormtracks.results` – Store and Access Results
  - Utilities

## Running

### `stormtracks.download` – Download Necessary Data

`stormtracks.download.` `delete_full_c20`(year)

  Deletes all data for given year.

`stormtracks.download.` `download_full_c20`(year, variables='all', version='v1')

  Downloads each ensemble member’s values for given variables

`stormtracks.download.` `download_full_c20_range`(start_year, end_year, variables=None)

  Downloads each ensemble member’s values for prmsl, u and v in a given range

`stormtracks.download.` `download_grib_c20`(year=2005, month=10, ensemble_member=56)

  Downloads the raw data for one ensemble member.

  Contains all fields for the given ensemble member (over 100 of them).

`stormtracks.download.` `download_ibtracs`()

  Downloads all IBTrACS data

  Downloads compressed tarball from FTP site to settings.DATA_DIR. Decompresses it to settings.DATA_DIR/ibtracs

`stormtracks.download.` `download_mean_c20`(year)

  Downloads mean values for prmsl, u and v

`stormtracks.download.` `download_mean_c20_range`(start_year, end_year)

  Downloads mean values for prmsl, u and v in a given range

## Main Modules

### `stormtracks.analysis` – Analysis of results

### `stormtracks.c20data` – C20 Reanalysis Data

### `stormtracks.ibtracsdata` – IBTrACS Data

### `stormtracks.results` – Store and Access Results

exception `stormtracks.results.` `ResultNotFound`

  Simple exception thrown if result cannot be found in results manager or on disk

class `stormtracks.results.` `StormtracksResultsManager`(name, output_dir=None)

  Manager class that is responsible for loading and saving all python results

  Simple key/value store. Load/saves to settings.OUTPUT_DIR.

  `compress_year`(year, delete=False)

    Compresses a given year’s dir and then optionally deletes that year

  `decompress_year`(year)

    Decompresses a given year’s tarball

  `delete`(year, result_key)

    Deletes a specific result from disk

  `delete_year`(year)

    Deletes a year (use with caution!)

  `get_result`(year, result_key)

    Returns a result from an HDF file.

  `list_results`(year)

    List all results saved for a particular year

  `list_years`()

    List all saved years

  `save_result`(year, result_key, result)

    Saves a given result based on year, user chosen result_key

## Utilities

`stormtracks.utils.utils.` `compress_dir`(data_dir)

  Compresses a given data_dir, taking care to get file names correct

`stormtracks.utils.utils.` `decompress_file`(compressed_filename)

  Decompresses a given tarball, taking care to get file names correct

`stormtracks.utils.utils.` `dist`(p1, p2)

  Returns the cartesian distance between two points

`stormtracks.utils.utils.` `find_extrema`(array)

  Takes an array and finds its local extrema.

  Returns an array with 0s for not an extrema, 1s for maxs and -1 for mins and a list of the indices of all maximums and minimums

  N.B. this function is much faster than the above.

`stormtracks.utils.utils.` `find_extrema_slow`(array, print_warning=True)

  Takes an array and finds its local extrema.

  Returns an array with 0s for not an extrema, 1s for maxs and -1 for mins and a list of the indices of all maximums and minimums

`stormtracks.utils.utils.` `geo_dist`(p1, p2)

  Returns the geodesic distance between two points

  p1, p2 should be of the form (lon, lat) in degrees

`stormtracks.utils.utils.` `pairwise`(iterable)

  s -> (s0,s1), (s1,s2), (s2, s3), ...

`stormtracks.utils.utils.` `raster_voronoi`(extrema, maximums, minimums)

  Takes a 2D array and points of max/mins, and returns a 2D array with the voronoi sections filled with different values

`stormtracks.utils.utils.` `upscale_field`(lons, lats, field, x_scale=2, y_scale=2, is_degrees=True)

  Takes a field defined on a sphere using lons/lats and returns an upscaled version, using cubic spline interpolation.