From e8522887f1dc499a4d1c0613e7915a072e626970 Mon Sep 17 00:00:00 2001 From: BYERS Edward Date: Mon, 13 Nov 2023 12:42:57 +0100 Subject: [PATCH] tidy and update readme --- README.md | 18 ++++++++++-------- rime/rime_functions.py | 13 ++++++------- rime/{ => wip_scraps}/calc_tcre.py | 0 rime/{ => wip_scraps}/first_plots.py | 0 rime/{ => wip_scraps}/pp_process_maps.ipynb | 0 .../pp_process_tabledata.ipynb | 0 6 files changed, 16 insertions(+), 15 deletions(-) rename rime/{ => wip_scraps}/calc_tcre.py (100%) rename rime/{ => wip_scraps}/first_plots.py (100%) rename rime/{ => wip_scraps}/pp_process_maps.ipynb (100%) rename rime/{ => wip_scraps}/pp_process_tabledata.ipynb (100%) diff --git a/README.md b/README.md index 675c2d6..3176fe5 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,14 @@ When accompanied by climate impacts data (table and/or maps), RIME can be used to take a global mean temperature timeseries (e.g. from an IAM or climate model like FaIR/MAGICC), and return tables and maps of climate impacts through time consistent with the warming of the scenario. There are two key use-cases for the RIME approach: -1. Estimating a suite of climate impacts from an global emissions or temperature scenario. +1. Estimating a suite of climate impacts from a global emissions or temperature scenario. 2. Reformulating climate impacts data to be used as an input to an integrated assessment model scenario. +[![RIME_use_cases]](https://github.com/iiasa/rime/assets/17701232/12e9ae66-5d28-4f06-9540-fa496cc588d0) - +## Core files ### `rime_functions.py` Contains the key functions that can be used to process data. @@ -34,18 +35,19 @@ A script to host a large number of configurable settings for running the softwar Needs to be imported at the beginning of a script, e.g. `from process_config import *`. Settings for Dask could be configured in here. +## Example processing and workflow scripts + ### `generate_aggregated_inputs.py` -Pre-processing of tabular impacts data of exposure by GWL, into netcdf datasets that will be used in emulation. Only needs to run once to pre-process the impacts data. +Pre-processing of tabular impacts data of exposure by GWL, into netcdf datasets that will be used in emulation. Only needs to run once to pre-process the impacts data. Only required if working with IAMC table impacts data. ### `process_tabledata.py` -Take input table of emissions scenarios with GMT and output tables of climate impacts data in IAMC format. Can be done for multiple scenarios and indicators at a time. +Example script that takes input table of emissions scenarios with global temperature timeseries, and output tables of climate impacts data in IAMC format. Can be done for multiple scenarios and indicators at a time. ### `process_maps.py` -Take input table of emissions scenarios with GMT and output maps of climate impacts through time as netCDF. Ouptut netCDF can be specified for either for 1 scenario and multiple climate impacts, or multiple scenarios for 1 indicator. - +Example script that takes input table of emissions scenarios with global temperature timeseries, and output maps of climate impacts through time as netCDF. Ouptut netCDF can be specified for either for 1 scenario and multiple climate impacts, or multiple scenarios for 1 indicator. -## Tutorials -Example scripts and tutorials are found inthe respective folders. +### pp_combined example.ipynb +Example jupyter notebook that demonstrates methods of processing both table and map impacts data for IAM scenarios. ## Installation diff --git a/rime/rime_functions.py b/rime/rime_functions.py index c07978b..c073d83 100644 --- a/rime/rime_functions.py +++ b/rime/rime_functions.py @@ -440,7 +440,7 @@ def map_transform_gmt_wrapper( else: # ============================================================================= - # 1 scenario, multi-indicator mode + # Mode 2: 1 scenario, multi-indicator mode # ============================================================================= print("Single scenario mode, multiple indicators possible") model = df.model[0] @@ -456,7 +456,6 @@ def map_transform_gmt_wrapper( # needs to be outsite loop delayed_tasks = [] - df1 = df # use_dask not working here @@ -464,7 +463,7 @@ def map_transform_gmt_wrapper( # Iterate through spatial indicators in DataSet for var_name in mapdata.data_vars: print(var_name) - # Create delayed task for map_transform_gmt_dask + # Create delayed task for map_transform_gmt_wrapper delayed_map_transform = delayed(map_transform_gmt)( df1, mapdata[var_name], years, var_name, map_array ) @@ -627,13 +626,13 @@ def co2togmt_simple(cum_CO2, regr=None): cum_CO2 : int, float, np.array, pandas.Series Value of cumulative CO2, from 2020 onwards, in Gt CO2. regr : dict, optional - 'slope' and 'intercept' values for line. The default is None, in which - case parameters from AR6 assessment are used. Provide {'slope': m, + 'slope' and 'intercept' values for linear regession. The default is None, in which + case parameters from IPCC AR6 assessment are used. Provide {'slope': m, 'intercept': x} to define own linear relationship. Returns ------- - Global mean surface air temperature (p50). + Global mean surface air temperature. """ @@ -683,7 +682,7 @@ def plot_maps_dashboard(ds, filename=None, indicators=None, year=2050, cmap='magma_r', shared_axes=True, clim=None, coastline=True, crs=None, features=None, layout_title=None): """ - From an xarray.DataSet of climate impacts indicators through time for one IAM scenario, + From an xarray.DataSet of climate impact indicators through time for one IAM scenario (mode 2 in map_transform_gmt_wrapper), plot the indicators as an interactive html dashboard in a specified year. Parameters diff --git a/rime/calc_tcre.py b/rime/wip_scraps/calc_tcre.py similarity index 100% rename from rime/calc_tcre.py rename to rime/wip_scraps/calc_tcre.py diff --git a/rime/first_plots.py b/rime/wip_scraps/first_plots.py similarity index 100% rename from rime/first_plots.py rename to rime/wip_scraps/first_plots.py diff --git a/rime/pp_process_maps.ipynb b/rime/wip_scraps/pp_process_maps.ipynb similarity index 100% rename from rime/pp_process_maps.ipynb rename to rime/wip_scraps/pp_process_maps.ipynb diff --git a/rime/pp_process_tabledata.ipynb b/rime/wip_scraps/pp_process_tabledata.ipynb similarity index 100% rename from rime/pp_process_tabledata.ipynb rename to rime/wip_scraps/pp_process_tabledata.ipynb