Skip to main content

Create polar plots to display seasonal trends in time series data.

Project description

Seasonality polar plots

This is a package to create polar plots for displaying seasonal trends in time series data. Requires

  • matplotlib (3.5.1)
  • numpy (1.19.2)
  • pandas (1.3.5)
  • seaborn (0.11.2)
  • scipy (1.6.0)

1. Read data into SeasonData class:

SeasonData(data, year_start, year_end, t_res = 'daily')

Arguments
data pandas Series or single column DataFrame with datetime index
year_start (int) start year of period to be analyzed
year_end (int) end year of period to be analyzed
t_res 'daily' or 'monthly': temporal resolution. Monthly values can be aggregated from daily values if 'monthly' is chosen (see sp_plot() and get_mgrid() function)

2. Plot function:

self.sp_plot(label, mode = 'all', rd_years = True, col = 'viridis_r', a = 1, psize = None, pmarker = None, nylabels = 10, off = 0, rlab_angle = 15, linreg = False, start_month = 1)

Arguments
label label for time series variable
mode 'all' to select all data points; daily resolution: 'min' or 'max' filter time series on annual extreme values; monthly resolution: 'sum', 'mean' / 'min', 'max' aggregate / filter data for each month
rd_years as default, years are plotted in radius direction; rd_years=False plots variable in radius direction
col color gradient (default 'viridis_r')
a transparency alpha (0-1)
psize marker size for daily data points
pmarker marker style for daily data points
nylabels number of (year) labels in radius direction
off off-set from circle center
rlab_angle angle of the radius axis labels
linreg linreg=True plots linear regression (day in year ~ year) in polar projection (only for daily extreme values)
start_month start month for linear regression

Returns: Plot; for linreg=True: prints R² and p-values for slope and intercept

Obtain annual extreme values from daily time series:

self.get_ev( mode)

Arguments
mode 'min' or 'max': filter time series on annual extreme values

Returns: DataFrame (containing nr of day in year of extreme values, extreme values)

Obtain aggregated / filtered monthly values:

self.get_mgrid(mode)

Arguments
mode 'all' if data is already in monthly resolution; 'sum', 'mean' / 'min', 'max' aggregate / filter data for each month

Returns: DataFrame (containing monthly data)

3. Von-Mises distribution (ML fit with scipy):

self.von_mises(mode, plot = True, print_par = True, bins = 15, col_hist = 'b', col_vm ='r', off = 0.1, a = 1, rwidth = 0.8)

Arguments
mode 'all' to use all data points, 'min' or 'max' to filter on extreme values
plot if True plots the data as circular histogram and fitted von-Mises distribution
print_par if True prints the fitted von-Mises parameters kappa and mu
bins number of bins for histogram
col_hist color of the histogram
col_vm color of the fitted von Mises distribution
off off-set from circle center
a transparency alpha (0-1)
rwidth relative width of histogram bins

Returns: Plot; kappa, mu, mu_nday

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

season_polar_plots-0.0.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

season_polar_plots-0.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file season_polar_plots-0.0.1.tar.gz.

File metadata

  • Download URL: season_polar_plots-0.0.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for season_polar_plots-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c5be20766589f081b832be8dc61ce14dbd0bf1cd7ae0358e70843056043060ea
MD5 9ccb01a7ca4dd9a718a2cf4a5b32a02d
BLAKE2b-256 18eb7ccd3138d8d57abc594c92ef964d963abe74cb37925522b2d7668fa89c79

See more details on using hashes here.

File details

Details for the file season_polar_plots-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for season_polar_plots-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff73f1b5c22fa67aa60079e3754d66b4a45ce69b2546bcb43842284aa7b32c6f
MD5 b4f1b4b018b12769567282917dd60dbf
BLAKE2b-256 c8353c5139a3e48e7620206aff9fc2afd9cd7b7a13795257288949f24be9dcd4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page