climind.stats package
Submodules
climind.stats.paragraphs module
- climind.stats.paragraphs.anomaly_and_rank(all_datasets: List[TimeSeriesAnnual], year: int) str
Write a short paragraph, returned as a string, which gives the rank range and data value for the chosen year, as well as saying how many data sets and which datasets were used.
- Parameters
all_datasets (List[TimeSeriesAnnual]) – List of datasets to be used to derive the ranks and values
year (int) – Year for which the paragraph should be generated.
- Return type
str
- climind.stats.paragraphs.anomaly_and_rank_plus_new_base(all_datasets: List[TimeSeriesAnnual], year: int) str
Write a short paragraph, returned as a string, which gives the rank range and data value for the chosen year, as well as saying how many data sets and which datasets were used. Then it adds the anomalies relative to the 1961-1990 baseline, with information about the number of datasets.
- Parameters
all_datasets (List[TimeSeriesAnnual]) – List of datasets to be used to derive the ranks and values
year (int) – Year for which the paragraph should be generated.
- Return type
str
- climind.stats.paragraphs.antarctic_ice_paragraph(all_datasets: List[TimeSeriesMonthly], year: int) str
Generate a paragraph of some standard stats for the Antarctic sea ice: rank and value for max and min extents in the year (Feb and September).
- Parameters
all_datasets (List[TimeSeriesMonthly]) – List of datasets on which the assessment will be based
year (int) – Chosen year to focus on
- Returns
Paragraph of text
- Return type
str
- climind.stats.paragraphs.arctic_ice_paragraph(all_datasets: List[TimeSeriesMonthly], year: int) str
Generate a paragraph of some standard stats for the Arctic sea ice: rank and value for max and min extents in the year (March and September).
- Parameters
all_datasets (List[TimeSeriesMonthly]) – List of datasets on which the assessment will be based
year (int) – Chosen year to focus on
- Returns
Paragraph of text
- Return type
str
- climind.stats.paragraphs.basic_anomaly_and_rank(all_datasets: List[TimeSeriesAnnual], year: int) str
- climind.stats.paragraphs.co2_paragraph(all_datasets: List[TimeSeriesAnnual], year: int, update=False) str
Generate a paragraph of some standard stats for greenhouse gases
- Parameters
all_datasets (List[TimeSeriesAnnual]) – List of datasets on which the assessment will be based
year (int) – Chosen year to focus on
update (bool) – If set to True treat this as an update
- Returns
Paragraph of text
- Return type
str
- climind.stats.paragraphs.co2_paragraph_update(all_datasets: List[TimeSeriesAnnual], year: int) str
- climind.stats.paragraphs.compare_to_highest_anomaly_and_rank(all_datasets: List[TimeSeriesAnnual], year: int) str
- climind.stats.paragraphs.dataset_name_list(all_datasets: List[Union[TimeSeriesMonthly, TimeSeriesAnnual]], year: Optional[int] = None) str
Given a list of dataset, return a comma-and-and separated list of the names.
- Parameters
all_datasets (List[Union[TimeSeriesMonthly, TimeSeriesAnnual]]) – List of data sets whose names you want in a list
year (int) – If year is specified, the name list will specify to what month data are available if the year is incomplete.
- Returns
A list of the dataset names separated by commas and, where appropriate, ‘and’
- Return type
str
- climind.stats.paragraphs.fancy_html_units(units: str) str
Convert plain text units into html fancy units, which use subscripts and special characters to render.
- Parameters
units (str) – Units to be rendered into fancy units
- Returns
Units in fancy html form, or unchanged.
- Return type
str
- climind.stats.paragraphs.get_last_month(in_str)
- climind.stats.paragraphs.glacier_paragraph(all_datasets: List[Union[TimeSeriesMonthly, TimeSeriesAnnual]], year: int) str
Write the glacier paragraph :param all_datasets: list of data sets to be processed :type all_datasets: list[Union[TimeSeriesMonthly, TimeSeriesAnnual]] :param year: Year for which to do the evaluation :type year: int
- Return type
str
- climind.stats.paragraphs.global_anomaly_and_rank(all_datasets: List[TimeSeriesAnnual], year: int) str
- Parameters
all_datasets –
year –
- climind.stats.paragraphs.greenland_ice_sheet(all_datasets: List[TimeSeriesAnnual], year: int) str
- climind.stats.paragraphs.greenland_ice_sheet_monthly(all_datasets: List[TimeSeriesMonthly], year: int) str
- climind.stats.paragraphs.long_term_trend_paragraph(all_datasets: List[TimeSeriesMonthly], _) str
- climind.stats.paragraphs.marine_heatwave_and_cold_spell_paragraph(all_datasets: List[TimeSeriesAnnual], year: int) str
- climind.stats.paragraphs.max_monthly_value(all_datasets: List[TimeSeriesMonthly], year: int) str
Find the highest monthly data value within the chosen year and return a paragraph, as a string, which gives the value and rank for that month.
- Parameters
all_datasets (List[TimeSeriesMonthly]) – List of datasets to be used in the evaluation
year (int) – Year to be analysed
- Returns
Short paragraph of text
- Return type
str
- climind.stats.paragraphs.nice_list(names)
- climind.stats.paragraphs.ordinal(n)
- climind.stats.paragraphs.pre_industrial_estimate(all_datasets: List[TimeSeriesAnnual], _) str
Write a short paragraph estimating the difference between the modern baselin and 1850 to 1900.
- Parameters
all_datasets (List[TimeSeriesAnnual]) – List of all the data sets to be analysed
- Returns
Returns a paragraph of text stating an estimate of the pre-industrial temperature from these data sets
- Return type
str
- climind.stats.paragraphs.rank_ranges(low: int, high: int) str
Given an upper and lower limit on the rank, return a string which describes the range. e.g. ‘the 2nd’ or ‘between the 4th and 8th’.
- Parameters
low (int) – Lower of the two ranks.
high (int) – Higher of the two ranks.
- Returns
Short string which describes the range. e.g. ‘the 2nd’ or ‘between the 4th and 8th’ or similar.
- Return type
str
- climind.stats.paragraphs.superlative(variable)
climind.stats.utils module
- climind.stats.utils.get_ranks(datasets, match_year)
- climind.stats.utils.get_values(datasets, match_year)
- climind.stats.utils.run_the_numbers(datasets: List[Union[TimeSeriesMonthly, TimeSeriesAnnual]], match_year: int, title: str, output_dir: Path)
Given a list of datasets calculate various statistics relating to ranking and values
- Parameters
datasets (list) – List of data sets
match_year (int) – Year of interest. Stats will be calculated up to the year of interest, but note that rankings will include years after the year of interest if it is not the most recent year in the data sets
title (str) – name for the file
output_dir (Path) –
- Return type
None
- climind.stats.utils.table_by_year(datasets, match_year: int, years_to_show: int = 20) str