tools.geetools

class tools.geetools.CMIPDownloader(var, starty, endy, shape, processes=10, dir='./')[source]

Class to download spatially averaged CMIP6 data for a given period, variable, and spatial subset.

download()[source]

Runs a subset routine for CMIP6 data on GEE servers to create ee.FeatureCollections for all years in the requested period. Downloads individual years in parallel processes to increase the download time.

class tools.geetools.CMIPProcessor(var, file_dir='.')[source]

Class to read and pre-process CSV files downloaded by the CMIPDownloader class.

append_df(var, file_dir='.', hist=True)[source]

Reads CMIP6 CSV files of individual years and concatenates them into dataframes for the full downloaded period. Historical and scenario datasets are treated separately. Converts precipitation unit to mm.

get_results()[source]

Concatenates historical and scenario data to combined dataframes of the full downloaded period. Arranges the models in alphabetical order.

process_dataframes()[source]

Separates the two scenarios and drops models not available for both scenarios and the historical period.

read_cmip(filename)[source]

Reads CMIP6 CSV files and drops redundant columns.

tools.geetools.authenticate_and_initialize_ee(cloud_project)[source]

Robustly authenticates and initializes Earth Engine for local/notebook environments.

It attempts to initialize Earth Engine: 1. Using existing credentials if available and valid for the project. 2. If a permission error occurs, it forces a new interactive browser-based

authentication suitable for notebooks.

Parameters:

cloud_project (str) – The Google Cloud Project ID to use for Earth Engine.

Raises:

RuntimeError – If Earth Engine initialization ultimately fails after retries.