Evaluate package

Module contents

Evaluate – run evaluation of track model

run(configFile)

Run the evaluation methods for the pressure distributions, track density, landfall rates and longitude crossing rates.

Parameters

configFile (str) – path to the configuration file.

Submodules

Evaluate.interpolateTracks module

class Track2(data)

Bases: object

interpolate(track, delta, interpolation_type=None)

Interpolate the records in time to have a uniform time difference between records. Each of the input arrays represent the values for a single TC event.

Parameters
  • trackTrack object containing all data for the track.

  • deltafloat time difference to interpolate the dataset to. Must be positive.

  • interpolation_type – Optional [‘linear’, ‘akima’], specify the type of interpolation used for the locations (i.e. longitude and latitude) of the records.

# FIXME: Need to address masking values - scipy.interpolate.interp1d handles numpy.ma masked arrays.

parseTracks(configFile, trackFile, source, delta, outputFile=None, interpolation_type=None)

Load a track dataset, then interpolate to some time delta (given in hours). Events with only a single record are not altered.

Parameters
  • configFile (string) – Configuration file containing settings that describe the data source.

  • trackFile (string) – Path to the input data source.

  • source (string) – Name of the data source. configFile must have a corresponding section which contains options that describe the data format.

  • delta (float) – Time difference to interpolate the dataset to. Must be positive.

  • outputFile (string) – Path to the destination of output, if it is to be saved.

saveTracks(tracks, outputFile)

Save the data to a TCRM-format track file (.csv format).

Parameters
  • tracks – A collection of Track objects to save to file.

  • outputFile (str) – Path to destination file.

Evaluate.landfallRates module

LandfallRates – calculate landfall rates

class LandfallRates(configFile)

Bases: object

calculateStats()

Calculate mean and percentiels of landfall/offshore transition rates. Operates on the self.synLandfall and self.synOffshore attributes.

historic()

Calculate historical rates of landfall

plot()

Plot the results and save to file.

processResults(results, index)

Populate the self.synLandfall and self.synOffshore attributes.

Parameters
  • results (tuple) – tuple of arrays containing landfall and offshore transition counts for gates.

  • index (int) – synthetic event counter.

processTracks(tracks)

Given a collection of Track objects and set of gate vertices, calculate if the tracks cross the gates in either an onshore or offshore direction.

Returns the histograms for the gate counts.

run()

Execute the analysis

setOutput(ntracks)

Set the size of the output arrays.

Parameters

ntracks (int) – Number of track events.

synthetic()

Load synthetic data and calculate histogram

loadTracks(trackfile)

Read tracks from a track .nc file and return a list of Track objects.

This calls the function ncReadTrackData to parse the track .nc file.

Parameters

trackfile (str) – the track data filename.

Evaluate.longitudeCrossing module

LongitudeCrossing – calculate crossing rate of lons/lats

class LongitudeCrossing(configFile)

Bases: object

calcStats(lonCrossHist, lonCrossEW, lonCrossWE)

Calculate means and percentiles of synthetic event sets

findCrossings(tracks)

Given a series of track points and a longitude, calculate if the tracks intersect that line of longitude.

Parameters

tracks – collection of Track objects

Returns

h, ewh, weh, histograms for each line of longitude, recording the rate of crossings

historic()

Calculate historical rates of longitude crossing

plotCrossingRates()

Plot longitude crossing rates

run()

Run the longitude crossing evaluation

save()

Save data to file for archival and/or further processing

synthetic()

Calculate synthetic rates of longitude crossing

loadTracks(trackfile)

Read tracks from a track .nc file and return a list of Track objects.

This calls the function ncReadTrackData to parse the track .nc file.

Parameters

trackfile (str) – the track data filename.

Evaluate.pressureDistribution module

PressureDistributions – calculate central pressure distributions

class GridCell(xmin, ymin, xmax, ymax, number, index)

Bases: object

A simple class for determining data values over a grid.

class PressureDistribution(configFile)

Bases: object

calcMinPressure(tracks)

Calculate minimum central pressure for a collection of Track objects.

Parameters

tracks – A collection of Track objects.

Returns

Histogram of values and the array of actual values

calculate(tracks)

Calculate the ddistributions of central pressure across the simulation domain.

Parameters

tracks – a collection of Track objects

calculateMeans(synMean, synMin, synMed, synMax, synMinCP)

Calculate mean, median, minimum, maximum and percentiles of pressure values from synthetic events.

Parameters
  • synMeannumpy.ndarray

  • synMinnumpy.ndarray

  • synMednumpy.ndarray

  • synMaxnumpy.ndarray

  • synMinCPnumpy.ndarray

historic()

Load historic data and calculate histogram

plotMinPressureDistribution()

Plot a pdf of observed minimum central pressure values, and the mean of the synthetic event sets (plus 90th percentile values).

plotMinPressureQuantiles()

Plot a quantile-quantile plot of observed vs synthetic (mean) minimum central pressure values

plotPressureMean()

Plot a map of observed and synthetic mean pressure values

plotPressureMeanDiff()

Plot a map of the difference between observed and synthetic mean pressure values.

plotPressureMin()

Plot a map of observed and synthetic minimum central pressure values.

plotPressureMinDiff()

Plot a map of the difference between observed and synthetic minimum pressure values.

run()

Run the pressure distribution evaluation

save()

Save gridded pressure distributions to file. Data are saved to a netCDF file named pressureDistribution.nc for later analysis.

synthetic()

Load synthetic data and calculate histogram

loadTracks(trackfile)

Read tracks from a track .nc file and return a list of Track objects.

This calls the function ncReadTrackData to parse the track .nc file.

Parameters

trackfile (str) – the track data filename.

Evaluate.trackDensity module

TrackDensity – calculate track density

class TrackDensity(configFile)

Bases: object

calculate(tracks)

Calculate a histogram of TC occurrences given a set of tracks

Parameters

tracks – Collection of Track objects.

calculateMeans()

Calculate the mean, median and percentiles of the synthetic values

historic()

Load historic data and calculate histogram. Note that the input historical data is filtered by year when it’s loaded in interpolateTracks.parseTracks().

The timestep to interpolate to is set to match that of the synthetic event set (normally set to 1 hour).

plotTrackDensity()

Plot track density information

plotTrackDensityPercentiles()

Plot upper and lower percentiles of track density derived from synthetic event sets

run()

Run the track density evaluation

save()

Save data to file.

synthetic()

Load synthetic data and calculate histogram

loadTracks(trackfile)

Read tracks from a track .nc file and return a list of Track objects.

This calls the function ncReadTrackData to parse the track .nc file.

Parameters

trackfile (str) – the track data filename.