From df9cb8968f01942a0576ad21381acfa2e1c82fbb Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 4 Oct 2023 12:13:17 +0200 Subject: [PATCH 01/17] WIP: including all the files from old carbon-tracker branch (for doublicated with _ct affix) to start devel. --- scripts/IFS_toy_ct.py | 171 +++++++++++++++ scripts/convert-ece4pyreader-grids_ct.sh | 96 +++++++++ scripts/fix-gfas.sh | 18 ++ scripts/fix-sib.sh | 19 ++ scripts/namcouple_co2_ct.sh | 43 ++++ scripts/namcouple_co2box_ct.sh | 79 +++++++ scripts/namelist.co2box_ct.sh | 20 ++ scripts/run_example_ct.sh | 256 +++++++++++++++++++++++ 8 files changed, 702 insertions(+) create mode 100644 scripts/IFS_toy_ct.py create mode 100644 scripts/convert-ece4pyreader-grids_ct.sh create mode 100644 scripts/fix-gfas.sh create mode 100644 scripts/fix-sib.sh create mode 100644 scripts/namcouple_co2_ct.sh create mode 100644 scripts/namcouple_co2box_ct.sh create mode 100644 scripts/namelist.co2box_ct.sh create mode 100644 scripts/run_example_ct.sh diff --git a/scripts/IFS_toy_ct.py b/scripts/IFS_toy_ct.py new file mode 100644 index 0000000..8edea68 --- /dev/null +++ b/scripts/IFS_toy_ct.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python3 +# Copyright 2021 - Barcelona Supercomputing Center +# Author: Rodrigo Martín Posada +# MIT License + +import f90nml +import pyoasis +from pyoasis import OASIS # pylint: disable=no-name-in-module +import numpy as np +import logging + +NAMELIST_FILE_NAME = 'namelist.amip' +L080_NX = 35718 # number of grid cells at T159 resolution +L128_NX = 88838 # number of grid cells at T255 resolution +L256_NX = 348528 # number of grid cells at T511 resolution +CO2_CMODE = False # is CO2 concentration-mode active? +CO2_EMODE = False # is CO2 emission-mode active? + + +def def_local_partition(nx, npes, mype): + il_size = nx // npes + il_offset = mype * il_size + if (npes-mype) <= nx % npes: + il_size += 1 + il_offset += (nx % npes) - (npes-mype) + return il_size, il_offset + + +if __name__ == '__main__': + # Constants from namelist + nml = f90nml.read(NAMELIST_FILE_NAME) + COUPLING_INTERVAL = nml['NAMAMIP']['TimeStepSec'] + RUN_LENGTH_SEC = nml['NAMAMIP']['RunLengthSec'] + + # Init OASIS + comp = pyoasis.Component("IFS_TOY") + local_comm = comp.localcomm + # Get rank in local communicator + mype = comp.localcomm.rank + npes = comp.localcomm.size + + # Unit for output messages + out_ifs = 'IFS_toy.out_'+str(100+mype) + logging.basicConfig(filename=out_ifs, format='%(message)s', level=logging.DEBUG) + logging.debug('-----------------------------------------------------------') + logging.debug('I am IFS-toy process with rank : {}'.format(mype)) + logging.debug('in my local communicator gathering {} processes'.format(npes)) + logging.debug('----------------------------------------------------------') + + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + # PARTITION DEFINITION + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + with open('namcouple', 'r') as f: + #contents = f.read() + contents = "" + for line in f: + li=line.strip() + if not li.startswith("#"): + contents += line + # TODOD find a better way to detect CO2_CMODE + if 'GLOBAL GLOBAL' in contents: + CO2_CMODE = True + if 'A_CO2_emis ' in contents: + CO2_EMODE = True + if 'L080' in contents: + nx = L080_NX + elif 'L128' in contents: + nx = L128_NX + elif 'L256' in contents: + nx = L256_NX + else: + raise Exception('Invalid IFS grid in namcouple') + # Definition of the local partition + il_size, il_offset = def_local_partition(nx, npes, mype) + logging.debug('Local partition definition') + logging.debug('il_size = {} il_offset = {} mype = {}'.format(il_size, il_offset, mype)) + partition = pyoasis.ApplePartition(il_offset, il_size) + if CO2_CMODE or CO2_EMODE: + #nx_co2 = 2 # for 2 hemisphere box model + nx_co2 = 1 + if mype == 0: + logging.debug('Local serial partition') + logging.debug('nx_co2 = {} mype = {}'.format(nx_co2, mype)) + partition2 = pyoasis.SerialPartition(nx_co2) + else: + nx_co2 = 0 + partition2 = None + + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + # DECLARATION OF THE COUPLING FIELDS + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + A_SST = pyoasis.Var("A_SST", partition, OASIS.IN) + A_Ice_frac = pyoasis.Var("A_Ice_frac", partition, OASIS.IN) + logging.debug('var_id A_SST, var_id A_Ice_frac {} {}'.format(A_SST._id, A_Ice_frac._id)) + if CO2_CMODE: + if mype == 0: + A_CO2_cconc = pyoasis.Var("A_CO2_cconc", partition2, OASIS.IN) + logging.debug('var_id A_CO2_cconc {}'.format(A_CO2_cconc._id)) + A_CO2_econc = pyoasis.Var("A_CO2_econc", partition2, OASIS.IN) + logging.debug('var_id A_CO2_econc {}'.format(A_CO2_cconc._id)) + if CO2_EMODE: + A_CO2_emis = pyoasis.Var("A_CO2_emis", partition, OASIS.IN) + logging.debug('var_id A_CO2_emis {}'.format(A_CO2_emis._id)) + A_CO2_veg = pyoasis.Var("A_CO2_veg", partition, OASIS.IN) + logging.debug('var_id A_CO2_veg {}'.format(A_CO2_veg._id)) + A_CO2_fire = pyoasis.Var("A_CO2_fire", partition, OASIS.IN) + logging.debug('var_id A_CO2_fire {}'.format(A_CO2_fire._id)) + A_CO2_oce = pyoasis.Var("A_CO2_oce", partition, OASIS.IN) + logging.debug('var_id A_CO2_oce {}'.format(A_CO2_oce._id)) + + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + # TERMINATION OF DEFINITION PHASE + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + logging.debug('End of initialisation phase') + + comp.enddef() + + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + # TIME STEP LOOP + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + logging.debug('Timestep, field min, mean and max value') + + field_recv_A_SST = pyoasis.asarray(np.full(il_size, -1.0)) + field_recv_A_Ice_frac = pyoasis.asarray(np.full(il_size, -1.0)) + if CO2_CMODE and mype == 0: + field_recv_A_CO2_cconc = pyoasis.asarray(np.full(nx_co2, -1.0)) + field_recv_A_CO2_econc = pyoasis.asarray(np.full(nx_co2, -1.0)) + if CO2_EMODE: + field_recv_A_CO2_emis = pyoasis.asarray(np.full(il_size, -1.0)) + field_recv_A_CO2_veg = pyoasis.asarray(np.full(il_size, -1.0)) + field_recv_A_CO2_fire = pyoasis.asarray(np.full(il_size, -1.0)) + field_recv_A_CO2_oce = pyoasis.asarray(np.full(il_size, -1.0)) + + for itap_sec in range(0, RUN_LENGTH_SEC, COUPLING_INTERVAL): + A_SST.get(itap_sec, field_recv_A_SST) + A_Ice_frac.get(itap_sec, field_recv_A_Ice_frac) + + logging.debug('ITAP_SEC: {}'.format(itap_sec)) + logging.debug('A_SST -> {:.3e} {:.3e} {:.3e}'.format( + np.min(field_recv_A_SST), + np.mean(field_recv_A_SST), + np.max(field_recv_A_SST))) + logging.debug('A_Ice_frac -> {:.3e} {:.3e} {:.3e}'.format( + np.min(field_recv_A_Ice_frac), + np.mean(field_recv_A_Ice_frac), + np.max(field_recv_A_Ice_frac))) + if CO2_CMODE: + if mype == 0: + A_CO2_cconc.get(itap_sec, field_recv_A_CO2_cconc) + logging.debug('A_CO2_cconc -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_cconc), np.mean(field_recv_A_CO2_cconc), np.max(field_recv_A_CO2_cconc))) + A_CO2_econc.get(itap_sec, field_recv_A_CO2_econc) + logging.debug('A_CO2_econc -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_econc), np.mean(field_recv_A_CO2_econc), np.max(field_recv_A_CO2_econc))) + if CO2_EMODE: + A_CO2_emis.get(itap_sec, field_recv_A_CO2_emis) + logging.debug('A_CO2_emis -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_emis), np.mean(field_recv_A_CO2_emis), np.max(field_recv_A_CO2_emis))) + A_CO2_veg.get(itap_sec, field_recv_A_CO2_veg) + logging.debug('A_CO2_veg -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_veg), np.mean(field_recv_A_CO2_veg), np.max(field_recv_A_CO2_veg))) + A_CO2_fire.get(itap_sec, field_recv_A_CO2_fire) + logging.debug('A_CO2_fire -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_fire), np.mean(field_recv_A_CO2_fire), np.max(field_recv_A_CO2_fire))) + A_CO2_oce.get(itap_sec, field_recv_A_CO2_oce) + logging.debug('A_CO2_oce -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_oce), np.mean(field_recv_A_CO2_oce), np.max(field_recv_A_CO2_oce))) + logging.debug('--------------------------------------\n') + + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + # TERMINATION + # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + logging.debug('End of the program') + + del comp diff --git a/scripts/convert-ece4pyreader-grids_ct.sh b/scripts/convert-ece4pyreader-grids_ct.sh new file mode 100644 index 0000000..5ad0988 --- /dev/null +++ b/scripts/convert-ece4pyreader-grids_ct.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +set -xuve + +#griddir=/gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids +griddir=. + +newdate=$1 +#taxis="settaxis,21450101,00:00:00,1day" +taxis="settaxis,$newdate,00:00:00,1day" + +gridname_ifs=L128 +griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids +gridname_AMIP=AMIP +griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt +griddef_co2=grid-${grid_co2_emis}.txt +model_ifs=IFS_TOY +vars_ifs="A_SST A_Ice_frac" +[ -f namelist.co2box ] && CO2BOX=true || CO2BOX=false +[[ ${CO2_EMODE} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_veg A_CO2_fire A_CO2_oce" + +vars_amip="AMIP_sst AMIP_sic" + +grids="AMIP L128 B128 A128 R128" +#[[ ${CO2_EMODE} == true ]] && grids+=" CO2_emis" +grids+=" ${grid_co2_emis}" +# copy from runtime dir the following files grids.nc areas.nc masks.nc +for gridname in ${grids} +do + if [[ ${gridname} == AMIP ]] ; then + format=nc + suffix=".nc" + griddef=${griddef_amip} + elif [[ ${gridname} == CEDS ]] ; then + format=nc + suffix=".nc" + griddef=grid-CEDS.txt + elif [[ ${gridname} == REG_1X1 ]] ; then + format=nc + suffix=".nc" + griddef=grid-REG_1X1.txt + else + format=grb1 + suffix=".grb" + griddef=${griddef_ifs} + fi + cdo -f $format -setgrid,${griddir}/${griddef} -selvar,${gridname}.msk masks.nc masks_${gridname}${suffix} + cdo -f $format -setgrid,${griddir}/${griddef} -selvar,${gridname}.srf areas.nc areas_${gridname}${suffix} + if [[ ${format} == "grb1" ]] ; then + for t in masks areas ; do + cdo -f nc -setgridtype,regularnn ${t}_${gridname}.grb ${t}_${gridname}.nc + done + fi +done + +vars_co2="" +vars_co2_co2box="" +vars_co2_ifs="" +if [[ ${CO2BOX} == true ]]; then + model_amip=CO2BOX + model_co2=CO2BOX + [[ ${CO2_CMODE} == true ]] && vars_co2_co2box="CO2BOX_CO2_cconc CO2BOX_CO2_econc" + [[ ${CO2_CMODE} == true ]] && vars_co2_ifs="A_CO2_cconc A_CO2_econc" + [[ ${CO2_EMODE} == true ]] && vars_co2="CO2BOX_CO2_emis" +else + model_amip=AMIPFORC + model_co2=AMIPFORC + [[ ${CO2_EMODE} == true ]] && vars_co2="AMIP_CO2_emis" +fi + +for v in $vars_ifs +do + cdo -O -f grb1 -r $taxis -setgrid,${griddir}/${griddef_ifs} ${v}_${model_ifs}_??.nc ${v}.grb + cdo -O -f nc -r $taxis -setgridtype,regular -chvar,var1,${v} ${v}.grb ${v}.nc +done + +for v in $vars_amip +do + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_amip} ${v}_${model_amip}_??.nc ${v}.nc +done + +for v in $vars_co2 +do + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_co2} ${v}_${model_co2}_??.nc ${v}.nc +done +for v in $vars_co2_co2box +do + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_co2}_??.nc ${v}.nc +done +for v in $vars_co2_ifs +do + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_ifs}_??.nc ${v}.nc +done + + + diff --git a/scripts/fix-gfas.sh b/scripts/fix-gfas.sh new file mode 100644 index 0000000..14bbd66 --- /dev/null +++ b/scripts/fix-gfas.sh @@ -0,0 +1,18 @@ +set -xuve + +reftime="2000-01-01,00:00:00,days" + +rm -f tmp_*.nc + +for year in 2014 +do + for f in gfas_1x1_${year}??.nc + do + yyyy=${f:9:4} + mm=${f:13:2} + echo $f $yyyy $mm + cdo -r -O -setreftime,${reftime} -settaxis,${yyyy}-${mm}-01,00:00:00,1day $f tmp_${yyyy}${mm}.nc + done + + cdo -O -f nc4c -z zip_2 mergetime tmp_??????.nc gfas_1x1_${year}.nc +done diff --git a/scripts/fix-sib.sh b/scripts/fix-sib.sh new file mode 100644 index 0000000..f88d343 --- /dev/null +++ b/scripts/fix-sib.sh @@ -0,0 +1,19 @@ +set -xuve + +reftime="2000-01-01,00:00:00,days" + +rm -f tmp_*.nc + +for year in 2014 +do + for f in SiB4v2_BioFluxes_v246_1x1_${year}??.nc + do + yyyy=${f:26:4} + mm=${f:30:2} + echo $f $yyyy $mm + cdo -r -O -setreftime,${reftime} -settaxis,${yyyy}-${mm}-01,00:00:00,3hour $f tmp_${yyyy}${mm}.nc + done + + cdo -O -f nc4c -z zip_2 mergetime tmp_??????.nc SiB4v2_BioFluxes_v246_1x1_2014_3hour.nc + cdo -O settime,00:00:00 -daymean SiB4v2_BioFluxes_v246_1x1_2014_3hour.nc SiB4v2_BioFluxes_v246_1x1_2014_day.nc +done diff --git a/scripts/namcouple_co2_ct.sh b/scripts/namcouple_co2_ct.sh new file mode 100644 index 0000000..9dd30e1 --- /dev/null +++ b/scripts/namcouple_co2_ct.sh @@ -0,0 +1,43 @@ +cat << EOF +# ================================================================================================= +# General OASIS configuration +# ================================================================================================= + \$NFIELDS + 3 + \$END +# ------------------------------------------------------------------------------------------------- + \$RUNTIME + ${leg_length_sec} + \$END +# ------------------------------------------------------------------------------------------------- + \$NLOGPRT + 0 0 + \$END +# ------------------------------------------------------------------------------------------------- + \$STRINGS +# ================================================================================================= +# Fields send from AMIP to IFS +# ================================================================================================= +# --- AMIP forcing data --- [ifs amip] + AMIP_sst:AMIP_sic A_SST:A_Ice_frac 1 86400 1 rstas.nc EXPOUT + AMIP L${ifs_grid} LAG=0 + P 0 P 0 + SCRIPR + GAUSWGT LR SCALAR LATITUDE 1 9 2.0 + + AMIP_CO2_emis A_CO2_emis 1 86400 1 rstas.nc EXPOUT + CO2_emis B${ifs_grid} LAG=0 + P 0 P 0 + SCRIPR CONSERV + GAUSWGT LR SCALAR LATITUDE 1 9 2.0 + + AMIP_CO2_veg:AMIP_CO2_ocean A_CO2_veg:A_CO2_ocean 1 86400 1 rstas.nc EXPOUT + CO2_emis B${ifs_grid} LAG=0 + P 0 P 0 + SCRIPR CONSERV + GAUSWGT LR SCALAR LATITUDE 1 9 2.0 + +# ------------------------------------------------------------------------------------------------- + \$END +# ================================================================================================= +EOF diff --git a/scripts/namcouple_co2box_ct.sh b/scripts/namcouple_co2box_ct.sh new file mode 100644 index 0000000..a58888e --- /dev/null +++ b/scripts/namcouple_co2box_ct.sh @@ -0,0 +1,79 @@ +nfields=1 +if [ ${CO2_CMODE} == true ] ; then + nfields=$((nfields+1)) +fi +if [ ${CO2_EMODE} == true ] ; then + nfields=$((nfields+4)) +fi +cat << EOF +# ================================================================================================= +# General OASIS configuration +# ================================================================================================= + \$NFIELDS + ${nfields} + \$END +# ------------------------------------------------------------------------------------------------- + \$RUNTIME + ${leg_length_sec} + \$END +# ------------------------------------------------------------------------------------------------- + \$NLOGPRT + 30 0 + \$END +# ------------------------------------------------------------------------------------------------- + \$STRINGS +# ================================================================================================= +# Fields send from AMIP to IFS +# ================================================================================================= +# --- AMIP forcing data --- [ifs amip] + AMIP_sst:AMIP_sic A_SST:A_Ice_frac 1 86400 1 rstas.nc EXPOUT + AMIP L${ifs_grid} LAG=0 + P 0 P 0 + SCRIPR + GAUSWGT LR SCALAR LATITUDE 1 9 2.0 +EOF +if [ ${CO2_CMODE} == true ] ; then +cat << EOF + + CO2BOX_CO2_cconc:CO2BOX_CO2_econc A_CO2_cconc:A_CO2_econc 1 86400 1 rstas.nc EXPOUT + GLOBAL GLOBAL LAG=0 + P 0 P 0 + LOCTRANS + AVERAGE + +EOF +fi +if [ ${CO2_EMODE} == true ] ; then +cat << EOF + + CO2BOX_CO2_emis A_CO2_emis 1 86400 1 rstas.nc EXPOUT + ${grid_co2_emis} B${ifs_grid} LAG=0 + P 0 P 0 + SCRIPR CONSERV + GAUSWGT LR SCALAR LATITUDE 1 9 2.0 + + CO2BOX_CO2_veg A_CO2_veg 1 86400 1 rstas.nc EXPOUT + ${grid_co2_veg} R${ifs_grid} LAG=0 + P 0 P 0 + SCRIPR CONSERV + GAUSWGT LR SCALAR LATITUDE 1 9 2.0 + + CO2BOX_CO2_fire A_CO2_fire 1 86400 1 rstas.nc EXPOUT + ${grid_co2_fire} R${ifs_grid} LAG=0 + P 0 P 0 + SCRIPR CONSERV + GAUSWGT LR SCALAR LATITUDE 1 9 2.0 + + CO2BOX_CO2_oce A_CO2_oce 1 86400 1 rstas.nc EXPOUT + ${grid_co2_oce} A${ifs_grid} LAG=0 + P 0 P 0 + SCRIPR CONSERV + GAUSWGT LR SCALAR LATITUDE 1 9 2.0 + +EOF +fi +cat << EOF +# ------------------------------------------------------------------------------------------------- + \$END +# ================================================================================================= +EOF diff --git a/scripts/namelist.co2box_ct.sh b/scripts/namelist.co2box_ct.sh new file mode 100644 index 0000000..6f66b26 --- /dev/null +++ b/scripts/namelist.co2box_ct.sh @@ -0,0 +1,20 @@ +cat << EOF +!----------------------------------------------------------------------- +&NAMCO2BOX +!----------------------------------------------------------------------- + RunLengthSec = ${leg_length_sec} + TimeStepSec = ${cpl_freq_amip_sec} + StartYear = ${leg_start_date_yyyymmdd:0:4} + StartMonth = ${leg_start_date_yyyymmdd:4:2} + StartDay = ${leg_start_date_yyyymmdd:6:2} + FixYear = ${ifs_cmip_fixyear} + +${sst_conf_var} +${sic_conf_var} +${co2_conf_var} +${oasis_conf_var} + + LDebug = false +!----------------------------------------------------------------------- +/ +EOF diff --git a/scripts/run_example_ct.sh b/scripts/run_example_ct.sh new file mode 100644 index 0000000..8ab7b61 --- /dev/null +++ b/scripts/run_example_ct.sh @@ -0,0 +1,256 @@ +#!/bin/bash +## Usage +if [ $# -ne 9 ]; then + echo 'Invalid args.' + echo 'Usage ./run_example.sh ' + echo 'Try ./run_example.sh python forcing 4 1990-01-01 1991-01-01 0 L128 true' + exit 1 +fi + +set -xuve + +model=$1 +amip_mode=$2 # forcing or primavera +# - Define number of processes to run each executable +nproc_exe1=$3 +nproc_exe2=1 # AMIP is always one process + +leg_start_date=$4 +leg_end_date=$5 +ifs_cmip_fixyear=$6 +ifs_grid=$7 +amip_interpolate=$8 +co2_interpolate=$9 +host=`uname -n` +user=`whoami` + +## - Define paths +srcdir=`pwd` +datadir=$srcdir/data + + +exe1='python3 IFS_toy.py' +source_exe1=$srcdir/IFS_toy.py + +if [ $model = fortran ]; then + exe2='./amip-forcing' + if [ $amip_mode = forcing ]; then + source_exe2=$srcdir/../sources/amip-forcing/bin/amip-forcing + else + source_exe2=$srcdir/../sources/amip-primavera/bin/amip-forcing + fi +elif [ $model = python ] || [ $model = pythoncompat ]; then + exe2='python3 amip_forcing.py' + # exe2='coverage run -p --branch --include=*/amip-forcing/src/python/* amip_forcing.py' + # exe2='python3 -m cProfile -s cumtime amip_forcing.py' + source_exe2=$srcdir/../sources/amip-forcing/src/python/*.py +elif [ $model = datacoupler ] ; then + exe2='python3 AMIPDataCoupler.py' + # exe2='coverage run -p --branch --include=*/amip-forcing/src/python/* amip_forcing.py' + # exe2='python3 -m cProfile -s cumtime amip_forcing.py' + source_exe2=$srcdir/../sources/data-coupler/*.py +elif [ $model = co2box ] ; then + exe2='python3 CO2BoxDataCoupler.py' + # exe2='coverage run -p --branch --include=*/amip-forcing/src/python/* amip_forcing.py' + # exe2='python3 -m cProfile -s cumtime amip_forcing.py' + source_exe2=$srcdir/../sources/data-coupler/*.py +else + echo 'Invalid args. You must specify a language for the AMIP reader: | ' + exit 1 +fi + +CO2_CMODE=false +CO2_EMODE=false + +# - Define rundir +rundir=${srcdir}/work_${model}_${amip_mode}_${nproc_exe1}_${leg_start_date}_${leg_end_date}_${ifs_cmip_fixyear}_${ifs_grid}_${amip_interpolate} +# export COVERAGE_FILE=${rundir}/../.coverage + +echo '*****************************************************************' +#echo '*** '$casename' : '$run +echo '' +echo 'Rundir :' $rundir +#echo 'Architecture :' $arch +echo 'Host : '$host +echo 'User : '$user +echo '' +echo $exe1' runs on '$nproc_exe1 'processes' +echo $exe2' runs on '$nproc_exe2 'processes' +echo '' +###################################################################### +### Create rundir and copy everything needed + +\rm -fr $rundir +mkdir -p $rundir +ln -sf $datadir/ICMGGa22e+000000 $rundir/. +ln -sf $datadir/*.txt $rundir/. +# Get SST and SIC +#if [ $amip_mode = forcing ] || [ $amip_mode = co2 ]; then +if [ $amip_mode = forcing ] || [ $amip_mode = co2 ] ; then + ln -sf $datadir/forcing/siconcbcs*.nc $rundir/. + ln -sf $datadir/forcing/tosbcs*.nc $rundir/. + ln -sf $datadir/forcing/rmp_AMIP_to_L${ifs_grid}_GAUSWGT*.nc $rundir/. + if [ $amip_mode = co2 ]; then + for f in `ls $datadir/co2/*.nc*` + do + ln -sf $f $rundir/. + done + + fi +else + ln -sf $datadir/$amip_mode/HadI*.nc $rundir/. + ln -sf $datadir/$amip_mode/rmp_PSIC_to_${ifs_grid}_GAUSWGT.nc $rundir/. + ln -sf $datadir/$amip_mode/rmp_PSST_to_${ifs_grid}_GAUSWGT.nc $rundir/. +fi +# Get grids and masks +if [ $model = fortran ] || [ $model = pythoncompat ]; then + cp -f $datadir/$amip_mode/masks.nc $rundir/. + cp -f $datadir/$amip_mode/grids.nc $rundir/. + cp -f $datadir/$amip_mode/areas.nc $rundir/. +else + cp -f $datadir/grids-noamip.nc $rundir/grids.nc + cp -f $datadir/masks-noamip.nc $rundir/masks.nc + cp -f $datadir/areas-noamip.nc $rundir/areas.nc +fi +cp -f $datadir/*.sh $rundir/. +cp -f $source_exe1 $rundir/. +ln -sf $source_exe2 $rundir/. +cd $rundir + +### Generate namelist +leg_length_sec=$(( $(date -u -d "${leg_end_date}" +%s) - $(date -u -d "${leg_start_date}" +%s) )) +cpl_freq_amip_sec=86400 # Always +leg_start_date_yyyymmdd=$(date -u -d "${leg_start_date}" +%Y%m%d) + +if [ $model = fortran ] || [ $model = pythoncompat ]; then + if [ $amip_mode = forcing ]; then + . ./namelist.amip.sh > ./namelist.amip + else + . ./namelist_primavera.amip.sh > ./namelist.amip + fi +else + #if [ $amip_mode = forcing ] || [ $amip_mode = co2 ]; then + if [ $amip_mode = forcing ] || [ $amip_mode = co2 ]; then + i=1 + if [ $model = co2box ] || [ $model = datacoupler ]; then + var=FileInputVars + else + var=Vars + fi + sst_conf_var=${var}"("$((i++))",:) = 'AMIP_sst_monthly', 'AMIP', 'AMIP_sst', 'tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc', 'tosbcs', 1870, 2016, 'monthly', ${amip_interpolate}, 1, 273.15, 271.38, ,true,true," + sic_conf_var=${var}"("$((i++))",:) = 'AMIP_sic_monthly', 'AMIP', 'AMIP_sic', 'siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc', 'siconcbcs', 1870, 2016, 'monthly', ${amip_interpolate}, 0.01, 0, 0, 1,true,true," + + j=1 + oasis_conf_var="!OasisOutputVars(j,:) = , , , , , \n" + oasis_conf_var=$'\n'"OasisOutputVars("$((j++))",:) = 'AMIP_sst', 'AMIP', 'daily', 1, 0, true," + oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = 'AMIP_sic', 'AMIP', 'daily', 1, 0, true," + if [ $amip_mode = co2 ]; then + co2_conf_var="" + co2_conf_var+="!FileInputVars(i,:) = "$'\n' + #[ $model = co2box ] && mod=CO2BOX || mod=AMIP + if [ $model = co2box ] ; then + mod=CO2BOX + CO2_CMODE=false # set to false to disable co2 concentrations reading + CO2_EMODE=true # set to false to disable emissions reading + #if CO2_EMODE=true, choose the CO2 flux source to use, currently CARBON_TRACKER and CEDS are supported + CO2_FLUX_SOURCE="CARBON_TRACKER" + #CO2_FLUX_SOURCE="CEDS" + else + mod=AMIP + CO2_CMODE=false # don't change this! + CO2_EMODE=true # don't change this! + CO2_FLUX_SOURCE="" # don't change this! + fi + #this fix is required to correctly read the co2 files which havereftime 0-1-1, which isn't supported by python netcdf4 + #cdo -R -setreftime,1849-01-01,00:00 mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.mod + #this fix is required to correctly read the CO2_em_monthly files which have a 365day calendar and also to convert from a grid point/sectors fields to a global one + #cdo -L -setcalendar,gregorian -fldsum -vertsum -mul CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc co2-area.nc CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc + if [ ${CO2_CMODE} == true ] ; then + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_cconc_monthly', 'GLOBAL', '"$mod"_CO2_cconc', 'mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.mod', 'mole_fraction_of_carbon_dioxide_in_air', 1849, 2014, 'monthly', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_econc_monthly', 'GLOBAL', '"$mod"_CO2_econc', 'mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.mod', 'mole_fraction_of_carbon_dioxide_in_air', 1849, 2014, 'monthly', ${co2_interpolate}, 'co2_ppm_to_mass', 0, , ,false,false,"$'\n' + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_emis_monthly_GLOBAL', 'GLOBAL', '"$mod"_CO2_econc', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 86400, 0, , ,true,true,"$'\n' + # add veg/ocean fluxes equal to 0.5/0.1 that of emissions, for demonstration purposes + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_veg_monthly_GLOBAL', 'GLOBAL', '"$mod"_CO2_econc', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 43200, 0, , ,true,true,"$'\n' + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_oce_monthly_GLOBAL', 'GLOBAL', '"$mod"_CO2_econc', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 8640, 0, , ,true,true,"$'\n' + fi + if [ ${CO2_EMODE} == true ] ; then + if [ ${CO2_FLUX_SOURCE} == "CEDS" ] ; then + # this is the 3D monthly emissions from input4MIPS used for CMIP6, the calendar fix mentionned below is probably required + grid_co2_emis="CEDS" + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_emis_CEDS_monthly', '${grid_co2_emis}', '"$mod"_CO2_emis', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' + # add veg/fire/ocean fluxes equal to 0.5/0.1/0.05 that of emissions, for demonstration purposes + grid_co2_veg="CEDS" + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_veg_CEDS_monthly', '${grid_co2_veg}', '"$mod"_CO2_veg', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.5, 0, , ,true,true,"$'\n' + grid_co2_fire="CEDS" + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_fire_CEDS_monthly', '${grid_co2_fire}', '"$mod"_CO2_fire', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.1, 0, , ,true,true,"$'\n' + grid_co2_oce="CEDS" + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_oce_CEDS_monthly', '${grid_co2_oce}', '"$mod"_CO2_oce', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.5, 0, , ,true,true,"$'\n' + elif [ ${CO2_FLUX_SOURCE} == "CARBON_TRACKER" ] ; then + # these files are from Carbon Tracker Europe and partners (SiB4v2 for vegetation, GFAS for fires, GridFED for emissions and CarboScope for ocean) + # original files are in /hpcperm/rujh/data/2014 and "fixed" files are in /hpcperm/c3et/work/python-amip-reader/tests/data/co2 + + # cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,month GCP_Global_1x1_2014.nc GCP_Global_1x1_2014.mod.nc + grid_co2_emis="REG_1X1" + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_emis_GCP_monthly', '${grid_co2_emis}', '"$mod"_CO2_emis', 'GCP_Global_1x1_2014.mod.nc', 'fossilfuel_burning_carbon_flux', 2000, 2014, 'monthly', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' + + # use script fix-sib.sh for fixing and merging the SiB4v2 files + grid_co2_veg="REG_1X1" + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_veg_sib_daily', '${grid_co2_veg}', '"$mod"_CO2_veg', 'SiB4v2_BioFluxes_v246_1x1_2014_day.nc', 'nee', 2000, 2014, 'daily', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' + + # use script fix-gfas.sh for fixing and merging the GFAS files + grid_co2_fire="REG_1X1" + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_fire_gfas_daily', '${grid_co2_fire}', '"$mod"_CO2_fire', 'gfas_1x1_2014.nc', 'co2fire', 2000, 2014, 'daily', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' + + # cdo -r -O -setreftime,2000-01-01 -settaxis,2014-01-01 -delvar,co2flux_ocean_monthly oc_v2021_monthly_mol_s_m2_2014.nc oc_v2021_daily_mol_s_m2_2014.mod.nc + # cdo -r -O -setreftime,2000-01-01 -settaxis,2014-01-01 -delvar,co2flux_ocean oc_v2021_monthly_mol_s_m2_2014.nc oc_v2021_monthly_mol_s_m2_2014.mod.nc + grid_co2_oce="REG_1X1" + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_oce_carboscope_daily', '${grid_co2_oce}', '"$mod"_CO2_oce', 'oc_v2021_daily_mol_s_m2_2014.mod.nc', 'co2flux_ocean', 2000, 2014, 'daily', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' + else + echo "Unsupported CO2_FLUX_SOURCE ${CO2_FLUX_SOURCE}" + exit 1 + fi + fi + #OasisOutputVars(i,:) = + if [ ${CO2_CMODE} == true ] ; then + oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_cconc', 'GLOBAL', 'daily', 1, 0, true," + oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_econc', 'GLOBAL', 'daily', 'co2_mass_to_ppm', 0, false," + fi + if [ ${CO2_EMODE} == true ] ; then + oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_emis', '${grid_co2_emis}', 'daily', 1, 0, true," + oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_veg', '${grid_co2_veg}', 'daily', 1, 0, true," + oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_fire', '${grid_co2_fire}', 'daily', 1, 0, true," + oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_oce', '${grid_co2_oce}', 'daily', 1, 0, true," + fi + else + co2_conf_var="" + fi + else + sst_conf_var="Vars(1,:) = 'AMIP_sst_daily', 'PSST', 'AMIP_sst', 'HadISST2_prelim_0to360_alldays_sst_[year].nc', 'sst', 1850, 2016, 'daily', false, 1, 0, , ," + sic_conf_var="Vars(2,:) = 'AMIP_sic_daily', 'PSIC', 'AMIP_sic', 'HadISST2_prelim_0to360_alldays_sic_[year].nc', 'sic', 1850, 2016, 'daily', false, 1, 0, , ," + co2_conf_var="" + oasis_conf_var="" + fi + . ./namelist_python.amip.sh > ./namelist.amip + [ $model = co2box ] && . ./namelist.co2box.sh > ./namelist.co2box +fi +if [ $amip_mode = forcing ]; then + . ./namcouple.sh > ./namcouple +elif [ $amip_mode = co2 ]; then + [ $model = co2box ] && . ./namcouple_co2box.sh > ./namcouple || . ./namcouple_co2.sh > ./namcouple +else + . ./namcouple_primavera.sh > ./namcouple +fi + +###################################################################### +### Definition of mpirun command and batch script + +echo 'Executing the model using mpirun : ${MPIRUN}' +${MPIRUN} -np $nproc_exe1 $exe1 : -np $nproc_exe2 $exe2 + +# convert output +. convert-ece4pyreader-grids.sh ${leg_start_date} + +#echo $casename 'is executed or submitted to queue.' +echo 'Results are found in rundir : '$rundir + +###################################################################### -- GitLab From 4ed66ded5f0277ace2751c281cc6dbaccd33585b Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 4 Oct 2023 16:47:27 +0200 Subject: [PATCH 02/17] WIP: adding flux coupler tmplate --- ...mplate_conf_datacoupler_co2flux _ceds.yaml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 scripts/template_conf_datacoupler_co2flux _ceds.yaml diff --git a/scripts/template_conf_datacoupler_co2flux _ceds.yaml b/scripts/template_conf_datacoupler_co2flux _ceds.yaml new file mode 100755 index 0000000..a11046d --- /dev/null +++ b/scripts/template_conf_datacoupler_co2flux _ceds.yaml @@ -0,0 +1,41 @@ +cat << EOF +# YAML input file for DataCoupler, It will be ingested and turn to Experiment YAML file + +## Model Information +ModelNameSend : AMIPFORC +ModelNameReceive : IFS_TOY +LogFileName : amip.log + +## Run Information +RunLengthSec : ${leg_length_sec} +TimeStepSec : ${cpl_freq_amip_sec} +StartYear : ${leg_start_date_yyyymmdd:0:4} +StartMonth : ${leg_start_date_yyyymmdd:4:2} +StartDay : ${leg_start_date_yyyymmdd:6:2} +FixYear : ${ifs_cmip_fixyear} +GridInfo : 88838 # number of grid cells : L080_NX = 35718 @ T159 resolution / L128_NX = 88838 @ T255 resolution / L256_NX = 348528 @ T511 resolution + +## Coupling Information +FileInputVars: + AMIP_sst_monthly : { id : AMIP_sst_monthly, grid_name: AMIP, oasis_name: AMIP_sst, file_pattern: tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: tosbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 1, offset: 273.15, min: 271.38, max: , update: true, accum: true} + AMIP_sic_monthly : { id : AMIP_sic_monthly, grid_name: AMIP, oasis_name: AMIP_sic, file_pattern: siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: siconcbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 0.01, offset: 0, min: 0, max: 1, update: true, accum: true} + CO2_em_monthly : { id : CO2_em_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_emis, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 1, offset: 0, min: , max: , update: true, accum: true} + + CO2_veg_monthly: { id : CO2_veg_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_veg, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} + CO2_fire_monthly: { id : CO2_fire_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_fire, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} + + CO2_ocean_monthly: { id : CO2_ocean_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_ocean, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.1, offset: 0, min: , max: , update: true, accum: true} + +OasisOutputVars: + AMIP_sst : { send_id: AMIP_sst, receive_id: A_SST, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_sic : { send_id: AMIP_sic, receive_id: A_Ice_frac, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_emis : { send_id: AMIP_CO2_emis, receive_id: A_CO2_emis, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + + AMIP_CO2_veg : { send_id: AMIP_CO2_veg, receive_id: A_CO2_veg, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_fire : { send_id: AMIP_CO2_fire, receive_id: A_CO2_fire, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + + AMIP_CO2_ocean : { send_id: AMIP_CO2_ocean, receive_id: A_CO2_ocean, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + +LDebug : false +EOF + -- GitLab From 6276cd8792b7beefcf7cecbe223e6e4916987b64 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Thu, 5 Oct 2023 15:24:55 +0200 Subject: [PATCH 03/17] FireFlux and CEDS gird added, tested on mn4 for amip, co2flux_cdes, co2box --- scripts/convert-ece4pyreader-grids.sh | 8 ++++---- scripts/launch_ece3_data_coupler_mn4.cmd | 7 ++++--- scripts/template_conf_datacoupler_co2flux _ceds.yaml | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/convert-ece4pyreader-grids.sh b/scripts/convert-ece4pyreader-grids.sh index b3a979c..7e66389 100755 --- a/scripts/convert-ece4pyreader-grids.sh +++ b/scripts/convert-ece4pyreader-grids.sh @@ -14,14 +14,14 @@ griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/script gridname_AMIP=AMIP griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt gridname_co2=CO2 -griddef_co2=grid-co2_emis.txt # cdo griddes > grid-co2_emis.txt +griddef_co2=grid-CDES.txt # cdo griddes > grid-co2_emis.txt model_ifs=IFS_TOY # set vars according to model_mode # TODO: They will be replaced by python YAML reader [ $model_mode = "co2box" ] && CO2BOX=true || CO2BOX=false -[ $model_mode = "co2flux" ] && CO2FLUX=true || CO2FLUX=false +[ $model_mode = "co2flux_CDES" ] && CO2FLUX=true || CO2FLUX=false if [[ ${CO2BOX} == true ]] ; then grids="" @@ -34,10 +34,10 @@ if [[ ${CO2BOX} == true ]] ; then vars_co2_ifs="A_CO2_cconc A_CO2_econc" else grids="AMIP L128" #B128 A128 R128 - [[ ${CO2FLUX} == true ]] && grids+=" CO2_emis" + [[ ${CO2FLUX} == true ]] && grids+="CDES" vars_amip="AMIP_sst AMIP_sic" vars_ifs="A_SST A_Ice_frac" - [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_land A_CO2_ocean" + [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_veg A_CO2_fire A_CO2_oce" model_amip=AMIPFORC model_co2=AMIPFORC [[ ${CO2FLUX} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" diff --git a/scripts/launch_ece3_data_coupler_mn4.cmd b/scripts/launch_ece3_data_coupler_mn4.cmd index 99e7fe6..7205f4b 100644 --- a/scripts/launch_ece3_data_coupler_mn4.cmd +++ b/scripts/launch_ece3_data_coupler_mn4.cmd @@ -14,7 +14,8 @@ source modules.sh #AMIP Forcing only #bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml -#AMIP Forcing + co2flux -bash ./run_example.sh datacoupler co2flux 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux.yaml +#AMIP Forcing + co2flux_ceds +#bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux.yaml + #co2box only -#bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml +bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml diff --git a/scripts/template_conf_datacoupler_co2flux _ceds.yaml b/scripts/template_conf_datacoupler_co2flux _ceds.yaml index a11046d..4ae5f90 100755 --- a/scripts/template_conf_datacoupler_co2flux _ceds.yaml +++ b/scripts/template_conf_datacoupler_co2flux _ceds.yaml @@ -19,12 +19,12 @@ GridInfo : 88838 # number of grid cells : L080_NX = 35718 @ T159 resolu FileInputVars: AMIP_sst_monthly : { id : AMIP_sst_monthly, grid_name: AMIP, oasis_name: AMIP_sst, file_pattern: tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: tosbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 1, offset: 273.15, min: 271.38, max: , update: true, accum: true} AMIP_sic_monthly : { id : AMIP_sic_monthly, grid_name: AMIP, oasis_name: AMIP_sic, file_pattern: siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: siconcbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 0.01, offset: 0, min: 0, max: 1, update: true, accum: true} - CO2_em_monthly : { id : CO2_em_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_emis, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 1, offset: 0, min: , max: , update: true, accum: true} + CO2_emis_CEDS_monthly : { id : CO2_emis_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_emis, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 1, offset: 0, min: , max: , update: true, accum: true} - CO2_veg_monthly: { id : CO2_veg_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_veg, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} - CO2_fire_monthly: { id : CO2_fire_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_fire, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} + CO2_veg_CEDS_monthly: { id : CO2_veg_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_veg, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} + CO2_fire_CEDS_monthly: { id : CO2_fire_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_fire, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} - CO2_ocean_monthly: { id : CO2_ocean_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_ocean, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.1, offset: 0, min: , max: , update: true, accum: true} + CO2_oce_CEDS_monthly: { id : CO2_oce_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_ocean, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.1, offset: 0, min: , max: , update: true, accum: true} OasisOutputVars: AMIP_sst : { send_id: AMIP_sst, receive_id: A_SST, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } -- GitLab From 331e056d9eb5fe8a40ecec62a171308afaa9215c Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Fri, 6 Oct 2023 15:05:01 +0200 Subject: [PATCH 04/17] WIP: adding template for co2flux carbon tracker, not working yet --- ...f_datacoupler_co2flux _carbon_tracker.yaml | 44 +++++++++++++++++++ ...mplate_conf_datacoupler_co2flux _ceds.yaml | 26 +++++------ 2 files changed, 55 insertions(+), 15 deletions(-) create mode 100755 scripts/template_conf_datacoupler_co2flux _carbon_tracker.yaml diff --git a/scripts/template_conf_datacoupler_co2flux _carbon_tracker.yaml b/scripts/template_conf_datacoupler_co2flux _carbon_tracker.yaml new file mode 100755 index 0000000..33ab121 --- /dev/null +++ b/scripts/template_conf_datacoupler_co2flux _carbon_tracker.yaml @@ -0,0 +1,44 @@ +cat << EOF +# YAML input file for DataCoupler, It will be ingested and turn to Experiment YAML file + +## Model Information +ModelNameSend : AMIPFORC +ModelNameReceive : IFS_TOY +LogFileName : amip.log + +## Run Information +RunLengthSec : ${leg_length_sec} +TimeStepSec : ${cpl_freq_amip_sec} +StartYear : ${leg_start_date_yyyymmdd:0:4} +StartMonth : ${leg_start_date_yyyymmdd:4:2} +StartDay : ${leg_start_date_yyyymmdd:6:2} +FixYear : ${ifs_cmip_fixyear} +GridInfo : 88838 # number of grid cells : L080_NX = 35718 @ T159 resolution / L128_NX = 88838 @ T255 resolution / L256_NX = 348528 @ T511 resolution + +## Coupling Information +FileInputVars: + + # these files are from Carbon Tracker Europe and partners (SiB4v2 for vegetation, GFAS for fires, GridFED for emissions and CarboScope for ocean) + # original files are in /hpcperm/rujh/data/2014 and "fixed" files are in /hpcperm/c3et/work/python-amip-reader/tests/data/co2 + # cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,month GCP_Global_1x1_2014.nc GCP_Global_1x1_2014.mod.nc + + #co2_conf_var+=${var}"("$((i++))",:) = 'CO2_emis_GCP_monthly', '${grid_co2_emis}', '"$mod"_CO2_emis', 'GCP_Global_1x1_2014.mod.nc', 'fossilfuel_burning_carbon_flux', 2000, 2014, 'monthly', ${co2_interpolate}, 'co2_c_to_co2', 0, , ,true,true,"$'\n' + CO2_emis_GCP_monthly : { id : CO2_emis_GCP_monthly, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_emis, file_pattern: GCP_Global_1x1_2014.mod.nc, netcdf_variable: fossilfuel_burning_carbon_flux, yref_min : 2000, yref_max: 2014, timestep: monthly, interpolate : false, scale_factor: co2_c_to_co2, offset: 0, min: , max: , update: true, accum: true} + + #co2_conf_var+=${var}"("$((i++))",:) = 'CO2_veg_sib_daily', '${grid_co2_veg}', '"$mod"_CO2_veg', 'SiB4v2_BioFluxes_v246_1x1_2014_day.nc', 'nee', 2000, 2014, 'daily', ${co2_interpolate}, 'co2_mol_to_kg', 0, , ,true,true,"$'\n' + CO2_veg_sib_daily: { id : CO2_veg_sib_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_veg, file_pattern: SiB4v2_BioFluxes_v246_1x1_2014_day.nc, netcdf_variable: nee, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} + + #co2_conf_var+=${var}"("$((i++))",:) = 'CO2_fire_gfas_daily', '${grid_co2_fire}', '"$mod"_CO2_fire', 'gfas_1x1_2014.nc', 'co2fire', 2000, 2014, 'daily', ${co2_interpolate}, 'co2_mol_to_kg', 0, , ,true,true,"$'\n' + CO2_fire_gfas_daily: { id : CO2_fire_gfas_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_fire, file_pattern: gfas_1x1_2014.nc, netcdf_variable: co2fire, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} + + #co2_conf_var+=${var}"("$((i++))",:) = 'CO2_oce_carboscope_daily', '${grid_co2_oce}', '"$mod"_CO2_oce', 'oc_v2021_daily_mol_s_m2_2014.mod.nc', 'co2flux_ocean', 2000, 2014, 'daily', ${co2_interpolate}, 'co2_mol_to_kg', 0, , ,true,true,"$'\n' + CO2_oce_carboscope_daily: { id : CO2_oce_carboscope_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_oce, file_pattern: oc_v2021_daily_mol_s_m2_2014.mod.nc, netcdf_variable: co2flux_ocean, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} + +OasisOutputVars: + + # oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_econc', 'GLOBAL', 'daily', 'co2_mass_to_ppm', 0, false," + CO2BOX_CO2_econc : { send_id: CO2BOX_CO2_econc, receive_id: A_CO2_econc, send_grid_name: GLOBAL, receive_grid_name: GLOBAL, timestep: 'daily', scale_factor: 'co2_mass_to_ppm', offset: 0, reset: false } + +LDebug : false +EOF + diff --git a/scripts/template_conf_datacoupler_co2flux _ceds.yaml b/scripts/template_conf_datacoupler_co2flux _ceds.yaml index 4ae5f90..3167dd3 100755 --- a/scripts/template_conf_datacoupler_co2flux _ceds.yaml +++ b/scripts/template_conf_datacoupler_co2flux _ceds.yaml @@ -17,24 +17,20 @@ GridInfo : 88838 # number of grid cells : L080_NX = 35718 @ T159 resolu ## Coupling Information FileInputVars: - AMIP_sst_monthly : { id : AMIP_sst_monthly, grid_name: AMIP, oasis_name: AMIP_sst, file_pattern: tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: tosbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 1, offset: 273.15, min: 271.38, max: , update: true, accum: true} - AMIP_sic_monthly : { id : AMIP_sic_monthly, grid_name: AMIP, oasis_name: AMIP_sic, file_pattern: siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: siconcbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 0.01, offset: 0, min: 0, max: 1, update: true, accum: true} + AMIP_sst_monthly : { id : AMIP_sst_monthly, grid_name: AMIP, oasis_name: AMIP_sst, file_pattern: tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: tosbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 1, offset: 273.15, min: 271.38, max: , update: true, accum: true} + AMIP_sic_monthly : { id : AMIP_sic_monthly, grid_name: AMIP, oasis_name: AMIP_sic, file_pattern: siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: siconcbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 0.01, offset: 0, min: 0, max: 1, update: true, accum: true} CO2_emis_CEDS_monthly : { id : CO2_emis_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_emis, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 1, offset: 0, min: , max: , update: true, accum: true} - - CO2_veg_CEDS_monthly: { id : CO2_veg_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_veg, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} - CO2_fire_CEDS_monthly: { id : CO2_fire_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_fire, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} - - CO2_oce_CEDS_monthly: { id : CO2_oce_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_ocean, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.1, offset: 0, min: , max: , update: true, accum: true} + CO2_veg_CEDS_monthly: { id : CO2_veg_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_veg, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} + CO2_fire_CEDS_monthly: { id : CO2_fire_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_fire, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} + CO2_oce_CEDS_monthly: { id : CO2_oce_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_ocean, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.1, offset: 0, min: , max: , update: true, accum: true} OasisOutputVars: - AMIP_sst : { send_id: AMIP_sst, receive_id: A_SST, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - AMIP_sic : { send_id: AMIP_sic, receive_id: A_Ice_frac, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - AMIP_CO2_emis : { send_id: AMIP_CO2_emis, receive_id: A_CO2_emis, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - - AMIP_CO2_veg : { send_id: AMIP_CO2_veg, receive_id: A_CO2_veg, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - AMIP_CO2_fire : { send_id: AMIP_CO2_fire, receive_id: A_CO2_fire, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - - AMIP_CO2_ocean : { send_id: AMIP_CO2_ocean, receive_id: A_CO2_ocean, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_sst : { send_id: AMIP_sst, receive_id: A_SST, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_sic : { send_id: AMIP_sic, receive_id: A_Ice_frac, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_emis : { send_id: AMIP_CO2_emis, receive_id: A_CO2_emis, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_veg : { send_id: AMIP_CO2_veg, receive_id: A_CO2_veg, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_fire : { send_id: AMIP_CO2_fire, receive_id: A_CO2_fire, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_ocean : { send_id: AMIP_CO2_ocean, receive_id: A_CO2_ocean, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } LDebug : false EOF -- GitLab From 6254813af75a2197abdfc2a7acaf660b2af8811a Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Mon, 9 Oct 2023 17:01:14 +0200 Subject: [PATCH 05/17] WIP: minor naming correction --- scripts/convert-ece4pyreader-grids.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/convert-ece4pyreader-grids.sh b/scripts/convert-ece4pyreader-grids.sh index 7e66389..5edaaf3 100755 --- a/scripts/convert-ece4pyreader-grids.sh +++ b/scripts/convert-ece4pyreader-grids.sh @@ -14,14 +14,14 @@ griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/script gridname_AMIP=AMIP griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt gridname_co2=CO2 -griddef_co2=grid-CDES.txt # cdo griddes > grid-co2_emis.txt +griddef_co2=grid-CEDS.txt # cdo griddes > grid-co2_emis.txt model_ifs=IFS_TOY # set vars according to model_mode # TODO: They will be replaced by python YAML reader [ $model_mode = "co2box" ] && CO2BOX=true || CO2BOX=false -[ $model_mode = "co2flux_CDES" ] && CO2FLUX=true || CO2FLUX=false +[ $model_mode = "co2flux_CEDS" ] && CO2FLUX=true || CO2FLUX=false if [[ ${CO2BOX} == true ]] ; then grids="" @@ -34,7 +34,7 @@ if [[ ${CO2BOX} == true ]] ; then vars_co2_ifs="A_CO2_cconc A_CO2_econc" else grids="AMIP L128" #B128 A128 R128 - [[ ${CO2FLUX} == true ]] && grids+="CDES" + [[ ${CO2FLUX} == true ]] && grids+="CEDS" vars_amip="AMIP_sst AMIP_sic" vars_ifs="A_SST A_Ice_frac" [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_veg A_CO2_fire A_CO2_oce" -- GitLab From b50cd3430a6ae3f12904d63662826e84ce74b8a7 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Tue, 10 Oct 2023 17:15:42 +0200 Subject: [PATCH 06/17] WIP: issue with executing CEDS on mn4 --- scripts/cdo_cmd.sh | 40 ++++++++ scripts/convert-ece4pyreader-grids.sh | 8 +- scripts/convert-ece4pyreader-grids_moified.sh | 96 +++++++++++++++++++ scripts/launch_ece3_data_coupler_mn4.cmd | 9 +- scripts/run_example.sh | 4 +- ...mplate_conf_datacoupler_co2flux_ceds.yaml} | 0 6 files changed, 150 insertions(+), 7 deletions(-) create mode 100644 scripts/cdo_cmd.sh mode change 100755 => 100644 scripts/convert-ece4pyreader-grids.sh create mode 100755 scripts/convert-ece4pyreader-grids_moified.sh rename scripts/{template_conf_datacoupler_co2flux _ceds.yaml => template_conf_datacoupler_co2flux_ceds.yaml} (100%) diff --git a/scripts/cdo_cmd.sh b/scripts/cdo_cmd.sh new file mode 100644 index 0000000..8e81c63 --- /dev/null +++ b/scripts/cdo_cmd.sh @@ -0,0 +1,40 @@ +SiB4v2_BioFluxes_v246_1x1_2014_day.nc +source = "/scratch-shared/iluijkx/SiB4v2_Biosphere_Fluxes//SiB4v2_BioFluxes_201401.nc" +sib4_regrid.ipynb +"Tue Jul 04 18:23:46 2023: cdo -O settime,00:00:00 -daymean SiB4v2_BioFluxes_v246_1x1_2014_3hour.nc SiB4v2_BioFluxes_v246_1x1_2014_day.nc\n", +"Tue Jul 04 18:22:36 2023: cdo -O -f nc4c -z zip_2 mergetime tmp_201401.nc tmp_201402.nc tmp_201403.nc tmp_201404.nc tmp_201405.nc tmp_201406.nc tmp_201407.nc tmp_201408.nc tmp_201409.nc tmp_201410.nc tmp_201411.nc tmp_201412.nc SiB4v2_BioFluxes_v246_1x1_2014_3hour.nc\n", +"Tue Jul 04 18:22:32 2023: cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,3hour SiB4v2_BioFluxes_v246_1x1_201401.nc tmp_201401.nc" + +SiB4v2_BioFluxes_v246_1x1_2014_3hours.nc +"sib4_regrid.ipynb" ; +source = "/scratch-shared/iluijkx/SiB4v2_Biosphere_Fluxes//SiB4v2_BioFluxes_201401.nc" +"Tue Jul 04 18:22:36 2023: cdo -O -f nc4c -z zip_2 mergetime tmp_201401.nc tmp_201402.nc tmp_201403.nc tmp_201404.nc tmp_201405.nc tmp_201406.nc tmp_201407.nc tmp_201408.nc tmp_201409.nc tmp_201410.nc tmp_201411.nc tmp_201412.nc SiB4v2_BioFluxes_v246_1x1_2014_3hour.nc\n", +"Tue Jul 04 18:22:32 2023: cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,3hour SiB4v2_BioFluxes_v246_1x1_201401.nc tmp_201401.nc" + +GCP_Global_1x1_2014.mod.nc +:source = "/projects/0/ctdas/input/ctdas_2012//fossil/GridFED_v2022.2/GCP-GridFEDv2022.2_2014.nc" ; +:script = "conversion_gridfed.ipynb" ; +:history = "Tue Jul 04 18:43:08 2023: cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,month GCP_Global_1x1_2014.nc GCP_Global_1x1_2014.mod.nc" ; + +oc_v2021_daily_mol_s_m2_2014.mod.nc +:source = "oc_v2021_daily.nc" ; +:date = "08-02-2022" ; +:comment = "Regridded & converted CarboScope ocean flux, with application of a transcom-based landmask." ; +:script = "carboscope_regrid.ipynb" ; +:history = "Wed Jul 05 10:24:44 2023: cdo -r -O -setreftime,2000-01-01 -settaxis,2014-01-01 -delvar,co2flux_ocean_monthly oc_v2021_monthly_mol_s_m2_2014.nc oc_v2021_daily_mol_s_m2_2014.mod.nc" ; + +oc_v2021_monthly_mol_s_m2_2014.mod.nc +:source = "oc_v2021_daily.nc" ; +:author = "R. de Kok" ; +:date = "08-02-2022" ; +:comment = "Regridded & converted CarboScope ocean flux, with application of a transcom-based landmask." ; +:script = "carboscope_regrid.ipynb" ; +:history = "Wed Jul 05 10:26:53 2023: cdo -r -O -setreftime,2000-01-01 -settaxis,2014-01-01 -delvar,co2flux_ocean oc_v2021_monthly_mol_s_m2_2014.nc oc_v2021_monthly_mol_s_m2_2014.mod.nc" ; + +gfas_1x1_2014.nc +:source = "/scratch/shared/lflorent/output_gfas_2014.nc" ; +:author = "L. Florentie" ; +:date = "15-06-2020" ; +:script = "GFAS_fires_conversion.ipynb" ; +:history = "Wed Jul 05 10:42:52 2023: cdo -O -f nc4c -z zip_2 mergetime tmp_201401.nc tmp_201402.nc tmp_201403.nc tmp_201404.nc tmp_201405.nc tmp_201406.nc tmp_201407.nc tmp_201408.nc tmp_201409.nc tmp_201410.nc tmp_201411.nc tmp_201412.nc gfas_1x1_2014.nc\n", +"Wed Jul 05 10:42:51 2023: cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,1day gfas_1x1_201401.nc tmp_201401.nc" ; diff --git a/scripts/convert-ece4pyreader-grids.sh b/scripts/convert-ece4pyreader-grids.sh old mode 100755 new mode 100644 index 5edaaf3..b3a979c --- a/scripts/convert-ece4pyreader-grids.sh +++ b/scripts/convert-ece4pyreader-grids.sh @@ -14,14 +14,14 @@ griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/script gridname_AMIP=AMIP griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt gridname_co2=CO2 -griddef_co2=grid-CEDS.txt # cdo griddes > grid-co2_emis.txt +griddef_co2=grid-co2_emis.txt # cdo griddes > grid-co2_emis.txt model_ifs=IFS_TOY # set vars according to model_mode # TODO: They will be replaced by python YAML reader [ $model_mode = "co2box" ] && CO2BOX=true || CO2BOX=false -[ $model_mode = "co2flux_CEDS" ] && CO2FLUX=true || CO2FLUX=false +[ $model_mode = "co2flux" ] && CO2FLUX=true || CO2FLUX=false if [[ ${CO2BOX} == true ]] ; then grids="" @@ -34,10 +34,10 @@ if [[ ${CO2BOX} == true ]] ; then vars_co2_ifs="A_CO2_cconc A_CO2_econc" else grids="AMIP L128" #B128 A128 R128 - [[ ${CO2FLUX} == true ]] && grids+="CEDS" + [[ ${CO2FLUX} == true ]] && grids+=" CO2_emis" vars_amip="AMIP_sst AMIP_sic" vars_ifs="A_SST A_Ice_frac" - [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_veg A_CO2_fire A_CO2_oce" + [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_land A_CO2_ocean" model_amip=AMIPFORC model_co2=AMIPFORC [[ ${CO2FLUX} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" diff --git a/scripts/convert-ece4pyreader-grids_moified.sh b/scripts/convert-ece4pyreader-grids_moified.sh new file mode 100755 index 0000000..4f0ab73 --- /dev/null +++ b/scripts/convert-ece4pyreader-grids_moified.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +set -xuve + +#griddir=/gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids +griddir=. + +newdate=$1 +#taxis="settaxis,21450101,00:00:00,1day" +taxis="settaxis,$newdate,00:00:00,1day" + +gridname_ifs=L128 +griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids +gridname_AMIP=AMIP +griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt +gridname_co2=CO2 +griddef_co2=grid-CEDS.txt # cdo griddes > grid-co2_emis.txt +model_ifs=IFS_TOY + +# set vars according to model_mode +# TODO: They will be replaced by python YAML reader + +[ $model_mode = "co2box" ] && CO2BOX=true || CO2BOX=false +[ $model_mode = "co2flux_ceds" ] && CO2FLUX=true || CO2FLUX=false + +if [[ ${CO2BOX} == true ]] ; then + grids="" + vars_amip="" + vars_ifs="" + model_amip=CO2BOX + model_co2=CO2BOX + vars_co2="" + vars_co2_co2box="CO2BOX_CO2_cconc CO2BOX_CO2_econc" + vars_co2_ifs="A_CO2_cconc A_CO2_econc" +else + grids="AMIP L128" #B128 A128 R128 + [[ ${CO2FLUX} == true ]] && grids+="CEDS" + vars_amip="AMIP_sst AMIP_sic" + vars_ifs="A_SST A_Ice_frac" + [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" + model_amip=AMIPFORC + model_co2=AMIPFORC + [[ ${CO2FLUX} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" + vars_co2_co2box="" + vars_co2_ifs="" +fi + +# copy from runtime dir the following files grids.nc areas.nc masks.nc +for gridname in ${grids} +do + if [[ ${gridname} == AMIP ]] ; then + format=nc + suffix=".nc" + griddef=${griddef_amip} + elif [[ ${gridname} == CO2_emis ]] ; then + format=nc + suffix=".nc" + griddef=${griddef_co2} + else + format=grb1 + suffix=".grb" + griddef=${griddef_ifs} + fi + cdo -f $format -setgrid,${griddir}/${griddef} -selvar,${gridname}.msk masks.nc masks_${gridname}${suffix} + cdo -f $format -setgrid,${griddir}/${griddef} -selvar,${gridname}.srf areas.nc areas_${gridname}${suffix} + if [[ ${format} == "grb1" ]] ; then + for t in masks areas ; do + cdo -f nc -setgridtype,regularnn ${t}_${gridname}.grb ${t}_${gridname}.nc + done + fi +done + + +for v in $vars_ifs +do + cdo -O -f grb1 -r $taxis -setgrid,${griddir}/${griddef_ifs} ${v}_${model_ifs}_??.nc ${v}.grb + cdo -O -f nc -r $taxis -setgridtype,regular -chvar,var1,${v} ${v}.grb ${v}.nc +done + +for v in $vars_amip +do + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_amip} ${v}_${model_amip}_??.nc ${v}.nc +done + +for v in $vars_co2 +do + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_co2} ${v}_${model_co2}_??.nc ${v}.nc +done +for v in $vars_co2_co2box +do + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_co2}_??.nc ${v}.nc +done +for v in $vars_co2_ifs +do + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_ifs}_??.nc ${v}.nc +done diff --git a/scripts/launch_ece3_data_coupler_mn4.cmd b/scripts/launch_ece3_data_coupler_mn4.cmd index 7205f4b..2a4a2e7 100644 --- a/scripts/launch_ece3_data_coupler_mn4.cmd +++ b/scripts/launch_ece3_data_coupler_mn4.cmd @@ -15,7 +15,12 @@ source modules.sh #AMIP Forcing only #bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml #AMIP Forcing + co2flux_ceds -#bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux.yaml +bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux_ceds.yaml +#bash ./run_example.sh datacoupler co2flux 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux.yaml + +#co2box only +#bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml #co2box only -bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml +#bash ./run_example.sh datacoupler co2flux_carbon-tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml + diff --git a/scripts/run_example.sh b/scripts/run_example.sh index 9afa10e..641c05f 100755 --- a/scripts/run_example.sh +++ b/scripts/run_example.sh @@ -167,7 +167,9 @@ fi # convert output -. convert-ece4pyreader-grids.sh ${leg_start_date} +#. convert-ece4pyreader-grids.sh ${leg_start_date} +. convert-ece4pyreader-grids_moified.sh ${leg_start_date} + #echo $casename 'is executed or submitted to queue.' echo 'Results are found in rundir : '$rundir diff --git a/scripts/template_conf_datacoupler_co2flux _ceds.yaml b/scripts/template_conf_datacoupler_co2flux_ceds.yaml similarity index 100% rename from scripts/template_conf_datacoupler_co2flux _ceds.yaml rename to scripts/template_conf_datacoupler_co2flux_ceds.yaml -- GitLab From 73344de8a188356aa1b9e375841ef578a15178d3 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Tue, 10 Oct 2023 17:30:19 +0200 Subject: [PATCH 07/17] WIP: minor change to convert grid scripts --- scripts/convert-ece4pyreader-grids_moified.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/convert-ece4pyreader-grids_moified.sh b/scripts/convert-ece4pyreader-grids_moified.sh index 4f0ab73..0012aad 100755 --- a/scripts/convert-ece4pyreader-grids_moified.sh +++ b/scripts/convert-ece4pyreader-grids_moified.sh @@ -52,10 +52,10 @@ do format=nc suffix=".nc" griddef=${griddef_amip} - elif [[ ${gridname} == CO2_emis ]] ; then + elif [[ ${gridname} == CEDS ]] ; then format=nc suffix=".nc" - griddef=${griddef_co2} + griddef={griddef_co2} else format=grb1 suffix=".grb" -- GitLab From d01f057b21fb91680e280c17dae2da377e5d0e0a Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 11 Oct 2023 10:10:22 +0200 Subject: [PATCH 08/17] WIP: co2flux_ceds works on mn4 --- scripts/convert-ece4pyreader-grids_moified.sh | 7 ++++--- scripts/namcouple_co2.sh | 2 +- scripts/run_example.sh | 8 +++++++- scripts/template_conf_datacoupler_co2flux_ceds.yaml | 6 +++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/convert-ece4pyreader-grids_moified.sh b/scripts/convert-ece4pyreader-grids_moified.sh index 0012aad..b8acbd2 100755 --- a/scripts/convert-ece4pyreader-grids_moified.sh +++ b/scripts/convert-ece4pyreader-grids_moified.sh @@ -14,7 +14,7 @@ griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/script gridname_AMIP=AMIP griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt gridname_co2=CO2 -griddef_co2=grid-CEDS.txt # cdo griddes > grid-co2_emis.txt +griddef_co2=grid-CEDS.txt # cdo griddes > grid-CEDS.txt model_ifs=IFS_TOY # set vars according to model_mode @@ -34,7 +34,7 @@ if [[ ${CO2BOX} == true ]] ; then vars_co2_ifs="A_CO2_cconc A_CO2_econc" else grids="AMIP L128" #B128 A128 R128 - [[ ${CO2FLUX} == true ]] && grids+="CEDS" + [[ ${CO2FLUX} == true ]] && grids+=" CEDS" vars_amip="AMIP_sst AMIP_sic" vars_ifs="A_SST A_Ice_frac" [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" @@ -55,7 +55,7 @@ do elif [[ ${gridname} == CEDS ]] ; then format=nc suffix=".nc" - griddef={griddef_co2} + griddef=${griddef_co2} else format=grb1 suffix=".grb" @@ -94,3 +94,4 @@ for v in $vars_co2_ifs do HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_ifs}_??.nc ${v}.nc done + diff --git a/scripts/namcouple_co2.sh b/scripts/namcouple_co2.sh index 8e7212b..7e0c83c 100644 --- a/scripts/namcouple_co2.sh +++ b/scripts/namcouple_co2.sh @@ -11,7 +11,7 @@ cat << EOF \$END # ------------------------------------------------------------------------------------------------- \$NLOGPRT - 0 0 + 20 0 \$END # ------------------------------------------------------------------------------------------------- \$STRINGS diff --git a/scripts/run_example.sh b/scripts/run_example.sh index 641c05f..0170d35 100755 --- a/scripts/run_example.sh +++ b/scripts/run_example.sh @@ -93,10 +93,16 @@ if [ $model=datacoupler ]; then ln -sf $datadir/forcing/tosbcs*.nc $rundir/. ln -sf $datadir/forcing/rmp_AMIP_to_L${ifs_grid}_GAUSWGT*.nc $rundir/. + # CO2BOX / CO2FLUX ln -sf $datadir/co2/CO2-em-anthro_*.nc $rundir/. ln -sf $datadir/co2/CO2-em-AIR-anthro_*.nc $rundir/. ln -sf $datadir/co2/mole-fraction-of-carbon-dioxide-in-air_*.nc* $rundir/. - ln -sf $datadir/co2/rmp_CO2_emis_to_B${ifs_grid}_GAUSWGT*.nc $rundir/. + ln -sf $datadir/co2/rmp_* $rundir/. + ln -sf $datadir/co2/oc_v2021_* $rundir/. + ln -sf $datadir/co2/SiB4v2_BioFluxes_v246_1x1_2014_day.nc $rundir/. + ln -sf $datadir/co2/GCP_Global_1x1_2014.mod.nc $rundir/. + ln -sf $datadir/co2/gfas_1x1_2014.nc $rundir/. + fi # Get grids and masks if [ $model = fortran ] || [ $model = pythoncompat ]; then diff --git a/scripts/template_conf_datacoupler_co2flux_ceds.yaml b/scripts/template_conf_datacoupler_co2flux_ceds.yaml index 3167dd3..ab08c76 100755 --- a/scripts/template_conf_datacoupler_co2flux_ceds.yaml +++ b/scripts/template_conf_datacoupler_co2flux_ceds.yaml @@ -21,8 +21,8 @@ FileInputVars: AMIP_sic_monthly : { id : AMIP_sic_monthly, grid_name: AMIP, oasis_name: AMIP_sic, file_pattern: siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: siconcbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 0.01, offset: 0, min: 0, max: 1, update: true, accum: true} CO2_emis_CEDS_monthly : { id : CO2_emis_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_emis, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 1, offset: 0, min: , max: , update: true, accum: true} CO2_veg_CEDS_monthly: { id : CO2_veg_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_veg, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} - CO2_fire_CEDS_monthly: { id : CO2_fire_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_fire, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} - CO2_oce_CEDS_monthly: { id : CO2_oce_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_ocean, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.1, offset: 0, min: , max: , update: true, accum: true} + CO2_fire_CEDS_monthly: { id : CO2_fire_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_fire, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} + CO2_oce_CEDS_monthly: { id : CO2_oce_CEDS_monthly, grid_name: CEDS, oasis_name: AMIP_CO2_oce, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.1, offset: 0, min: , max: , update: true, accum: true} OasisOutputVars: AMIP_sst : { send_id: AMIP_sst, receive_id: A_SST, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } @@ -30,7 +30,7 @@ OasisOutputVars: AMIP_CO2_emis : { send_id: AMIP_CO2_emis, receive_id: A_CO2_emis, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } AMIP_CO2_veg : { send_id: AMIP_CO2_veg, receive_id: A_CO2_veg, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } AMIP_CO2_fire : { send_id: AMIP_CO2_fire, receive_id: A_CO2_fire, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - AMIP_CO2_ocean : { send_id: AMIP_CO2_ocean, receive_id: A_CO2_ocean, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_oce : { send_id: AMIP_CO2_oce, receive_id: A_CO2_oce, send_grid_name: 'CEDS', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } LDebug : false EOF -- GitLab From 3745e5858400b667d3f07dc1c782bf3fecfa11f0 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 11 Oct 2023 13:22:13 +0200 Subject: [PATCH 09/17] WIP: not working for AMIP forcing --- ...acker.yaml => co2flux_carbon_tracker.yaml} | 0 scripts/convert-ece4pyreader-grids_moified.sh | 34 +++++++++++++++-- scripts/launch_ece3_data_coupler_mn4.cmd | 9 +++-- ...nf_datacoupler_co2flux_carbon_tracker.yaml | 38 +++++++++++++++++++ ...datacoupler_co2flux_carbon_tracker_v1.yaml | 30 +++++++++++++++ sources/data-coupler/DataCouplerUtils.py | 4 ++ 6 files changed, 108 insertions(+), 7 deletions(-) rename scripts/{template_conf_datacoupler_co2flux _carbon_tracker.yaml => co2flux_carbon_tracker.yaml} (100%) create mode 100755 scripts/template_conf_datacoupler_co2flux_carbon_tracker.yaml create mode 100755 scripts/template_conf_datacoupler_co2flux_carbon_tracker_v1.yaml diff --git a/scripts/template_conf_datacoupler_co2flux _carbon_tracker.yaml b/scripts/co2flux_carbon_tracker.yaml similarity index 100% rename from scripts/template_conf_datacoupler_co2flux _carbon_tracker.yaml rename to scripts/co2flux_carbon_tracker.yaml diff --git a/scripts/convert-ece4pyreader-grids_moified.sh b/scripts/convert-ece4pyreader-grids_moified.sh index b8acbd2..b6f3359 100755 --- a/scripts/convert-ece4pyreader-grids_moified.sh +++ b/scripts/convert-ece4pyreader-grids_moified.sh @@ -15,13 +15,15 @@ gridname_AMIP=AMIP griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt gridname_co2=CO2 griddef_co2=grid-CEDS.txt # cdo griddes > grid-CEDS.txt +griddef_carbon_tracker=grid-REG_1X1.txt # cdo griddes > grid-REG_1X1.txt model_ifs=IFS_TOY # set vars according to model_mode # TODO: They will be replaced by python YAML reader - +CO2FLUX=true [ $model_mode = "co2box" ] && CO2BOX=true || CO2BOX=false -[ $model_mode = "co2flux_ceds" ] && CO2FLUX=true || CO2FLUX=false +[ $model_mode = "co2flux_ceds" ] && { CO2FLUX_CEDS=true; CO2FLUX=true; } || CO2FLUX_CEDS=false +[ $model_mode = "co2flux_carbon_tracker" ] && { CO2FLUX_CARBON_TRACKER=true; CO2FLUX=true; }|| CO2FLUX_CARBON_TRACKER=false if [[ ${CO2BOX} == true ]] ; then grids="" @@ -32,9 +34,31 @@ if [[ ${CO2BOX} == true ]] ; then vars_co2="" vars_co2_co2box="CO2BOX_CO2_cconc CO2BOX_CO2_econc" vars_co2_ifs="A_CO2_cconc A_CO2_econc" + +# elif [[ ${CO2FLUX_CARBON_TRACKER} == true ]] ; then +# grids="AMIP L128" #B128 A128 R128 +# vars_amip="AMIP_sst AMIP_sic" +# vars_ifs="A_SST A_Ice_frac" +# [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" +# model_amip=AMIPFORC +# model_co2=AMIPFORC +# [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" +# vars_co2_co2box="" +# vars_co2_ifs="" + +# elif [[ ${CO2FLUX_CARBON_TRACKER} == true ]] ; then +# grids=" REG_1X1" +# vars_amip="" +# vars_ifs=" A_CO2_veg A_CO2_fire A_CO2_oce" +# model_amip=AMIPFORC +# model_co2=AMIPFORC +# vars_co2="AMIP_CO2_emis" +# vars_co2_co2box="" +# vars_co2_ifs="" else grids="AMIP L128" #B128 A128 R128 - [[ ${CO2FLUX} == true ]] && grids+=" CEDS" + [[ ${CO2FLUX_CEDS} == true ]] && grids+=" CEDS" + [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && grids+=" REG_1X1" vars_amip="AMIP_sst AMIP_sic" vars_ifs="A_SST A_Ice_frac" [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" @@ -56,6 +80,10 @@ do format=nc suffix=".nc" griddef=${griddef_co2} + elif [[ ${gridname} == REG_1X1 ]] ; then + format=nc + suffix=".nc" + griddef=${griddef_carbon_tracker} else format=grb1 suffix=".grb" diff --git a/scripts/launch_ece3_data_coupler_mn4.cmd b/scripts/launch_ece3_data_coupler_mn4.cmd index 2a4a2e7..3330500 100644 --- a/scripts/launch_ece3_data_coupler_mn4.cmd +++ b/scripts/launch_ece3_data_coupler_mn4.cmd @@ -13,14 +13,15 @@ source modules.sh #AMIP Forcing only -#bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml +bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml #AMIP Forcing + co2flux_ceds -bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux_ceds.yaml +#bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux_ceds.yaml #bash ./run_example.sh datacoupler co2flux 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux.yaml #co2box only #bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml -#co2box only -#bash ./run_example.sh datacoupler co2flux_carbon-tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml + +#co2flux_carbon_tracker +#bash ./run_example.sh datacoupler co2flux_carbon_tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml diff --git a/scripts/template_conf_datacoupler_co2flux_carbon_tracker.yaml b/scripts/template_conf_datacoupler_co2flux_carbon_tracker.yaml new file mode 100755 index 0000000..927b541 --- /dev/null +++ b/scripts/template_conf_datacoupler_co2flux_carbon_tracker.yaml @@ -0,0 +1,38 @@ +cat << EOF +# YAML input file for DataCoupler, It will be ingested and turn to Experiment YAML file + +## Model Information +ModelNameSend : AMIPFORC +ModelNameReceive : IFS_TOY +LogFileName : amip.log + +## Run Information +RunLengthSec : ${leg_length_sec} +TimeStepSec : ${cpl_freq_amip_sec} +StartYear : ${leg_start_date_yyyymmdd:0:4} +StartMonth : ${leg_start_date_yyyymmdd:4:2} +StartDay : ${leg_start_date_yyyymmdd:6:2} +FixYear : ${ifs_cmip_fixyear} +GridInfo : 88838 # number of grid cells : L080_NX = 35718 @ T159 resolution / L128_NX = 88838 @ T255 resolution / L256_NX = 348528 @ T511 resolution + +## Coupling Information +FileInputVars: + AMIP_sst_monthly : { id : AMIP_sst_monthly, grid_name: AMIP, oasis_name: AMIP_sst, file_pattern: tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: tosbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 1, offset: 273.15, min: 271.38, max: , update: true, accum: true} + AMIP_sic_monthly : { id : AMIP_sic_monthly, grid_name: AMIP, oasis_name: AMIP_sic, file_pattern: siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: siconcbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 0.01, offset: 0, min: 0, max: 1, update: true, accum: true} + CO2_emis_GCP_monthly : { id : CO2_emis_GCP_monthly, grid_name: REG_1X1, oasis_name: AMIP_CO2_emis, file_pattern: GCP_Global_1x1_2014.mod.nc, netcdf_variable: fossilfuel_burning_carbon_flux, yref_min : 2000, yref_max: 2014, timestep: monthly, interpolate : false, scale_factor: co2_c_to_co2, offset: 0, min: , max: , update: true, accum: true} + CO2_veg_sib_daily: { id : CO2_veg_sib_daily, grid_name: REG_1X1, oasis_name: AMIP_CO2_veg, file_pattern: SiB4v2_BioFluxes_v246_1x1_2014_day.nc, netcdf_variable: nee, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} + CO2_fire_gfas_daily: { id : CO2_fire_gfas_daily, grid_name: REG_1X1, oasis_name: AMIP_CO2_fire, file_pattern: gfas_1x1_2014.nc, netcdf_variable: co2fire, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} + CO2_oce_carboscope_daily: { id : CO2_oce_carboscope_daily, grid_name: REG_1X1, oasis_name: AMIP_CO2_oce, file_pattern: oc_v2021_daily_mol_s_m2_2014.mod.nc, netcdf_variable: co2flux_ocean, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} + + +OasisOutputVars: + AMIP_sst : { send_id: AMIP_sst, receive_id: A_SST, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_sic : { send_id: AMIP_sic, receive_id: A_Ice_frac, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_emis : { send_id: AMIP_CO2_emis, receive_id: A_CO2_emis, send_grid_name: 'REG_1X1', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_veg : { send_id: AMIP_CO2_veg, receive_id: A_CO2_veg, send_grid_name: 'REG_1X1', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_fire : { send_id: AMIP_CO2_fire, receive_id: A_CO2_fire, send_grid_name: 'REG_1X1', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + AMIP_CO2_oce : { send_id: AMIP_CO2_oce, receive_id: A_CO2_oce, send_grid_name: 'REG_1X1', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } + +LDebug : false +EOF + diff --git a/scripts/template_conf_datacoupler_co2flux_carbon_tracker_v1.yaml b/scripts/template_conf_datacoupler_co2flux_carbon_tracker_v1.yaml new file mode 100755 index 0000000..8de6abd --- /dev/null +++ b/scripts/template_conf_datacoupler_co2flux_carbon_tracker_v1.yaml @@ -0,0 +1,30 @@ +cat << EOF +# YAML input file for DataCoupler, It will be ingested and turn to Experiment YAML file + +## Model Information +ModelNameSend : AMIPFORC +ModelNameReceive : IFS_TOY +LogFileName : amip.log + +## Run Information +RunLengthSec : ${leg_length_sec} +TimeStepSec : ${cpl_freq_amip_sec} +StartYear : ${leg_start_date_yyyymmdd:0:4} +StartMonth : ${leg_start_date_yyyymmdd:4:2} +StartDay : ${leg_start_date_yyyymmdd:6:2} +FixYear : ${ifs_cmip_fixyear} +GridInfo : 88838 # number of grid cells : L080_NX = 35718 @ T159 resolution / L128_NX = 88838 @ T255 resolution / L256_NX = 348528 @ T511 resolution + +## Coupling Information +FileInputVars: + CO2_emis_GCP_monthly : { id : CO2_emis_GCP_monthly, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_emis, file_pattern: GCP_Global_1x1_2014.mod.nc, netcdf_variable: fossilfuel_burning_carbon_flux, yref_min : 2000, yref_max: 2014, timestep: monthly, interpolate : false, scale_factor: co2_c_to_co2, offset: 0, min: , max: , update: true, accum: true} + CO2_veg_sib_daily: { id : CO2_veg_sib_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_veg, file_pattern: SiB4v2_BioFluxes_v246_1x1_2014_day.nc, netcdf_variable: nee, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} + CO2_fire_gfas_daily: { id : CO2_fire_gfas_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_fire, file_pattern: gfas_1x1_2014.nc, netcdf_variable: co2fire, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} + CO2_oce_carboscope_daily: { id : CO2_oce_carboscope_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_oce, file_pattern: oc_v2021_daily_mol_s_m2_2014.mod.nc, netcdf_variable: co2flux_ocean, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} + +OasisOutputVars: + CO2BOX_CO2_econc : { send_id: CO2BOX_CO2_econc, receive_id: A_CO2_econc, send_grid_name: GLOBAL, receive_grid_name: GLOBAL, timestep: 'daily', scale_factor: 'co2_mass_to_ppm', offset: 0, reset: false } + +LDebug : false +EOF + diff --git a/sources/data-coupler/DataCouplerUtils.py b/sources/data-coupler/DataCouplerUtils.py index bac601b..0ce66f1 100644 --- a/sources/data-coupler/DataCouplerUtils.py +++ b/sources/data-coupler/DataCouplerUtils.py @@ -35,6 +35,10 @@ def scale_factor_from_str(scale_str): return 1 / 1e-6 / total_air_mass * fscale elif scale_str == 'co2_ppm_to_mass': return 1 * 1e-6 * total_air_mass / fscale + elif scale_str == 'co2_c_to_co2': + return xmco2 / xmc #44/12 + elif scale_str == 'co2_mol_to_kg': + return xmco2 / 1000. elif scale_str == 'second2day': return 24 * 60 * 60 else: -- GitLab From 0528d268a6e999509d85c246bbd5c9986cc0ed26 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 11 Oct 2023 14:35:21 +0200 Subject: [PATCH 10/17] AMIP, CO2BOX, CO3FLUX(CEDS, Carbon tracker) work on mn4 --- scripts/co2flux_carbon_tracker.yaml | 44 --- scripts/convert-ece4pyreader-grids_ct.sh | 96 ------- scripts/convert-ece4pyreader-grids_moified.sh | 9 +- scripts/launch_ece3_data_coupler_mn4.cmd | 9 +- scripts/namcouple_co2_ct.sh | 43 --- scripts/namcouple_co2box_ct.sh | 79 ------ scripts/namelist.co2box_ct.sh | 20 -- scripts/run_example_ct.sh | 256 ------------------ ...datacoupler_co2flux_carbon_tracker_v1.yaml | 30 -- 9 files changed, 8 insertions(+), 578 deletions(-) delete mode 100755 scripts/co2flux_carbon_tracker.yaml delete mode 100644 scripts/convert-ece4pyreader-grids_ct.sh delete mode 100644 scripts/namcouple_co2_ct.sh delete mode 100644 scripts/namcouple_co2box_ct.sh delete mode 100644 scripts/namelist.co2box_ct.sh delete mode 100644 scripts/run_example_ct.sh delete mode 100755 scripts/template_conf_datacoupler_co2flux_carbon_tracker_v1.yaml diff --git a/scripts/co2flux_carbon_tracker.yaml b/scripts/co2flux_carbon_tracker.yaml deleted file mode 100755 index 33ab121..0000000 --- a/scripts/co2flux_carbon_tracker.yaml +++ /dev/null @@ -1,44 +0,0 @@ -cat << EOF -# YAML input file for DataCoupler, It will be ingested and turn to Experiment YAML file - -## Model Information -ModelNameSend : AMIPFORC -ModelNameReceive : IFS_TOY -LogFileName : amip.log - -## Run Information -RunLengthSec : ${leg_length_sec} -TimeStepSec : ${cpl_freq_amip_sec} -StartYear : ${leg_start_date_yyyymmdd:0:4} -StartMonth : ${leg_start_date_yyyymmdd:4:2} -StartDay : ${leg_start_date_yyyymmdd:6:2} -FixYear : ${ifs_cmip_fixyear} -GridInfo : 88838 # number of grid cells : L080_NX = 35718 @ T159 resolution / L128_NX = 88838 @ T255 resolution / L256_NX = 348528 @ T511 resolution - -## Coupling Information -FileInputVars: - - # these files are from Carbon Tracker Europe and partners (SiB4v2 for vegetation, GFAS for fires, GridFED for emissions and CarboScope for ocean) - # original files are in /hpcperm/rujh/data/2014 and "fixed" files are in /hpcperm/c3et/work/python-amip-reader/tests/data/co2 - # cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,month GCP_Global_1x1_2014.nc GCP_Global_1x1_2014.mod.nc - - #co2_conf_var+=${var}"("$((i++))",:) = 'CO2_emis_GCP_monthly', '${grid_co2_emis}', '"$mod"_CO2_emis', 'GCP_Global_1x1_2014.mod.nc', 'fossilfuel_burning_carbon_flux', 2000, 2014, 'monthly', ${co2_interpolate}, 'co2_c_to_co2', 0, , ,true,true,"$'\n' - CO2_emis_GCP_monthly : { id : CO2_emis_GCP_monthly, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_emis, file_pattern: GCP_Global_1x1_2014.mod.nc, netcdf_variable: fossilfuel_burning_carbon_flux, yref_min : 2000, yref_max: 2014, timestep: monthly, interpolate : false, scale_factor: co2_c_to_co2, offset: 0, min: , max: , update: true, accum: true} - - #co2_conf_var+=${var}"("$((i++))",:) = 'CO2_veg_sib_daily', '${grid_co2_veg}', '"$mod"_CO2_veg', 'SiB4v2_BioFluxes_v246_1x1_2014_day.nc', 'nee', 2000, 2014, 'daily', ${co2_interpolate}, 'co2_mol_to_kg', 0, , ,true,true,"$'\n' - CO2_veg_sib_daily: { id : CO2_veg_sib_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_veg, file_pattern: SiB4v2_BioFluxes_v246_1x1_2014_day.nc, netcdf_variable: nee, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} - - #co2_conf_var+=${var}"("$((i++))",:) = 'CO2_fire_gfas_daily', '${grid_co2_fire}', '"$mod"_CO2_fire', 'gfas_1x1_2014.nc', 'co2fire', 2000, 2014, 'daily', ${co2_interpolate}, 'co2_mol_to_kg', 0, , ,true,true,"$'\n' - CO2_fire_gfas_daily: { id : CO2_fire_gfas_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_fire, file_pattern: gfas_1x1_2014.nc, netcdf_variable: co2fire, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} - - #co2_conf_var+=${var}"("$((i++))",:) = 'CO2_oce_carboscope_daily', '${grid_co2_oce}', '"$mod"_CO2_oce', 'oc_v2021_daily_mol_s_m2_2014.mod.nc', 'co2flux_ocean', 2000, 2014, 'daily', ${co2_interpolate}, 'co2_mol_to_kg', 0, , ,true,true,"$'\n' - CO2_oce_carboscope_daily: { id : CO2_oce_carboscope_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_oce, file_pattern: oc_v2021_daily_mol_s_m2_2014.mod.nc, netcdf_variable: co2flux_ocean, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} - -OasisOutputVars: - - # oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_econc', 'GLOBAL', 'daily', 'co2_mass_to_ppm', 0, false," - CO2BOX_CO2_econc : { send_id: CO2BOX_CO2_econc, receive_id: A_CO2_econc, send_grid_name: GLOBAL, receive_grid_name: GLOBAL, timestep: 'daily', scale_factor: 'co2_mass_to_ppm', offset: 0, reset: false } - -LDebug : false -EOF - diff --git a/scripts/convert-ece4pyreader-grids_ct.sh b/scripts/convert-ece4pyreader-grids_ct.sh deleted file mode 100644 index 5ad0988..0000000 --- a/scripts/convert-ece4pyreader-grids_ct.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -set -xuve - -#griddir=/gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids -griddir=. - -newdate=$1 -#taxis="settaxis,21450101,00:00:00,1day" -taxis="settaxis,$newdate,00:00:00,1day" - -gridname_ifs=L128 -griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids -gridname_AMIP=AMIP -griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt -griddef_co2=grid-${grid_co2_emis}.txt -model_ifs=IFS_TOY -vars_ifs="A_SST A_Ice_frac" -[ -f namelist.co2box ] && CO2BOX=true || CO2BOX=false -[[ ${CO2_EMODE} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_veg A_CO2_fire A_CO2_oce" - -vars_amip="AMIP_sst AMIP_sic" - -grids="AMIP L128 B128 A128 R128" -#[[ ${CO2_EMODE} == true ]] && grids+=" CO2_emis" -grids+=" ${grid_co2_emis}" -# copy from runtime dir the following files grids.nc areas.nc masks.nc -for gridname in ${grids} -do - if [[ ${gridname} == AMIP ]] ; then - format=nc - suffix=".nc" - griddef=${griddef_amip} - elif [[ ${gridname} == CEDS ]] ; then - format=nc - suffix=".nc" - griddef=grid-CEDS.txt - elif [[ ${gridname} == REG_1X1 ]] ; then - format=nc - suffix=".nc" - griddef=grid-REG_1X1.txt - else - format=grb1 - suffix=".grb" - griddef=${griddef_ifs} - fi - cdo -f $format -setgrid,${griddir}/${griddef} -selvar,${gridname}.msk masks.nc masks_${gridname}${suffix} - cdo -f $format -setgrid,${griddir}/${griddef} -selvar,${gridname}.srf areas.nc areas_${gridname}${suffix} - if [[ ${format} == "grb1" ]] ; then - for t in masks areas ; do - cdo -f nc -setgridtype,regularnn ${t}_${gridname}.grb ${t}_${gridname}.nc - done - fi -done - -vars_co2="" -vars_co2_co2box="" -vars_co2_ifs="" -if [[ ${CO2BOX} == true ]]; then - model_amip=CO2BOX - model_co2=CO2BOX - [[ ${CO2_CMODE} == true ]] && vars_co2_co2box="CO2BOX_CO2_cconc CO2BOX_CO2_econc" - [[ ${CO2_CMODE} == true ]] && vars_co2_ifs="A_CO2_cconc A_CO2_econc" - [[ ${CO2_EMODE} == true ]] && vars_co2="CO2BOX_CO2_emis" -else - model_amip=AMIPFORC - model_co2=AMIPFORC - [[ ${CO2_EMODE} == true ]] && vars_co2="AMIP_CO2_emis" -fi - -for v in $vars_ifs -do - cdo -O -f grb1 -r $taxis -setgrid,${griddir}/${griddef_ifs} ${v}_${model_ifs}_??.nc ${v}.grb - cdo -O -f nc -r $taxis -setgridtype,regular -chvar,var1,${v} ${v}.grb ${v}.nc -done - -for v in $vars_amip -do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_amip} ${v}_${model_amip}_??.nc ${v}.nc -done - -for v in $vars_co2 -do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_co2} ${v}_${model_co2}_??.nc ${v}.nc -done -for v in $vars_co2_co2box -do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_co2}_??.nc ${v}.nc -done -for v in $vars_co2_ifs -do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_ifs}_??.nc ${v}.nc -done - - - diff --git a/scripts/convert-ece4pyreader-grids_moified.sh b/scripts/convert-ece4pyreader-grids_moified.sh index b6f3359..6d030d8 100755 --- a/scripts/convert-ece4pyreader-grids_moified.sh +++ b/scripts/convert-ece4pyreader-grids_moified.sh @@ -14,13 +14,13 @@ griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/script gridname_AMIP=AMIP griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt gridname_co2=CO2 -griddef_co2=grid-CEDS.txt # cdo griddes > grid-CEDS.txt +griddef_ceds=grid-CEDS.txt # cdo griddes > grid-CEDS.txt griddef_carbon_tracker=grid-REG_1X1.txt # cdo griddes > grid-REG_1X1.txt model_ifs=IFS_TOY # set vars according to model_mode # TODO: They will be replaced by python YAML reader -CO2FLUX=true +CO2FLUX=false [ $model_mode = "co2box" ] && CO2BOX=true || CO2BOX=false [ $model_mode = "co2flux_ceds" ] && { CO2FLUX_CEDS=true; CO2FLUX=true; } || CO2FLUX_CEDS=false [ $model_mode = "co2flux_carbon_tracker" ] && { CO2FLUX_CARBON_TRACKER=true; CO2FLUX=true; }|| CO2FLUX_CARBON_TRACKER=false @@ -79,7 +79,7 @@ do elif [[ ${gridname} == CEDS ]] ; then format=nc suffix=".nc" - griddef=${griddef_co2} + griddef=${griddef_ceds} elif [[ ${gridname} == REG_1X1 ]] ; then format=nc suffix=".nc" @@ -112,8 +112,9 @@ done for v in $vars_co2 do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_co2} ${v}_${model_co2}_??.nc ${v}.nc + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_ceds} ${v}_${model_co2}_??.nc ${v}.nc done + for v in $vars_co2_co2box do HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_co2}_??.nc ${v}.nc diff --git a/scripts/launch_ece3_data_coupler_mn4.cmd b/scripts/launch_ece3_data_coupler_mn4.cmd index 3330500..c3d97a3 100644 --- a/scripts/launch_ece3_data_coupler_mn4.cmd +++ b/scripts/launch_ece3_data_coupler_mn4.cmd @@ -13,15 +13,12 @@ source modules.sh #AMIP Forcing only -bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml +#bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml #AMIP Forcing + co2flux_ceds #bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux_ceds.yaml -#bash ./run_example.sh datacoupler co2flux 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux.yaml - - +#co2flux_carbon_tracker +bash ./run_example.sh datacoupler co2flux_carbon_tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml #co2box only #bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml -#co2flux_carbon_tracker -#bash ./run_example.sh datacoupler co2flux_carbon_tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml diff --git a/scripts/namcouple_co2_ct.sh b/scripts/namcouple_co2_ct.sh deleted file mode 100644 index 9dd30e1..0000000 --- a/scripts/namcouple_co2_ct.sh +++ /dev/null @@ -1,43 +0,0 @@ -cat << EOF -# ================================================================================================= -# General OASIS configuration -# ================================================================================================= - \$NFIELDS - 3 - \$END -# ------------------------------------------------------------------------------------------------- - \$RUNTIME - ${leg_length_sec} - \$END -# ------------------------------------------------------------------------------------------------- - \$NLOGPRT - 0 0 - \$END -# ------------------------------------------------------------------------------------------------- - \$STRINGS -# ================================================================================================= -# Fields send from AMIP to IFS -# ================================================================================================= -# --- AMIP forcing data --- [ifs amip] - AMIP_sst:AMIP_sic A_SST:A_Ice_frac 1 86400 1 rstas.nc EXPOUT - AMIP L${ifs_grid} LAG=0 - P 0 P 0 - SCRIPR - GAUSWGT LR SCALAR LATITUDE 1 9 2.0 - - AMIP_CO2_emis A_CO2_emis 1 86400 1 rstas.nc EXPOUT - CO2_emis B${ifs_grid} LAG=0 - P 0 P 0 - SCRIPR CONSERV - GAUSWGT LR SCALAR LATITUDE 1 9 2.0 - - AMIP_CO2_veg:AMIP_CO2_ocean A_CO2_veg:A_CO2_ocean 1 86400 1 rstas.nc EXPOUT - CO2_emis B${ifs_grid} LAG=0 - P 0 P 0 - SCRIPR CONSERV - GAUSWGT LR SCALAR LATITUDE 1 9 2.0 - -# ------------------------------------------------------------------------------------------------- - \$END -# ================================================================================================= -EOF diff --git a/scripts/namcouple_co2box_ct.sh b/scripts/namcouple_co2box_ct.sh deleted file mode 100644 index a58888e..0000000 --- a/scripts/namcouple_co2box_ct.sh +++ /dev/null @@ -1,79 +0,0 @@ -nfields=1 -if [ ${CO2_CMODE} == true ] ; then - nfields=$((nfields+1)) -fi -if [ ${CO2_EMODE} == true ] ; then - nfields=$((nfields+4)) -fi -cat << EOF -# ================================================================================================= -# General OASIS configuration -# ================================================================================================= - \$NFIELDS - ${nfields} - \$END -# ------------------------------------------------------------------------------------------------- - \$RUNTIME - ${leg_length_sec} - \$END -# ------------------------------------------------------------------------------------------------- - \$NLOGPRT - 30 0 - \$END -# ------------------------------------------------------------------------------------------------- - \$STRINGS -# ================================================================================================= -# Fields send from AMIP to IFS -# ================================================================================================= -# --- AMIP forcing data --- [ifs amip] - AMIP_sst:AMIP_sic A_SST:A_Ice_frac 1 86400 1 rstas.nc EXPOUT - AMIP L${ifs_grid} LAG=0 - P 0 P 0 - SCRIPR - GAUSWGT LR SCALAR LATITUDE 1 9 2.0 -EOF -if [ ${CO2_CMODE} == true ] ; then -cat << EOF - - CO2BOX_CO2_cconc:CO2BOX_CO2_econc A_CO2_cconc:A_CO2_econc 1 86400 1 rstas.nc EXPOUT - GLOBAL GLOBAL LAG=0 - P 0 P 0 - LOCTRANS - AVERAGE - -EOF -fi -if [ ${CO2_EMODE} == true ] ; then -cat << EOF - - CO2BOX_CO2_emis A_CO2_emis 1 86400 1 rstas.nc EXPOUT - ${grid_co2_emis} B${ifs_grid} LAG=0 - P 0 P 0 - SCRIPR CONSERV - GAUSWGT LR SCALAR LATITUDE 1 9 2.0 - - CO2BOX_CO2_veg A_CO2_veg 1 86400 1 rstas.nc EXPOUT - ${grid_co2_veg} R${ifs_grid} LAG=0 - P 0 P 0 - SCRIPR CONSERV - GAUSWGT LR SCALAR LATITUDE 1 9 2.0 - - CO2BOX_CO2_fire A_CO2_fire 1 86400 1 rstas.nc EXPOUT - ${grid_co2_fire} R${ifs_grid} LAG=0 - P 0 P 0 - SCRIPR CONSERV - GAUSWGT LR SCALAR LATITUDE 1 9 2.0 - - CO2BOX_CO2_oce A_CO2_oce 1 86400 1 rstas.nc EXPOUT - ${grid_co2_oce} A${ifs_grid} LAG=0 - P 0 P 0 - SCRIPR CONSERV - GAUSWGT LR SCALAR LATITUDE 1 9 2.0 - -EOF -fi -cat << EOF -# ------------------------------------------------------------------------------------------------- - \$END -# ================================================================================================= -EOF diff --git a/scripts/namelist.co2box_ct.sh b/scripts/namelist.co2box_ct.sh deleted file mode 100644 index 6f66b26..0000000 --- a/scripts/namelist.co2box_ct.sh +++ /dev/null @@ -1,20 +0,0 @@ -cat << EOF -!----------------------------------------------------------------------- -&NAMCO2BOX -!----------------------------------------------------------------------- - RunLengthSec = ${leg_length_sec} - TimeStepSec = ${cpl_freq_amip_sec} - StartYear = ${leg_start_date_yyyymmdd:0:4} - StartMonth = ${leg_start_date_yyyymmdd:4:2} - StartDay = ${leg_start_date_yyyymmdd:6:2} - FixYear = ${ifs_cmip_fixyear} - -${sst_conf_var} -${sic_conf_var} -${co2_conf_var} -${oasis_conf_var} - - LDebug = false -!----------------------------------------------------------------------- -/ -EOF diff --git a/scripts/run_example_ct.sh b/scripts/run_example_ct.sh deleted file mode 100644 index 8ab7b61..0000000 --- a/scripts/run_example_ct.sh +++ /dev/null @@ -1,256 +0,0 @@ -#!/bin/bash -## Usage -if [ $# -ne 9 ]; then - echo 'Invalid args.' - echo 'Usage ./run_example.sh ' - echo 'Try ./run_example.sh python forcing 4 1990-01-01 1991-01-01 0 L128 true' - exit 1 -fi - -set -xuve - -model=$1 -amip_mode=$2 # forcing or primavera -# - Define number of processes to run each executable -nproc_exe1=$3 -nproc_exe2=1 # AMIP is always one process - -leg_start_date=$4 -leg_end_date=$5 -ifs_cmip_fixyear=$6 -ifs_grid=$7 -amip_interpolate=$8 -co2_interpolate=$9 -host=`uname -n` -user=`whoami` - -## - Define paths -srcdir=`pwd` -datadir=$srcdir/data - - -exe1='python3 IFS_toy.py' -source_exe1=$srcdir/IFS_toy.py - -if [ $model = fortran ]; then - exe2='./amip-forcing' - if [ $amip_mode = forcing ]; then - source_exe2=$srcdir/../sources/amip-forcing/bin/amip-forcing - else - source_exe2=$srcdir/../sources/amip-primavera/bin/amip-forcing - fi -elif [ $model = python ] || [ $model = pythoncompat ]; then - exe2='python3 amip_forcing.py' - # exe2='coverage run -p --branch --include=*/amip-forcing/src/python/* amip_forcing.py' - # exe2='python3 -m cProfile -s cumtime amip_forcing.py' - source_exe2=$srcdir/../sources/amip-forcing/src/python/*.py -elif [ $model = datacoupler ] ; then - exe2='python3 AMIPDataCoupler.py' - # exe2='coverage run -p --branch --include=*/amip-forcing/src/python/* amip_forcing.py' - # exe2='python3 -m cProfile -s cumtime amip_forcing.py' - source_exe2=$srcdir/../sources/data-coupler/*.py -elif [ $model = co2box ] ; then - exe2='python3 CO2BoxDataCoupler.py' - # exe2='coverage run -p --branch --include=*/amip-forcing/src/python/* amip_forcing.py' - # exe2='python3 -m cProfile -s cumtime amip_forcing.py' - source_exe2=$srcdir/../sources/data-coupler/*.py -else - echo 'Invalid args. You must specify a language for the AMIP reader: | ' - exit 1 -fi - -CO2_CMODE=false -CO2_EMODE=false - -# - Define rundir -rundir=${srcdir}/work_${model}_${amip_mode}_${nproc_exe1}_${leg_start_date}_${leg_end_date}_${ifs_cmip_fixyear}_${ifs_grid}_${amip_interpolate} -# export COVERAGE_FILE=${rundir}/../.coverage - -echo '*****************************************************************' -#echo '*** '$casename' : '$run -echo '' -echo 'Rundir :' $rundir -#echo 'Architecture :' $arch -echo 'Host : '$host -echo 'User : '$user -echo '' -echo $exe1' runs on '$nproc_exe1 'processes' -echo $exe2' runs on '$nproc_exe2 'processes' -echo '' -###################################################################### -### Create rundir and copy everything needed - -\rm -fr $rundir -mkdir -p $rundir -ln -sf $datadir/ICMGGa22e+000000 $rundir/. -ln -sf $datadir/*.txt $rundir/. -# Get SST and SIC -#if [ $amip_mode = forcing ] || [ $amip_mode = co2 ]; then -if [ $amip_mode = forcing ] || [ $amip_mode = co2 ] ; then - ln -sf $datadir/forcing/siconcbcs*.nc $rundir/. - ln -sf $datadir/forcing/tosbcs*.nc $rundir/. - ln -sf $datadir/forcing/rmp_AMIP_to_L${ifs_grid}_GAUSWGT*.nc $rundir/. - if [ $amip_mode = co2 ]; then - for f in `ls $datadir/co2/*.nc*` - do - ln -sf $f $rundir/. - done - - fi -else - ln -sf $datadir/$amip_mode/HadI*.nc $rundir/. - ln -sf $datadir/$amip_mode/rmp_PSIC_to_${ifs_grid}_GAUSWGT.nc $rundir/. - ln -sf $datadir/$amip_mode/rmp_PSST_to_${ifs_grid}_GAUSWGT.nc $rundir/. -fi -# Get grids and masks -if [ $model = fortran ] || [ $model = pythoncompat ]; then - cp -f $datadir/$amip_mode/masks.nc $rundir/. - cp -f $datadir/$amip_mode/grids.nc $rundir/. - cp -f $datadir/$amip_mode/areas.nc $rundir/. -else - cp -f $datadir/grids-noamip.nc $rundir/grids.nc - cp -f $datadir/masks-noamip.nc $rundir/masks.nc - cp -f $datadir/areas-noamip.nc $rundir/areas.nc -fi -cp -f $datadir/*.sh $rundir/. -cp -f $source_exe1 $rundir/. -ln -sf $source_exe2 $rundir/. -cd $rundir - -### Generate namelist -leg_length_sec=$(( $(date -u -d "${leg_end_date}" +%s) - $(date -u -d "${leg_start_date}" +%s) )) -cpl_freq_amip_sec=86400 # Always -leg_start_date_yyyymmdd=$(date -u -d "${leg_start_date}" +%Y%m%d) - -if [ $model = fortran ] || [ $model = pythoncompat ]; then - if [ $amip_mode = forcing ]; then - . ./namelist.amip.sh > ./namelist.amip - else - . ./namelist_primavera.amip.sh > ./namelist.amip - fi -else - #if [ $amip_mode = forcing ] || [ $amip_mode = co2 ]; then - if [ $amip_mode = forcing ] || [ $amip_mode = co2 ]; then - i=1 - if [ $model = co2box ] || [ $model = datacoupler ]; then - var=FileInputVars - else - var=Vars - fi - sst_conf_var=${var}"("$((i++))",:) = 'AMIP_sst_monthly', 'AMIP', 'AMIP_sst', 'tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc', 'tosbcs', 1870, 2016, 'monthly', ${amip_interpolate}, 1, 273.15, 271.38, ,true,true," - sic_conf_var=${var}"("$((i++))",:) = 'AMIP_sic_monthly', 'AMIP', 'AMIP_sic', 'siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc', 'siconcbcs', 1870, 2016, 'monthly', ${amip_interpolate}, 0.01, 0, 0, 1,true,true," - - j=1 - oasis_conf_var="!OasisOutputVars(j,:) = , , , , , \n" - oasis_conf_var=$'\n'"OasisOutputVars("$((j++))",:) = 'AMIP_sst', 'AMIP', 'daily', 1, 0, true," - oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = 'AMIP_sic', 'AMIP', 'daily', 1, 0, true," - if [ $amip_mode = co2 ]; then - co2_conf_var="" - co2_conf_var+="!FileInputVars(i,:) = "$'\n' - #[ $model = co2box ] && mod=CO2BOX || mod=AMIP - if [ $model = co2box ] ; then - mod=CO2BOX - CO2_CMODE=false # set to false to disable co2 concentrations reading - CO2_EMODE=true # set to false to disable emissions reading - #if CO2_EMODE=true, choose the CO2 flux source to use, currently CARBON_TRACKER and CEDS are supported - CO2_FLUX_SOURCE="CARBON_TRACKER" - #CO2_FLUX_SOURCE="CEDS" - else - mod=AMIP - CO2_CMODE=false # don't change this! - CO2_EMODE=true # don't change this! - CO2_FLUX_SOURCE="" # don't change this! - fi - #this fix is required to correctly read the co2 files which havereftime 0-1-1, which isn't supported by python netcdf4 - #cdo -R -setreftime,1849-01-01,00:00 mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.mod - #this fix is required to correctly read the CO2_em_monthly files which have a 365day calendar and also to convert from a grid point/sectors fields to a global one - #cdo -L -setcalendar,gregorian -fldsum -vertsum -mul CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc co2-area.nc CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc - if [ ${CO2_CMODE} == true ] ; then - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_cconc_monthly', 'GLOBAL', '"$mod"_CO2_cconc', 'mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.mod', 'mole_fraction_of_carbon_dioxide_in_air', 1849, 2014, 'monthly', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_econc_monthly', 'GLOBAL', '"$mod"_CO2_econc', 'mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.mod', 'mole_fraction_of_carbon_dioxide_in_air', 1849, 2014, 'monthly', ${co2_interpolate}, 'co2_ppm_to_mass', 0, , ,false,false,"$'\n' - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_emis_monthly_GLOBAL', 'GLOBAL', '"$mod"_CO2_econc', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 86400, 0, , ,true,true,"$'\n' - # add veg/ocean fluxes equal to 0.5/0.1 that of emissions, for demonstration purposes - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_veg_monthly_GLOBAL', 'GLOBAL', '"$mod"_CO2_econc', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 43200, 0, , ,true,true,"$'\n' - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_oce_monthly_GLOBAL', 'GLOBAL', '"$mod"_CO2_econc', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 8640, 0, , ,true,true,"$'\n' - fi - if [ ${CO2_EMODE} == true ] ; then - if [ ${CO2_FLUX_SOURCE} == "CEDS" ] ; then - # this is the 3D monthly emissions from input4MIPS used for CMIP6, the calendar fix mentionned below is probably required - grid_co2_emis="CEDS" - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_emis_CEDS_monthly', '${grid_co2_emis}', '"$mod"_CO2_emis', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' - # add veg/fire/ocean fluxes equal to 0.5/0.1/0.05 that of emissions, for demonstration purposes - grid_co2_veg="CEDS" - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_veg_CEDS_monthly', '${grid_co2_veg}', '"$mod"_CO2_veg', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.5, 0, , ,true,true,"$'\n' - grid_co2_fire="CEDS" - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_fire_CEDS_monthly', '${grid_co2_fire}', '"$mod"_CO2_fire', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.1, 0, , ,true,true,"$'\n' - grid_co2_oce="CEDS" - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_oce_CEDS_monthly', '${grid_co2_oce}', '"$mod"_CO2_oce', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.5, 0, , ,true,true,"$'\n' - elif [ ${CO2_FLUX_SOURCE} == "CARBON_TRACKER" ] ; then - # these files are from Carbon Tracker Europe and partners (SiB4v2 for vegetation, GFAS for fires, GridFED for emissions and CarboScope for ocean) - # original files are in /hpcperm/rujh/data/2014 and "fixed" files are in /hpcperm/c3et/work/python-amip-reader/tests/data/co2 - - # cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,month GCP_Global_1x1_2014.nc GCP_Global_1x1_2014.mod.nc - grid_co2_emis="REG_1X1" - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_emis_GCP_monthly', '${grid_co2_emis}', '"$mod"_CO2_emis', 'GCP_Global_1x1_2014.mod.nc', 'fossilfuel_burning_carbon_flux', 2000, 2014, 'monthly', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' - - # use script fix-sib.sh for fixing and merging the SiB4v2 files - grid_co2_veg="REG_1X1" - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_veg_sib_daily', '${grid_co2_veg}', '"$mod"_CO2_veg', 'SiB4v2_BioFluxes_v246_1x1_2014_day.nc', 'nee', 2000, 2014, 'daily', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' - - # use script fix-gfas.sh for fixing and merging the GFAS files - grid_co2_fire="REG_1X1" - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_fire_gfas_daily', '${grid_co2_fire}', '"$mod"_CO2_fire', 'gfas_1x1_2014.nc', 'co2fire', 2000, 2014, 'daily', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' - - # cdo -r -O -setreftime,2000-01-01 -settaxis,2014-01-01 -delvar,co2flux_ocean_monthly oc_v2021_monthly_mol_s_m2_2014.nc oc_v2021_daily_mol_s_m2_2014.mod.nc - # cdo -r -O -setreftime,2000-01-01 -settaxis,2014-01-01 -delvar,co2flux_ocean oc_v2021_monthly_mol_s_m2_2014.nc oc_v2021_monthly_mol_s_m2_2014.mod.nc - grid_co2_oce="REG_1X1" - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_oce_carboscope_daily', '${grid_co2_oce}', '"$mod"_CO2_oce', 'oc_v2021_daily_mol_s_m2_2014.mod.nc', 'co2flux_ocean', 2000, 2014, 'daily', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' - else - echo "Unsupported CO2_FLUX_SOURCE ${CO2_FLUX_SOURCE}" - exit 1 - fi - fi - #OasisOutputVars(i,:) = - if [ ${CO2_CMODE} == true ] ; then - oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_cconc', 'GLOBAL', 'daily', 1, 0, true," - oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_econc', 'GLOBAL', 'daily', 'co2_mass_to_ppm', 0, false," - fi - if [ ${CO2_EMODE} == true ] ; then - oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_emis', '${grid_co2_emis}', 'daily', 1, 0, true," - oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_veg', '${grid_co2_veg}', 'daily', 1, 0, true," - oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_fire', '${grid_co2_fire}', 'daily', 1, 0, true," - oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_oce', '${grid_co2_oce}', 'daily', 1, 0, true," - fi - else - co2_conf_var="" - fi - else - sst_conf_var="Vars(1,:) = 'AMIP_sst_daily', 'PSST', 'AMIP_sst', 'HadISST2_prelim_0to360_alldays_sst_[year].nc', 'sst', 1850, 2016, 'daily', false, 1, 0, , ," - sic_conf_var="Vars(2,:) = 'AMIP_sic_daily', 'PSIC', 'AMIP_sic', 'HadISST2_prelim_0to360_alldays_sic_[year].nc', 'sic', 1850, 2016, 'daily', false, 1, 0, , ," - co2_conf_var="" - oasis_conf_var="" - fi - . ./namelist_python.amip.sh > ./namelist.amip - [ $model = co2box ] && . ./namelist.co2box.sh > ./namelist.co2box -fi -if [ $amip_mode = forcing ]; then - . ./namcouple.sh > ./namcouple -elif [ $amip_mode = co2 ]; then - [ $model = co2box ] && . ./namcouple_co2box.sh > ./namcouple || . ./namcouple_co2.sh > ./namcouple -else - . ./namcouple_primavera.sh > ./namcouple -fi - -###################################################################### -### Definition of mpirun command and batch script - -echo 'Executing the model using mpirun : ${MPIRUN}' -${MPIRUN} -np $nproc_exe1 $exe1 : -np $nproc_exe2 $exe2 - -# convert output -. convert-ece4pyreader-grids.sh ${leg_start_date} - -#echo $casename 'is executed or submitted to queue.' -echo 'Results are found in rundir : '$rundir - -###################################################################### diff --git a/scripts/template_conf_datacoupler_co2flux_carbon_tracker_v1.yaml b/scripts/template_conf_datacoupler_co2flux_carbon_tracker_v1.yaml deleted file mode 100755 index 8de6abd..0000000 --- a/scripts/template_conf_datacoupler_co2flux_carbon_tracker_v1.yaml +++ /dev/null @@ -1,30 +0,0 @@ -cat << EOF -# YAML input file for DataCoupler, It will be ingested and turn to Experiment YAML file - -## Model Information -ModelNameSend : AMIPFORC -ModelNameReceive : IFS_TOY -LogFileName : amip.log - -## Run Information -RunLengthSec : ${leg_length_sec} -TimeStepSec : ${cpl_freq_amip_sec} -StartYear : ${leg_start_date_yyyymmdd:0:4} -StartMonth : ${leg_start_date_yyyymmdd:4:2} -StartDay : ${leg_start_date_yyyymmdd:6:2} -FixYear : ${ifs_cmip_fixyear} -GridInfo : 88838 # number of grid cells : L080_NX = 35718 @ T159 resolution / L128_NX = 88838 @ T255 resolution / L256_NX = 348528 @ T511 resolution - -## Coupling Information -FileInputVars: - CO2_emis_GCP_monthly : { id : CO2_emis_GCP_monthly, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_emis, file_pattern: GCP_Global_1x1_2014.mod.nc, netcdf_variable: fossilfuel_burning_carbon_flux, yref_min : 2000, yref_max: 2014, timestep: monthly, interpolate : false, scale_factor: co2_c_to_co2, offset: 0, min: , max: , update: true, accum: true} - CO2_veg_sib_daily: { id : CO2_veg_sib_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_veg, file_pattern: SiB4v2_BioFluxes_v246_1x1_2014_day.nc, netcdf_variable: nee, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} - CO2_fire_gfas_daily: { id : CO2_fire_gfas_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_fire, file_pattern: gfas_1x1_2014.nc, netcdf_variable: co2fire, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} - CO2_oce_carboscope_daily: { id : CO2_oce_carboscope_daily, grid_name: REG_1X1, oasis_name: CO2BOX_CO2_oce, file_pattern: oc_v2021_daily_mol_s_m2_2014.mod.nc, netcdf_variable: co2flux_ocean, yref_min : 2000, yref_max: 2014, timestep: daily, interpolate : false, scale_factor: co2_mol_to_kg, offset: 0, min: , max: , update: true, accum: true} - -OasisOutputVars: - CO2BOX_CO2_econc : { send_id: CO2BOX_CO2_econc, receive_id: A_CO2_econc, send_grid_name: GLOBAL, receive_grid_name: GLOBAL, timestep: 'daily', scale_factor: 'co2_mass_to_ppm', offset: 0, reset: false } - -LDebug : false -EOF - -- GitLab From de6bc4e16e3649d842a62ade850722c85674951b Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 11 Oct 2023 14:12:44 +0000 Subject: [PATCH 11/17] all 4 work on hpc2020 --- scripts/launch_ece3_data_coupler_hpc2020.cmd | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/launch_ece3_data_coupler_hpc2020.cmd b/scripts/launch_ece3_data_coupler_hpc2020.cmd index 52c2b67..12c7c34 100644 --- a/scripts/launch_ece3_data_coupler_hpc2020.cmd +++ b/scripts/launch_ece3_data_coupler_hpc2020.cmd @@ -14,8 +14,11 @@ source modules.sh #AMIP Forcing only #bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml -#AMIP Forcing + co2flux -bash ./run_example.sh datacoupler co2flux 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux.yaml +#AMIP Forcing + co2flux_ceds +#bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux_ceds.yaml +#co2flux_carbon_tracker +#bash ./run_example.sh datacoupler co2flux_carbon_tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml #co2box only -#bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml +bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml + -- GitLab From 105a8bebfb03807d5cba04aa4dc552e211f110c6 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 11 Oct 2023 16:26:55 +0200 Subject: [PATCH 12/17] minor clean up after MR --- scripts/IFS_toy_ct.py | 171 ------------------ scripts/cdo_cmd.sh | 40 ---- scripts/convert-ece4pyreader-grids.sh | 46 ++++- scripts/convert-ece4pyreader-grids_moified.sh | 126 ------------- scripts/run_example.sh | 3 +- 5 files changed, 39 insertions(+), 347 deletions(-) delete mode 100644 scripts/IFS_toy_ct.py delete mode 100644 scripts/cdo_cmd.sh mode change 100644 => 100755 scripts/convert-ece4pyreader-grids.sh delete mode 100755 scripts/convert-ece4pyreader-grids_moified.sh diff --git a/scripts/IFS_toy_ct.py b/scripts/IFS_toy_ct.py deleted file mode 100644 index 8edea68..0000000 --- a/scripts/IFS_toy_ct.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python3 -# Copyright 2021 - Barcelona Supercomputing Center -# Author: Rodrigo Martín Posada -# MIT License - -import f90nml -import pyoasis -from pyoasis import OASIS # pylint: disable=no-name-in-module -import numpy as np -import logging - -NAMELIST_FILE_NAME = 'namelist.amip' -L080_NX = 35718 # number of grid cells at T159 resolution -L128_NX = 88838 # number of grid cells at T255 resolution -L256_NX = 348528 # number of grid cells at T511 resolution -CO2_CMODE = False # is CO2 concentration-mode active? -CO2_EMODE = False # is CO2 emission-mode active? - - -def def_local_partition(nx, npes, mype): - il_size = nx // npes - il_offset = mype * il_size - if (npes-mype) <= nx % npes: - il_size += 1 - il_offset += (nx % npes) - (npes-mype) - return il_size, il_offset - - -if __name__ == '__main__': - # Constants from namelist - nml = f90nml.read(NAMELIST_FILE_NAME) - COUPLING_INTERVAL = nml['NAMAMIP']['TimeStepSec'] - RUN_LENGTH_SEC = nml['NAMAMIP']['RunLengthSec'] - - # Init OASIS - comp = pyoasis.Component("IFS_TOY") - local_comm = comp.localcomm - # Get rank in local communicator - mype = comp.localcomm.rank - npes = comp.localcomm.size - - # Unit for output messages - out_ifs = 'IFS_toy.out_'+str(100+mype) - logging.basicConfig(filename=out_ifs, format='%(message)s', level=logging.DEBUG) - logging.debug('-----------------------------------------------------------') - logging.debug('I am IFS-toy process with rank : {}'.format(mype)) - logging.debug('in my local communicator gathering {} processes'.format(npes)) - logging.debug('----------------------------------------------------------') - - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # PARTITION DEFINITION - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - with open('namcouple', 'r') as f: - #contents = f.read() - contents = "" - for line in f: - li=line.strip() - if not li.startswith("#"): - contents += line - # TODOD find a better way to detect CO2_CMODE - if 'GLOBAL GLOBAL' in contents: - CO2_CMODE = True - if 'A_CO2_emis ' in contents: - CO2_EMODE = True - if 'L080' in contents: - nx = L080_NX - elif 'L128' in contents: - nx = L128_NX - elif 'L256' in contents: - nx = L256_NX - else: - raise Exception('Invalid IFS grid in namcouple') - # Definition of the local partition - il_size, il_offset = def_local_partition(nx, npes, mype) - logging.debug('Local partition definition') - logging.debug('il_size = {} il_offset = {} mype = {}'.format(il_size, il_offset, mype)) - partition = pyoasis.ApplePartition(il_offset, il_size) - if CO2_CMODE or CO2_EMODE: - #nx_co2 = 2 # for 2 hemisphere box model - nx_co2 = 1 - if mype == 0: - logging.debug('Local serial partition') - logging.debug('nx_co2 = {} mype = {}'.format(nx_co2, mype)) - partition2 = pyoasis.SerialPartition(nx_co2) - else: - nx_co2 = 0 - partition2 = None - - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # DECLARATION OF THE COUPLING FIELDS - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - A_SST = pyoasis.Var("A_SST", partition, OASIS.IN) - A_Ice_frac = pyoasis.Var("A_Ice_frac", partition, OASIS.IN) - logging.debug('var_id A_SST, var_id A_Ice_frac {} {}'.format(A_SST._id, A_Ice_frac._id)) - if CO2_CMODE: - if mype == 0: - A_CO2_cconc = pyoasis.Var("A_CO2_cconc", partition2, OASIS.IN) - logging.debug('var_id A_CO2_cconc {}'.format(A_CO2_cconc._id)) - A_CO2_econc = pyoasis.Var("A_CO2_econc", partition2, OASIS.IN) - logging.debug('var_id A_CO2_econc {}'.format(A_CO2_cconc._id)) - if CO2_EMODE: - A_CO2_emis = pyoasis.Var("A_CO2_emis", partition, OASIS.IN) - logging.debug('var_id A_CO2_emis {}'.format(A_CO2_emis._id)) - A_CO2_veg = pyoasis.Var("A_CO2_veg", partition, OASIS.IN) - logging.debug('var_id A_CO2_veg {}'.format(A_CO2_veg._id)) - A_CO2_fire = pyoasis.Var("A_CO2_fire", partition, OASIS.IN) - logging.debug('var_id A_CO2_fire {}'.format(A_CO2_fire._id)) - A_CO2_oce = pyoasis.Var("A_CO2_oce", partition, OASIS.IN) - logging.debug('var_id A_CO2_oce {}'.format(A_CO2_oce._id)) - - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # TERMINATION OF DEFINITION PHASE - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - logging.debug('End of initialisation phase') - - comp.enddef() - - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # TIME STEP LOOP - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - logging.debug('Timestep, field min, mean and max value') - - field_recv_A_SST = pyoasis.asarray(np.full(il_size, -1.0)) - field_recv_A_Ice_frac = pyoasis.asarray(np.full(il_size, -1.0)) - if CO2_CMODE and mype == 0: - field_recv_A_CO2_cconc = pyoasis.asarray(np.full(nx_co2, -1.0)) - field_recv_A_CO2_econc = pyoasis.asarray(np.full(nx_co2, -1.0)) - if CO2_EMODE: - field_recv_A_CO2_emis = pyoasis.asarray(np.full(il_size, -1.0)) - field_recv_A_CO2_veg = pyoasis.asarray(np.full(il_size, -1.0)) - field_recv_A_CO2_fire = pyoasis.asarray(np.full(il_size, -1.0)) - field_recv_A_CO2_oce = pyoasis.asarray(np.full(il_size, -1.0)) - - for itap_sec in range(0, RUN_LENGTH_SEC, COUPLING_INTERVAL): - A_SST.get(itap_sec, field_recv_A_SST) - A_Ice_frac.get(itap_sec, field_recv_A_Ice_frac) - - logging.debug('ITAP_SEC: {}'.format(itap_sec)) - logging.debug('A_SST -> {:.3e} {:.3e} {:.3e}'.format( - np.min(field_recv_A_SST), - np.mean(field_recv_A_SST), - np.max(field_recv_A_SST))) - logging.debug('A_Ice_frac -> {:.3e} {:.3e} {:.3e}'.format( - np.min(field_recv_A_Ice_frac), - np.mean(field_recv_A_Ice_frac), - np.max(field_recv_A_Ice_frac))) - if CO2_CMODE: - if mype == 0: - A_CO2_cconc.get(itap_sec, field_recv_A_CO2_cconc) - logging.debug('A_CO2_cconc -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_cconc), np.mean(field_recv_A_CO2_cconc), np.max(field_recv_A_CO2_cconc))) - A_CO2_econc.get(itap_sec, field_recv_A_CO2_econc) - logging.debug('A_CO2_econc -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_econc), np.mean(field_recv_A_CO2_econc), np.max(field_recv_A_CO2_econc))) - if CO2_EMODE: - A_CO2_emis.get(itap_sec, field_recv_A_CO2_emis) - logging.debug('A_CO2_emis -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_emis), np.mean(field_recv_A_CO2_emis), np.max(field_recv_A_CO2_emis))) - A_CO2_veg.get(itap_sec, field_recv_A_CO2_veg) - logging.debug('A_CO2_veg -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_veg), np.mean(field_recv_A_CO2_veg), np.max(field_recv_A_CO2_veg))) - A_CO2_fire.get(itap_sec, field_recv_A_CO2_fire) - logging.debug('A_CO2_fire -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_fire), np.mean(field_recv_A_CO2_fire), np.max(field_recv_A_CO2_fire))) - A_CO2_oce.get(itap_sec, field_recv_A_CO2_oce) - logging.debug('A_CO2_oce -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_oce), np.mean(field_recv_A_CO2_oce), np.max(field_recv_A_CO2_oce))) - logging.debug('--------------------------------------\n') - - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # TERMINATION - # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - logging.debug('End of the program') - - del comp diff --git a/scripts/cdo_cmd.sh b/scripts/cdo_cmd.sh deleted file mode 100644 index 8e81c63..0000000 --- a/scripts/cdo_cmd.sh +++ /dev/null @@ -1,40 +0,0 @@ -SiB4v2_BioFluxes_v246_1x1_2014_day.nc -source = "/scratch-shared/iluijkx/SiB4v2_Biosphere_Fluxes//SiB4v2_BioFluxes_201401.nc" -sib4_regrid.ipynb -"Tue Jul 04 18:23:46 2023: cdo -O settime,00:00:00 -daymean SiB4v2_BioFluxes_v246_1x1_2014_3hour.nc SiB4v2_BioFluxes_v246_1x1_2014_day.nc\n", -"Tue Jul 04 18:22:36 2023: cdo -O -f nc4c -z zip_2 mergetime tmp_201401.nc tmp_201402.nc tmp_201403.nc tmp_201404.nc tmp_201405.nc tmp_201406.nc tmp_201407.nc tmp_201408.nc tmp_201409.nc tmp_201410.nc tmp_201411.nc tmp_201412.nc SiB4v2_BioFluxes_v246_1x1_2014_3hour.nc\n", -"Tue Jul 04 18:22:32 2023: cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,3hour SiB4v2_BioFluxes_v246_1x1_201401.nc tmp_201401.nc" - -SiB4v2_BioFluxes_v246_1x1_2014_3hours.nc -"sib4_regrid.ipynb" ; -source = "/scratch-shared/iluijkx/SiB4v2_Biosphere_Fluxes//SiB4v2_BioFluxes_201401.nc" -"Tue Jul 04 18:22:36 2023: cdo -O -f nc4c -z zip_2 mergetime tmp_201401.nc tmp_201402.nc tmp_201403.nc tmp_201404.nc tmp_201405.nc tmp_201406.nc tmp_201407.nc tmp_201408.nc tmp_201409.nc tmp_201410.nc tmp_201411.nc tmp_201412.nc SiB4v2_BioFluxes_v246_1x1_2014_3hour.nc\n", -"Tue Jul 04 18:22:32 2023: cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,3hour SiB4v2_BioFluxes_v246_1x1_201401.nc tmp_201401.nc" - -GCP_Global_1x1_2014.mod.nc -:source = "/projects/0/ctdas/input/ctdas_2012//fossil/GridFED_v2022.2/GCP-GridFEDv2022.2_2014.nc" ; -:script = "conversion_gridfed.ipynb" ; -:history = "Tue Jul 04 18:43:08 2023: cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,month GCP_Global_1x1_2014.nc GCP_Global_1x1_2014.mod.nc" ; - -oc_v2021_daily_mol_s_m2_2014.mod.nc -:source = "oc_v2021_daily.nc" ; -:date = "08-02-2022" ; -:comment = "Regridded & converted CarboScope ocean flux, with application of a transcom-based landmask." ; -:script = "carboscope_regrid.ipynb" ; -:history = "Wed Jul 05 10:24:44 2023: cdo -r -O -setreftime,2000-01-01 -settaxis,2014-01-01 -delvar,co2flux_ocean_monthly oc_v2021_monthly_mol_s_m2_2014.nc oc_v2021_daily_mol_s_m2_2014.mod.nc" ; - -oc_v2021_monthly_mol_s_m2_2014.mod.nc -:source = "oc_v2021_daily.nc" ; -:author = "R. de Kok" ; -:date = "08-02-2022" ; -:comment = "Regridded & converted CarboScope ocean flux, with application of a transcom-based landmask." ; -:script = "carboscope_regrid.ipynb" ; -:history = "Wed Jul 05 10:26:53 2023: cdo -r -O -setreftime,2000-01-01 -settaxis,2014-01-01 -delvar,co2flux_ocean oc_v2021_monthly_mol_s_m2_2014.nc oc_v2021_monthly_mol_s_m2_2014.mod.nc" ; - -gfas_1x1_2014.nc -:source = "/scratch/shared/lflorent/output_gfas_2014.nc" ; -:author = "L. Florentie" ; -:date = "15-06-2020" ; -:script = "GFAS_fires_conversion.ipynb" ; -:history = "Wed Jul 05 10:42:52 2023: cdo -O -f nc4c -z zip_2 mergetime tmp_201401.nc tmp_201402.nc tmp_201403.nc tmp_201404.nc tmp_201405.nc tmp_201406.nc tmp_201407.nc tmp_201408.nc tmp_201409.nc tmp_201410.nc tmp_201411.nc tmp_201412.nc gfas_1x1_2014.nc\n", -"Wed Jul 05 10:42:51 2023: cdo -r -O -setreftime,2000-01-01,00:00:00,days -settaxis,2014-01-01,00:00:00,1day gfas_1x1_201401.nc tmp_201401.nc" ; diff --git a/scripts/convert-ece4pyreader-grids.sh b/scripts/convert-ece4pyreader-grids.sh old mode 100644 new mode 100755 index b3a979c..6d030d8 --- a/scripts/convert-ece4pyreader-grids.sh +++ b/scripts/convert-ece4pyreader-grids.sh @@ -14,14 +14,16 @@ griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/script gridname_AMIP=AMIP griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt gridname_co2=CO2 -griddef_co2=grid-co2_emis.txt # cdo griddes > grid-co2_emis.txt +griddef_ceds=grid-CEDS.txt # cdo griddes > grid-CEDS.txt +griddef_carbon_tracker=grid-REG_1X1.txt # cdo griddes > grid-REG_1X1.txt model_ifs=IFS_TOY # set vars according to model_mode # TODO: They will be replaced by python YAML reader - +CO2FLUX=false [ $model_mode = "co2box" ] && CO2BOX=true || CO2BOX=false -[ $model_mode = "co2flux" ] && CO2FLUX=true || CO2FLUX=false +[ $model_mode = "co2flux_ceds" ] && { CO2FLUX_CEDS=true; CO2FLUX=true; } || CO2FLUX_CEDS=false +[ $model_mode = "co2flux_carbon_tracker" ] && { CO2FLUX_CARBON_TRACKER=true; CO2FLUX=true; }|| CO2FLUX_CARBON_TRACKER=false if [[ ${CO2BOX} == true ]] ; then grids="" @@ -32,12 +34,34 @@ if [[ ${CO2BOX} == true ]] ; then vars_co2="" vars_co2_co2box="CO2BOX_CO2_cconc CO2BOX_CO2_econc" vars_co2_ifs="A_CO2_cconc A_CO2_econc" + +# elif [[ ${CO2FLUX_CARBON_TRACKER} == true ]] ; then +# grids="AMIP L128" #B128 A128 R128 +# vars_amip="AMIP_sst AMIP_sic" +# vars_ifs="A_SST A_Ice_frac" +# [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" +# model_amip=AMIPFORC +# model_co2=AMIPFORC +# [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" +# vars_co2_co2box="" +# vars_co2_ifs="" + +# elif [[ ${CO2FLUX_CARBON_TRACKER} == true ]] ; then +# grids=" REG_1X1" +# vars_amip="" +# vars_ifs=" A_CO2_veg A_CO2_fire A_CO2_oce" +# model_amip=AMIPFORC +# model_co2=AMIPFORC +# vars_co2="AMIP_CO2_emis" +# vars_co2_co2box="" +# vars_co2_ifs="" else grids="AMIP L128" #B128 A128 R128 - [[ ${CO2FLUX} == true ]] && grids+=" CO2_emis" + [[ ${CO2FLUX_CEDS} == true ]] && grids+=" CEDS" + [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && grids+=" REG_1X1" vars_amip="AMIP_sst AMIP_sic" vars_ifs="A_SST A_Ice_frac" - [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_land A_CO2_ocean" + [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" model_amip=AMIPFORC model_co2=AMIPFORC [[ ${CO2FLUX} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" @@ -52,10 +76,14 @@ do format=nc suffix=".nc" griddef=${griddef_amip} - elif [[ ${gridname} == CO2_emis ]] ; then + elif [[ ${gridname} == CEDS ]] ; then + format=nc + suffix=".nc" + griddef=${griddef_ceds} + elif [[ ${gridname} == REG_1X1 ]] ; then format=nc suffix=".nc" - griddef=${griddef_co2} + griddef=${griddef_carbon_tracker} else format=grb1 suffix=".grb" @@ -84,8 +112,9 @@ done for v in $vars_co2 do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_co2} ${v}_${model_co2}_??.nc ${v}.nc + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_ceds} ${v}_${model_co2}_??.nc ${v}.nc done + for v in $vars_co2_co2box do HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_co2}_??.nc ${v}.nc @@ -94,3 +123,4 @@ for v in $vars_co2_ifs do HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_ifs}_??.nc ${v}.nc done + diff --git a/scripts/convert-ece4pyreader-grids_moified.sh b/scripts/convert-ece4pyreader-grids_moified.sh deleted file mode 100755 index 6d030d8..0000000 --- a/scripts/convert-ece4pyreader-grids_moified.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash - -set -xuve - -#griddir=/gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids -griddir=. - -newdate=$1 -#taxis="settaxis,21450101,00:00:00,1day" -taxis="settaxis,$newdate,00:00:00,1day" - -gridname_ifs=L128 -griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids -gridname_AMIP=AMIP -griddef_amip=grid-amip.txt # cdo griddes tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc > grid-amip.txt -gridname_co2=CO2 -griddef_ceds=grid-CEDS.txt # cdo griddes > grid-CEDS.txt -griddef_carbon_tracker=grid-REG_1X1.txt # cdo griddes > grid-REG_1X1.txt -model_ifs=IFS_TOY - -# set vars according to model_mode -# TODO: They will be replaced by python YAML reader -CO2FLUX=false -[ $model_mode = "co2box" ] && CO2BOX=true || CO2BOX=false -[ $model_mode = "co2flux_ceds" ] && { CO2FLUX_CEDS=true; CO2FLUX=true; } || CO2FLUX_CEDS=false -[ $model_mode = "co2flux_carbon_tracker" ] && { CO2FLUX_CARBON_TRACKER=true; CO2FLUX=true; }|| CO2FLUX_CARBON_TRACKER=false - -if [[ ${CO2BOX} == true ]] ; then - grids="" - vars_amip="" - vars_ifs="" - model_amip=CO2BOX - model_co2=CO2BOX - vars_co2="" - vars_co2_co2box="CO2BOX_CO2_cconc CO2BOX_CO2_econc" - vars_co2_ifs="A_CO2_cconc A_CO2_econc" - -# elif [[ ${CO2FLUX_CARBON_TRACKER} == true ]] ; then -# grids="AMIP L128" #B128 A128 R128 -# vars_amip="AMIP_sst AMIP_sic" -# vars_ifs="A_SST A_Ice_frac" -# [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" -# model_amip=AMIPFORC -# model_co2=AMIPFORC -# [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" -# vars_co2_co2box="" -# vars_co2_ifs="" - -# elif [[ ${CO2FLUX_CARBON_TRACKER} == true ]] ; then -# grids=" REG_1X1" -# vars_amip="" -# vars_ifs=" A_CO2_veg A_CO2_fire A_CO2_oce" -# model_amip=AMIPFORC -# model_co2=AMIPFORC -# vars_co2="AMIP_CO2_emis" -# vars_co2_co2box="" -# vars_co2_ifs="" -else - grids="AMIP L128" #B128 A128 R128 - [[ ${CO2FLUX_CEDS} == true ]] && grids+=" CEDS" - [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && grids+=" REG_1X1" - vars_amip="AMIP_sst AMIP_sic" - vars_ifs="A_SST A_Ice_frac" - [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" - model_amip=AMIPFORC - model_co2=AMIPFORC - [[ ${CO2FLUX} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" - vars_co2_co2box="" - vars_co2_ifs="" -fi - -# copy from runtime dir the following files grids.nc areas.nc masks.nc -for gridname in ${grids} -do - if [[ ${gridname} == AMIP ]] ; then - format=nc - suffix=".nc" - griddef=${griddef_amip} - elif [[ ${gridname} == CEDS ]] ; then - format=nc - suffix=".nc" - griddef=${griddef_ceds} - elif [[ ${gridname} == REG_1X1 ]] ; then - format=nc - suffix=".nc" - griddef=${griddef_carbon_tracker} - else - format=grb1 - suffix=".grb" - griddef=${griddef_ifs} - fi - cdo -f $format -setgrid,${griddir}/${griddef} -selvar,${gridname}.msk masks.nc masks_${gridname}${suffix} - cdo -f $format -setgrid,${griddir}/${griddef} -selvar,${gridname}.srf areas.nc areas_${gridname}${suffix} - if [[ ${format} == "grb1" ]] ; then - for t in masks areas ; do - cdo -f nc -setgridtype,regularnn ${t}_${gridname}.grb ${t}_${gridname}.nc - done - fi -done - - -for v in $vars_ifs -do - cdo -O -f grb1 -r $taxis -setgrid,${griddir}/${griddef_ifs} ${v}_${model_ifs}_??.nc ${v}.grb - cdo -O -f nc -r $taxis -setgridtype,regular -chvar,var1,${v} ${v}.grb ${v}.nc -done - -for v in $vars_amip -do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_amip} ${v}_${model_amip}_??.nc ${v}.nc -done - -for v in $vars_co2 -do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_ceds} ${v}_${model_co2}_??.nc ${v}.nc -done - -for v in $vars_co2_co2box -do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_co2}_??.nc ${v}.nc -done -for v in $vars_co2_ifs -do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_ifs}_??.nc ${v}.nc -done - diff --git a/scripts/run_example.sh b/scripts/run_example.sh index 0170d35..dafffeb 100755 --- a/scripts/run_example.sh +++ b/scripts/run_example.sh @@ -173,8 +173,7 @@ fi # convert output -#. convert-ece4pyreader-grids.sh ${leg_start_date} -. convert-ece4pyreader-grids_moified.sh ${leg_start_date} +. convert-ece4pyreader-grids.sh ${leg_start_date} #echo $casename 'is executed or submitted to queue.' -- GitLab From 9a4c50dbb6be7f4d7671d0e9c141277794b42998 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 11 Oct 2023 17:15:15 +0200 Subject: [PATCH 13/17] apply chnages from MR12 --- data.md5 | 136 +++++++++++------- scripts/convert-ece4pyreader-grids.sh | 22 +-- scripts/launch_ece3_data_coupler_mn4.cmd | 4 +- scripts/namcouple_co2.sh | 2 +- scripts/run_example.sh | 2 +- .../template_conf_datacoupler_co2flux.yaml | 35 ----- 6 files changed, 93 insertions(+), 108 deletions(-) delete mode 100755 scripts/template_conf_datacoupler_co2flux.yaml diff --git a/data.md5 b/data.md5 index 6082204..017a032 100644 --- a/data.md5 +++ b/data.md5 @@ -1,48 +1,88 @@ -033f343ce3a67f8bb501351f99a85317 data/areas-noamip.nc -e20bd335d965c010b675f20f81e0d46e data/grid-co2_emis.txt -3bbb8b30e6f607153b1f692f75f4c0e1 data/co2/CO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-2017-08-30_gn_200001-201412.nc -2944ea34fc24351e917c4da477c954b0 data/co2/rmp_CO2_emis_to_B128_GAUSWGT_9.nc -bf613badddb00b8bb7a8ea4c701f54a7 data/co2/masks.nc -63bf264ef75413ebb365218130fd00c2 data/co2/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc -5f57096c16cc1a46e04e43a32c73c8ce data/co2/CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-r1x2.nc -7f8ee4bf120727cfff1045aa1fc9533c data/co2/grids.nc -093662070c6903f56b82ce5240bf67cf data/co2/areas.nc -c0fd8ffdd070907b2c969c8bf36f0d25 data/co2/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc -2c57c30f97f9540f6ea8f7d0f7384ed6 data/co2/co2-area.nc -11b7cf6371d0de75bad15aed846b03e8 data/co2/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.mod -a6410320ce2ec894d788c93ef07a4e99 data/co2/CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc.1 -270e2062aa3fa40014c2a79f9e46dd13 data/co2/rmp_AMIP_to_L128_GAUSWGT_9.nc -c0fd8ffdd070907b2c969c8bf36f0d25 data/co2/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.bak -89f40993d927d188692df6fb621450bf data/co2/CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc -2a6ace582904da9db74c0de7d9fbfbeb data/co2/CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc -90a2c7aac4c2084f7d665bae3ccb842f data/ece3-toy-model/rmp_O1t0_to_L128_GAUSWGT_9.nc -433d647d7a5e963ccf63797ee2fbf911 data/ece3-toy-model/masks.nc -234ac42fa5d5cd076c2e7f4ab37b577b data/ece3-toy-model/rmp_A128_to_O1t0_GAUSWGT_9.nc -b4cf799ea4e4a141d127cc033572648d data/ece3-toy-model/grids.nc -76877af296ecf92f6a5115d2024d9278 data/ece3-toy-model/areas.nc -670f63a39e8a56b7eec8a919f478d5d2 data/ece3-toy-model/rmp_R128_to_RnfA_GAUSWGT_9.nc -02645b463f3a65a929c408c3b8c478e9 data/ece3-toy-model/rmp_A128_to_O1v0_GAUSWGT_9.nc -f8d27ddaa19cf744ab21e313a24c41e4 data/ece3-toy-model/grid-runoff.txt -16dbe2fa3832ff2927117d05b80ad593 data/ece3-toy-model/rmp_RnfO_to_O1t0_GAUSWGT_9.nc -8324c68639fb9547509a92674fdeebcb data/ece3-toy-model/rmp_A128_to_O1u0_GAUSWGT_9.nc -c2841c4f4097f1e8222ff06ddc22cb8d data/ece3-toy-model/rstas.nc -0eacc528218b23b7cfc7f88f05e7d474 data/ece3-toy-model/rstos.nc -f8f32e94f5844e28dcac542d3037f7c7 data/grid-amip.txt -2b7ad9915a0ea47be23d4f2499ac8a39 data/ICMGGa22e+000000 -eb2ddf1dd805be45c83da44316292843 data/forcing/AMIP/masks.nc -0715a0b90cab18235a17b48f1dcfee8b data/forcing/AMIP/grids.nc -3b0a69e73f3c655745df83b9e6763365 data/forcing/AMIP/areas.nc -2b01f60712a7de76ddad74edf0ca2fcc data/forcing/noamip/areas-noamip.nc -962d938652e10c82cf2c4fefb9875039 data/forcing/noamip/masks-noamip.nc -7763084bc6027f84f1d13b04c3b76ef1 data/forcing/noamip/grids-noamip.nc -c083451e0eb8a591b65b8d32c7ef9284 data/forcing/siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc -eb2ddf1dd805be45c83da44316292843 data/forcing/masks.nc -080e5320ad6cdf2d29710d3091376dac data/forcing/amip-area.nc -0715a0b90cab18235a17b48f1dcfee8b data/forcing/grids.nc -3b0a69e73f3c655745df83b9e6763365 data/forcing/areas.nc -370bcbfaec69f457ec53401fba125e27 data/forcing/tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc -270e2062aa3fa40014c2a79f9e46dd13 data/forcing/rmp_AMIP_to_L128_GAUSWGT_9.nc -95ce78c393b419557a04906554700ecc data/forcing/tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-0_gs1x1_187001-201512.nc -9435d96e3e2f55caa762defbaf630e71 data/forcing/siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-0_gs1x1_187001-201512.nc -f925f778f5cb615cef0856ea4797389a data/masks-noamip.nc -ac6a81c53dd07dfe45c5b399a66de34c data/grids-noamip.nc +033f343ce3a67f8bb501351f99a85317 ./data/areas-noamip.nc +b1a58ea43e67034d6dd50f0afc1aa6f9 ./data/grid-REG_1X1.txt +e20bd335d965c010b675f20f81e0d46e ./data/grid-co2_emis.txt +3bbb8b30e6f607153b1f692f75f4c0e1 ./data/co2/CO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-2017-08-30_gn_200001-201412.nc +2944ea34fc24351e917c4da477c954b0 ./data/co2/rmp_CO2_emis_to_B128_GAUSWGT_9.nc +9408d2599eddc5fcc6ce45fdff516fea ./data/co2/rmp_REG_1X1_to_B128_GAUSWGT_9.nc +bf613badddb00b8bb7a8ea4c701f54a7 ./data/co2/masks.nc +dc20bf8d42385ad3d9d29541d1bda510 ./data/co2/rmp_CEDS_to_R128_GAUSWGT_9.nc +63bf264ef75413ebb365218130fd00c2 ./data/co2/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014.nc +5f57096c16cc1a46e04e43a32c73c8ce ./data/co2/CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-r1x2.nc +a25d42454c58d07c754c46cd53d00e44 ./data/co2/rmp_REG_1X1_to_R128_GAUSWGT_9.nc +7f8ee4bf120727cfff1045aa1fc9533c ./data/co2/grids.nc +093662070c6903f56b82ce5240bf67cf ./data/co2/areas.nc +66348ca71710468f18ca2413f2195a58 ./data/co2/oc_v2021_daily_mol_s_m2_2014.mod.nc +271bb575f1476799f0142d8d85fadede ./data/co2/SiB4v2_BioFluxes_v246_1x1_2014_day.nc +717c7c8b58dee3706ba50d199c751a71 ./data/co2/rmp_REG_1X1_to_A128_GAUSWGT_9.nc +3779986d32b0fce5c67b9c8bd63e493f ./data/co2/rmp_CEDS_to_A128_GAUSWGT_9.nc +c0fd8ffdd070907b2c969c8bf36f0d25 ./data/co2/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc +2c57c30f97f9540f6ea8f7d0f7384ed6 ./data/co2/co2-area.nc +11b7cf6371d0de75bad15aed846b03e8 ./data/co2/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.mod +a6410320ce2ec894d788c93ef07a4e99 ./data/co2/CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc.1 +71cfc442c1568cc917895b1976c17e74 ./data/co2/carbon_tracker/ocean/oc_v2021_monthly_mol_s_m2_2014.nc +33db8e3669581863e7f86db740d2abd4 ./data/co2/carbon_tracker/fossil/GCP_Global_1x1_2014.nc +ba0496ecf1c96d246e9449f002e5ef7e ./data/co2/carbon_tracker/fire/gfas_1x1_201408.nc +94beaeadfc3278f983e9f38d88627f78 ./data/co2/carbon_tracker/fire/gfas_1x1_201412.nc +44411fe3797af87062f87e38f58fd6b2 ./data/co2/carbon_tracker/fire/gfas_1x1_201402.nc +7b9be5b9df480bb767275659dd2df461 ./data/co2/carbon_tracker/fire/gfas_1x1_201407.nc +15fd760ac5f063540b8ff25fde9c2187 ./data/co2/carbon_tracker/fire/gfas_1x1_201403.nc +95e99c05bab291f7ae5b729fe021428d ./data/co2/carbon_tracker/fire/gfas_1x1_201404.nc +8b538ca5ac63767666e407b85b9a2f9a ./data/co2/carbon_tracker/fire/gfas_1x1_201406.nc +4db2c90c9cf74ba6e421f06b17309ee8 ./data/co2/carbon_tracker/fire/gfas_1x1_201410.nc +4f8a9c9970ed5e0bedba4c581d8ceb82 ./data/co2/carbon_tracker/fire/gfas_1x1_201409.nc +b858ef5fc5b07bbb31ec7221fb51ff04 ./data/co2/carbon_tracker/fire/gfas_1x1_201401.nc +73fcb152bab03195fd333e675963b02a ./data/co2/carbon_tracker/fire/gfas_1x1_201411.nc +e6dd347f2f26c888888e95e12a38a4cc ./data/co2/carbon_tracker/fire/gfas_1x1_201405.nc +6bd50f126053158481af5bde8f95e193 ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201405.nc +1127a1e02d1b6cc9961d8cb389322461 ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201406.nc +cda817bbcc0caf9f03425ae31caf3229 ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201410.nc +c1cb293318db94d71a55f46beeada4b6 ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201411.nc +47cf1f1fd4edb7660a94b18ec801cfbe ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201412.nc +eb0b942352c89af4a651b20725fe53a6 ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201408.nc +5554c846d4fe98ab4592d6f15263d83c ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201404.nc +76e05f445ba087a7aa733bc7d462d1e3 ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201402.nc +b411d0222faef18f8ca08c73a271c85a ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201401.nc +49bc2e1a9a0f28e992572e743cddcfce ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201403.nc +9df706a64a99602a7085d0367c85091a ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201407.nc +265354803f13fd3c48a8f3ae30af2da6 ./data/co2/carbon_tracker/bio/SiB4v2_BioFluxes_v246_1x1_201409.nc +71cfc442c1568cc917895b1976c17e74 ./data/co2/oc_v2021_monthly_mol_s_m2_2014.nc +270e2062aa3fa40014c2a79f9e46dd13 ./data/co2/rmp_AMIP_to_L128_GAUSWGT_9.nc +c0fd8ffdd070907b2c969c8bf36f0d25 ./data/co2/mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.bak +dac881b284d9541c9159042decbf2e9d ./data/co2/rmp_CEDS_to_B128_GAUSWGT_9.nc +eaac40a9e26c4683fd1ae68f832facd1 ./data/co2/gfas_1x1_2014.nc +08acf824d0d5dde3dc18007344df6a57 ./data/co2/oc_v2021_monthly_mol_s_m2_2014.mod.nc +89f40993d927d188692df6fb621450bf ./data/co2/CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412-global.nc +b7333ea2347c972c82127f5884be9cd1 ./data/co2/GCP_Global_1x1_2014.mod.nc +fa11cd870cca11cfddd8250fc8bf8d5f ./data/grid-CEDS.txt +90a2c7aac4c2084f7d665bae3ccb842f ./data/ece3-toy-model/rmp_O1t0_to_L128_GAUSWGT_9.nc +433d647d7a5e963ccf63797ee2fbf911 ./data/ece3-toy-model/masks.nc +234ac42fa5d5cd076c2e7f4ab37b577b ./data/ece3-toy-model/rmp_A128_to_O1t0_GAUSWGT_9.nc +b4cf799ea4e4a141d127cc033572648d ./data/ece3-toy-model/grids.nc +76877af296ecf92f6a5115d2024d9278 ./data/ece3-toy-model/areas.nc +670f63a39e8a56b7eec8a919f478d5d2 ./data/ece3-toy-model/rmp_R128_to_RnfA_GAUSWGT_9.nc +02645b463f3a65a929c408c3b8c478e9 ./data/ece3-toy-model/rmp_A128_to_O1v0_GAUSWGT_9.nc +f8d27ddaa19cf744ab21e313a24c41e4 ./data/ece3-toy-model/grid-runoff.txt +16dbe2fa3832ff2927117d05b80ad593 ./data/ece3-toy-model/rmp_RnfO_to_O1t0_GAUSWGT_9.nc +8324c68639fb9547509a92674fdeebcb ./data/ece3-toy-model/rmp_A128_to_O1u0_GAUSWGT_9.nc +c2841c4f4097f1e8222ff06ddc22cb8d ./data/ece3-toy-model/rstas.nc +0eacc528218b23b7cfc7f88f05e7d474 ./data/ece3-toy-model/rstos.nc +f8f32e94f5844e28dcac542d3037f7c7 ./data/grid-amip.txt +2b7ad9915a0ea47be23d4f2499ac8a39 ./data/ICMGGa22e+000000 +eb2ddf1dd805be45c83da44316292843 ./data/forcing/AMIP/masks.nc +0715a0b90cab18235a17b48f1dcfee8b ./data/forcing/AMIP/grids.nc +3b0a69e73f3c655745df83b9e6763365 ./data/forcing/AMIP/areas.nc +2b01f60712a7de76ddad74edf0ca2fcc ./data/forcing/noamip/areas-noamip.nc +962d938652e10c82cf2c4fefb9875039 ./data/forcing/noamip/masks-noamip.nc +7763084bc6027f84f1d13b04c3b76ef1 ./data/forcing/noamip/grids-noamip.nc +c083451e0eb8a591b65b8d32c7ef9284 ./data/forcing/siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc +eb2ddf1dd805be45c83da44316292843 ./data/forcing/masks.nc +080e5320ad6cdf2d29710d3091376dac ./data/forcing/amip-area.nc +0715a0b90cab18235a17b48f1dcfee8b ./data/forcing/grids.nc +3b0a69e73f3c655745df83b9e6763365 ./data/forcing/areas.nc +370bcbfaec69f457ec53401fba125e27 ./data/forcing/tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc +270e2062aa3fa40014c2a79f9e46dd13 ./data/forcing/rmp_AMIP_to_L128_GAUSWGT_9.nc +95ce78c393b419557a04906554700ecc ./data/forcing/tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-0_gs1x1_187001-201512.nc +9435d96e3e2f55caa762defbaf630e71 ./data/forcing/siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-0_gs1x1_187001-201512.nc +f925f778f5cb615cef0856ea4797389a ./data/masks-noamip.nc +ac6a81c53dd07dfe45c5b399a66de34c ./data/grids-noamip.nc + diff --git a/scripts/convert-ece4pyreader-grids.sh b/scripts/convert-ece4pyreader-grids.sh index 6d030d8..a106c36 100755 --- a/scripts/convert-ece4pyreader-grids.sh +++ b/scripts/convert-ece4pyreader-grids.sh @@ -35,33 +35,13 @@ if [[ ${CO2BOX} == true ]] ; then vars_co2_co2box="CO2BOX_CO2_cconc CO2BOX_CO2_econc" vars_co2_ifs="A_CO2_cconc A_CO2_econc" -# elif [[ ${CO2FLUX_CARBON_TRACKER} == true ]] ; then -# grids="AMIP L128" #B128 A128 R128 -# vars_amip="AMIP_sst AMIP_sic" -# vars_ifs="A_SST A_Ice_frac" -# [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" -# model_amip=AMIPFORC -# model_co2=AMIPFORC -# [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" -# vars_co2_co2box="" -# vars_co2_ifs="" - -# elif [[ ${CO2FLUX_CARBON_TRACKER} == true ]] ; then -# grids=" REG_1X1" -# vars_amip="" -# vars_ifs=" A_CO2_veg A_CO2_fire A_CO2_oce" -# model_amip=AMIPFORC -# model_co2=AMIPFORC -# vars_co2="AMIP_CO2_emis" -# vars_co2_co2box="" -# vars_co2_ifs="" else grids="AMIP L128" #B128 A128 R128 [[ ${CO2FLUX_CEDS} == true ]] && grids+=" CEDS" [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && grids+=" REG_1X1" vars_amip="AMIP_sst AMIP_sic" vars_ifs="A_SST A_Ice_frac" - [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_veg A_CO2_fire A_CO2_oce" + [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_veg A_CO2_fire A_CO2_oce" model_amip=AMIPFORC model_co2=AMIPFORC [[ ${CO2FLUX} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" diff --git a/scripts/launch_ece3_data_coupler_mn4.cmd b/scripts/launch_ece3_data_coupler_mn4.cmd index c3d97a3..1b7ff26 100644 --- a/scripts/launch_ece3_data_coupler_mn4.cmd +++ b/scripts/launch_ece3_data_coupler_mn4.cmd @@ -15,9 +15,9 @@ source modules.sh #AMIP Forcing only #bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml #AMIP Forcing + co2flux_ceds -#bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux_ceds.yaml +bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux_ceds.yaml #co2flux_carbon_tracker -bash ./run_example.sh datacoupler co2flux_carbon_tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml +#bash ./run_example.sh datacoupler co2flux_carbon_tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml #co2box only #bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml diff --git a/scripts/namcouple_co2.sh b/scripts/namcouple_co2.sh index 7e0c83c..8e7212b 100644 --- a/scripts/namcouple_co2.sh +++ b/scripts/namcouple_co2.sh @@ -11,7 +11,7 @@ cat << EOF \$END # ------------------------------------------------------------------------------------------------- \$NLOGPRT - 20 0 + 0 0 \$END # ------------------------------------------------------------------------------------------------- \$STRINGS diff --git a/scripts/run_example.sh b/scripts/run_example.sh index dafffeb..01dc1f8 100755 --- a/scripts/run_example.sh +++ b/scripts/run_example.sh @@ -98,7 +98,7 @@ if [ $model=datacoupler ]; then ln -sf $datadir/co2/CO2-em-AIR-anthro_*.nc $rundir/. ln -sf $datadir/co2/mole-fraction-of-carbon-dioxide-in-air_*.nc* $rundir/. ln -sf $datadir/co2/rmp_* $rundir/. - ln -sf $datadir/co2/oc_v2021_* $rundir/. + ln -sf $datadir/co2/oc_v2021_daily_mol_s_m2_2014.mod.nc $rundir/. ln -sf $datadir/co2/SiB4v2_BioFluxes_v246_1x1_2014_day.nc $rundir/. ln -sf $datadir/co2/GCP_Global_1x1_2014.mod.nc $rundir/. ln -sf $datadir/co2/gfas_1x1_2014.nc $rundir/. diff --git a/scripts/template_conf_datacoupler_co2flux.yaml b/scripts/template_conf_datacoupler_co2flux.yaml deleted file mode 100755 index 995e8b0..0000000 --- a/scripts/template_conf_datacoupler_co2flux.yaml +++ /dev/null @@ -1,35 +0,0 @@ -cat << EOF -# YAML input file for DataCoupler, It will be ingested and turn to Experiment YAML file - -## Model Information -ModelNameSend : AMIPFORC -ModelNameReceive : IFS_TOY -LogFileName : amip.log - -## Run Information -RunLengthSec : ${leg_length_sec} -TimeStepSec : ${cpl_freq_amip_sec} -StartYear : ${leg_start_date_yyyymmdd:0:4} -StartMonth : ${leg_start_date_yyyymmdd:4:2} -StartDay : ${leg_start_date_yyyymmdd:6:2} -FixYear : ${ifs_cmip_fixyear} -GridInfo : 88838 # number of grid cells : L080_NX = 35718 @ T159 resolution / L128_NX = 88838 @ T255 resolution / L256_NX = 348528 @ T511 resolution - -## Coupling Information -FileInputVars: - AMIP_sst_monthly : { id : AMIP_sst_monthly, grid_name: AMIP, oasis_name: AMIP_sst, file_pattern: tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: tosbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 1, offset: 273.15, min: 271.38, max: , update: true, accum: true} - AMIP_sic_monthly : { id : AMIP_sic_monthly, grid_name: AMIP, oasis_name: AMIP_sic, file_pattern: siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc, netcdf_variable: siconcbcs, yref_min : 1870, yref_max: 2016, timestep: monthly, interpolate : true, scale_factor: 0.01, offset: 0, min: 0, max: 1, update: true, accum: true} - CO2_em_monthly : { id : CO2_em_monthly, grid_name: CO2_emis, oasis_name: AMIP_CO2_emis, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 1, offset: 0, min: , max: , update: true, accum: true} - CO2_land_monthly: { id : CO2_land_monthly, grid_name: CO2_emis, oasis_name: AMIP_CO2_land, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.5, offset: 0, min: , max: , update: true, accum: true} - CO2_ocean_monthly: { id : CO2_ocean_monthly, grid_name: CO2_emis, oasis_name: AMIP_CO2_ocean, file_pattern: CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc, netcdf_variable: CO2_em_anthro, yref_min : 1750, yref_max: 2018, timestep: monthly, interpolate : false, scale_factor: 0.1, offset: 0, min: , max: , update: true, accum: true} - -OasisOutputVars: - AMIP_sst : { send_id: AMIP_sst, receive_id: A_SST, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - AMIP_sic : { send_id: AMIP_sic, receive_id: A_Ice_frac, send_grid_name: 'AMIP', receive_grid_name: L128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - AMIP_CO2_emis : { send_id: AMIP_CO2_emis, receive_id: A_CO2_emis, send_grid_name: 'CO2_emis', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - AMIP_CO2_land : { send_id: AMIP_CO2_land, receive_id: A_CO2_land, send_grid_name: 'CO2_emis', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - AMIP_CO2_ocean : { send_id: AMIP_CO2_ocean, receive_id: A_CO2_ocean, send_grid_name: 'CO2_emis', receive_grid_name: B128, timestep: 'daily', scale_factor: 1, offset: 0, reset: true } - -LDebug : false -EOF - -- GitLab From 4b650346f5817ad1d57b536f22b1f367c62f6f6d Mon Sep 17 00:00:00 2001 From: Etienne Tourigny Date: Wed, 11 Oct 2023 15:41:13 +0000 Subject: [PATCH 14/17] fix warning when sourcing modules.sh --- scripts/modules.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/modules.sh b/scripts/modules.sh index d089610..40abad1 100644 --- a/scripts/modules.sh +++ b/scripts/modules.sh @@ -1,7 +1,6 @@ #!/bin/bash - -if [ $BSC_MACHINE = mn4 ]; then +if [ "$BSC_MACHINE" = mn4 ]; then # Environment for MN4 module load python/3.6.1 module load netcdf/4.2 @@ -13,7 +12,7 @@ if [ $BSC_MACHINE = mn4 ]; then # setup pyOasis environment source ../sources/oasis3-mct/generated/python/init.sh -elif [ $ECPLATFORM = hpc2020 ]; then +elif [ "$ECPLATFORM" = hpc2020 ]; then # Environment for HPC2020 module reset #module load python3/3.8.8-01 prgenv/intel intel/2021.4.0 intel-mkl/19.0.5 hpcx-openmpi/2.9.0 hdf5-parallel/1.10.6 netcdf4-parallel/4.7.4 cdo @@ -31,4 +30,4 @@ else echo "Error: Platform is unkown, could not load required moduleds." exit 1 -fi \ No newline at end of file +fi -- GitLab From 8029fe693e4208ccaeafff44e974b226bf03a3ff Mon Sep 17 00:00:00 2001 From: Etienne Tourigny Date: Wed, 11 Oct 2023 15:44:35 +0000 Subject: [PATCH 15/17] fix convert-ece4pyreader-grids.sh for carbon-tracker --- scripts/convert-ece4pyreader-grids.sh | 18 +++++++++--------- scripts/launch_ece3_data_coupler_hpc2020.cmd | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/convert-ece4pyreader-grids.sh b/scripts/convert-ece4pyreader-grids.sh index a106c36..34b8b4b 100755 --- a/scripts/convert-ece4pyreader-grids.sh +++ b/scripts/convert-ece4pyreader-grids.sh @@ -2,11 +2,9 @@ set -xuve -#griddir=/gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids griddir=. newdate=$1 -#taxis="settaxis,21450101,00:00:00,1day" taxis="settaxis,$newdate,00:00:00,1day" gridname_ifs=L128 @@ -21,9 +19,12 @@ model_ifs=IFS_TOY # set vars according to model_mode # TODO: They will be replaced by python YAML reader CO2FLUX=false +CO2FLUX_CEDS=false +CO2FLUX_CARBON_TRACKER=false +griddef_co2flux="" [ $model_mode = "co2box" ] && CO2BOX=true || CO2BOX=false -[ $model_mode = "co2flux_ceds" ] && { CO2FLUX_CEDS=true; CO2FLUX=true; } || CO2FLUX_CEDS=false -[ $model_mode = "co2flux_carbon_tracker" ] && { CO2FLUX_CARBON_TRACKER=true; CO2FLUX=true; }|| CO2FLUX_CARBON_TRACKER=false +[ $model_mode = "co2flux_ceds" ] && { CO2FLUX_CEDS=true; CO2FLUX=true; griddef_co2flux=${griddef_ceds}; } +[ $model_mode = "co2flux_carbon_tracker" ] && { CO2FLUX_CARBON_TRACKER=true; CO2FLUX=true; griddef_co2flux=${griddef_carbon_tracker}; } if [[ ${CO2BOX} == true ]] ; then grids="" @@ -31,7 +32,7 @@ if [[ ${CO2BOX} == true ]] ; then vars_ifs="" model_amip=CO2BOX model_co2=CO2BOX - vars_co2="" + vars_co2_co2flux="" vars_co2_co2box="CO2BOX_CO2_cconc CO2BOX_CO2_econc" vars_co2_ifs="A_CO2_cconc A_CO2_econc" @@ -44,7 +45,7 @@ else [[ ${CO2FLUX} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_veg A_CO2_fire A_CO2_oce" model_amip=AMIPFORC model_co2=AMIPFORC - [[ ${CO2FLUX} == true ]] && vars_co2="AMIP_CO2_emis" || vars_co2="" + [[ ${CO2FLUX} == true ]] && vars_co2_co2flux="AMIP_CO2_emis" || vars_co2_co2flux="" vars_co2_co2box="" vars_co2_ifs="" fi @@ -90,9 +91,9 @@ do HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_amip} ${v}_${model_amip}_??.nc ${v}.nc done -for v in $vars_co2 +for v in $vars_co2_co2flux do - HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_ceds} ${v}_${model_co2}_??.nc ${v}.nc + HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis -setgrid,${griddir}/${griddef_co2flux} ${v}_${model_co2}_??.nc ${v}.nc done for v in $vars_co2_co2box @@ -103,4 +104,3 @@ for v in $vars_co2_ifs do HDF5_DISABLE_VERSION_CHECK=1 cdo -O -f nc -r $taxis ${v}_${model_ifs}_??.nc ${v}.nc done - diff --git a/scripts/launch_ece3_data_coupler_hpc2020.cmd b/scripts/launch_ece3_data_coupler_hpc2020.cmd index 12c7c34..9057eb0 100644 --- a/scripts/launch_ece3_data_coupler_hpc2020.cmd +++ b/scripts/launch_ece3_data_coupler_hpc2020.cmd @@ -17,8 +17,8 @@ source modules.sh #AMIP Forcing + co2flux_ceds #bash ./run_example.sh datacoupler co2flux_ceds 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux_ceds.yaml #co2flux_carbon_tracker -#bash ./run_example.sh datacoupler co2flux_carbon_tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml +bash ./run_example.sh datacoupler co2flux_carbon_tracker 1 2014-01-01 2014-02-01 0 128 true false template_conf_datacoupler_co2flux_carbon_tracker.yaml #co2box only -bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml +#bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml -- GitLab From cb7e2e90f87a613dae1d6816ae7708052cc98410 Mon Sep 17 00:00:00 2001 From: Etienne Tourigny Date: Wed, 11 Oct 2023 16:02:23 +0000 Subject: [PATCH 16/17] add missing changes from carbon-tracker branch --- scripts/convert-ece4pyreader-grids.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/convert-ece4pyreader-grids.sh b/scripts/convert-ece4pyreader-grids.sh index 34b8b4b..c4f13c4 100755 --- a/scripts/convert-ece4pyreader-grids.sh +++ b/scripts/convert-ece4pyreader-grids.sh @@ -37,7 +37,7 @@ if [[ ${CO2BOX} == true ]] ; then vars_co2_ifs="A_CO2_cconc A_CO2_econc" else - grids="AMIP L128" #B128 A128 R128 + grids="AMIP L128 B128" #A128 R128 [[ ${CO2FLUX_CEDS} == true ]] && grids+=" CEDS" [[ ${CO2FLUX_CARBON_TRACKER} == true ]] && grids+=" REG_1X1" vars_amip="AMIP_sst AMIP_sic" -- GitLab From bd739998146a7abc9dd23cd915e404db75966796 Mon Sep 17 00:00:00 2001 From: Etienne Tourigny Date: Wed, 11 Oct 2023 16:03:31 +0000 Subject: [PATCH 17/17] add missing changes from carbon-tracker branch --- sources/data-coupler/DataCouplerOasisVar.py | 2 +- sources/data-coupler/DataCouplerUtils.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/data-coupler/DataCouplerOasisVar.py b/sources/data-coupler/DataCouplerOasisVar.py index 7b27d0b..b097a99 100644 --- a/sources/data-coupler/DataCouplerOasisVar.py +++ b/sources/data-coupler/DataCouplerOasisVar.py @@ -33,7 +33,7 @@ class OasisOutputVar: logging.debug('OasisOutputVar() conf={} reset={}'.format(str(self._conf),str(self._reset))) # reset if needed if self._reset: - self._send_field = 0. + self._send_field.fill(0.) logging.debug('reset field for var {} at time {}'.format(self._id,time)) # accumulate values from each fileIn_var linked to this oasisOut_var for (varname,fileIn_var) in self._fileIn_vars.items(): diff --git a/sources/data-coupler/DataCouplerUtils.py b/sources/data-coupler/DataCouplerUtils.py index 0ce66f1..3b7d67d 100644 --- a/sources/data-coupler/DataCouplerUtils.py +++ b/sources/data-coupler/DataCouplerUtils.py @@ -30,6 +30,7 @@ total_air_mass = 5.1480e18 # TODO add a global parameter to define this in case we use a global box model! #total_air_mass = 5.1480e18 / 2.0 +# TODO change this to a dict instead of function def scale_factor_from_str(scale_str): if scale_str == 'co2_mass_to_ppm': return 1 / 1e-6 / total_air_mass * fscale -- GitLab