diff --git a/e3sm_to_cmip/cmor_handlers/_formulas.py b/e3sm_to_cmip/cmor_handlers/_formulas.py index 5ab3fed6..a5322fc2 100644 --- a/e3sm_to_cmip/cmor_handlers/_formulas.py +++ b/e3sm_to_cmip/cmor_handlers/_formulas.py @@ -223,6 +223,40 @@ def rsuscs(data: Dict[str, np.ndarray], index: int) -> np.ndarray: return outdata +def rsut(data: Dict[str, np.ndarray], index: int) -> np.ndarray: + """ + rsut = SOLIN - FSNTOA + + pre v3 version: + rsut = FSUTOA + """ + try: + outdata = ( + data["SOLIN"][index, :] - data["FSNTOA"][index, :] + ) + except KeyError: + outdata = data["FSUTOA"][index, :] + + return outdata + + +def rsutcs(data: Dict[str, np.ndarray], index: int) -> np.ndarray: + """ + rsutcs = SOLIN - FSNTOAC + + pre v3 version: + rsutcs = FSUTOAC + """ + try: + outdata = ( + data["SOLIN"][index, :] - data["FSNTOAC"][index, :] + ) + except KeyError: + outdata = data["FSUTOAC"][index, :] + + return outdata + + def rtmt(data: Dict[str, np.ndarray], index: int) -> np.ndarray: """ rtmt = FSNT - FLNT diff --git a/e3sm_to_cmip/cmor_handlers/handlers.yaml b/e3sm_to_cmip/cmor_handlers/handlers.yaml index 1793e212..c100444a 100644 --- a/e3sm_to_cmip/cmor_handlers/handlers.yaml +++ b/e3sm_to_cmip/cmor_handlers/handlers.yaml @@ -577,6 +577,14 @@ formula: FSDSC - FSNSC positive: up levels: null +- name: rsut + units: W m-2 + raw_variables: [SOLIN, FSNTOA] + table: CMIP6_Amon.json + unit_conversion: null + formula: SOLIN - FSNTOA + positive: up + levels: null - name: rsut units: W m-2 raw_variables: [FSUTOA] @@ -585,6 +593,14 @@ formula: null positive: up levels: null +- name: rsutcs + units: W m-2 + raw_variables: [SOLIN, FSNTOAC] + table: CMIP6_Amon.json + unit_conversion: null + formula: SOLIN - FSNTOAC + positive: up + levels: null - name: rsutcs units: W m-2 raw_variables: [FSUTOAC]