AE Documentation

Cal-Adapt Analytics Engine: Timeseries Tools

A notebook to demonstrate the usage of the timeseries toolkit to visualize and process timeseries data.

Step 0: Setup

import panel as pn
pn.extension()

This time we’ll also load the timeseries tools with their own abbreviation for convenience.

import climakitae as ck
from climakitae import timeseriestools as tst
app = ck.Application()

Step 1: Select

You will want to choose “Append historical” and “Area average” if your intention is to work with the timeseries tools.

app.select()

Step 2: Retrieve

my_data = app.retrieve()
my_data

For the timeseries ‘explore’ function, we first need to load the dataset, so that the subsequent operations will be speedy.

The ‘retreive’ step above previews, but does not compute, the aggregation of all the selected data into timeseries. This may take a few minutes.

my_data = my_data.compute()

Steps 3 & 4: Visualize and Transform

timeseries = tst.Timeseries(my_data)

Preview various transforms on the data in real time.

timeseries.explore()

And then output whatever the current state is to another variable:

transformed = timeseries.output_current()
transformed

Step 5: Export

Use the below code to export a dataset as a NetCDF, GeoTIFF, or CSV file.

app.export_as()

Provide the name of the dataset in the environment to export as well as a character string containing the file name in quotations.

If the dataset contains multiple variables, provide an argument specifying which variable to export (e.g. variable=”T2”).

If you would like to save data as a GeoTIFF or CSV file and the dataset contains scenarios or simulations, additionally provide arguments specifying the scenario (scenario=”historical”) and the simulation (simulation=”cesm2”).

app.export_dataset(transformed,'my_filename')