<jupyter_start><jupyter_text>Creating season means time seriesSometimes it is useful to have a time series in the form: DJF, MAM, JJA, SON, DJF, MAM, ... This is easily achieved using xarray's great averaging and indexing methods. We have created an auxiliary function in obrero in order to ease this process. First let's import obrero:<jupyter_code># small hack to be able to import module without install
import os
import sys
sys.path.append(os.getcwd() + '/../')

import obrero<jupyter_output><empty_output><jupyter_text>Now we read some data:<jupyter_code># filename
fname = 'data/sst_ctl.nc'

# read as datarray
da = obrero.read_nc(fname, 'tosbcs')
da<jupyter_output><empty_output><jupyter_text>In order to obtain a season means time series we use the function `get_season_series()` part of the `obrero.analysis` module. Let's see:<jupyter_code>sms = obrero.get_season_series(da)
sms<jupyter_output><empty_output><jupyter_text>As you can see now we have another auxiliary coordinate named `season` which simply adds the correct name for the season mean. The actual time coordinate contains a timestamp for the end of the season. So if it is DJF, it will have a timestamp for February. But here we got **all seasons**, and sometimes we want a time series of a single season, say DJF for all years in a file. We can specify a season in this function in order to only get that season:<jupyter_code>djfser = obrero.get_season_series(da, season='DJF')
djfser<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07728494623655914, 'fraction_numerical': 0.0, 'mean_word_length': 5.588495575221239, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '325474', 'license': 'MIT', 'n_tokens_mistral': 476, 'n_tokens_neox': 462, 'n_words': 193, 'path': 'examples/nb/example_17.ipynb', 'repo_name': 'Maduvi/obrero', 'size': '1488'}