Commits (11)
...@@ -75,6 +75,9 @@ class FileInputVar: ...@@ -75,6 +75,9 @@ class FileInputVar:
self.t_index = np.searchsorted(self.time_array, t_local, side='right')-1 self.t_index = np.searchsorted(self.time_array, t_local, side='right')-1
self.t2 = self.time_array[self.t_index] self.t2 = self.time_array[self.t_index]
self.t1 = self.t2 self.t1 = self.t2
logging.debug('{}: INIT - t_index: {}'.format(self.id, self.t_index))
self.__read_file() self.__read_file()
def update(self, t_global): def update(self, t_global):
......
...@@ -33,7 +33,7 @@ class OasisOutputVar: ...@@ -33,7 +33,7 @@ class OasisOutputVar:
logging.debug('OasisOutputVar() conf={} reset={}'.format(str(self._conf),str(self._reset))) logging.debug('OasisOutputVar() conf={} reset={}'.format(str(self._conf),str(self._reset)))
# reset if needed # reset if needed
if self._reset: if self._reset:
self._send_field = 0. self._send_field.fill(0.)
logging.debug('reset field for var {} at time {}'.format(self._id,time)) logging.debug('reset field for var {} at time {}'.format(self._id,time))
# accumulate values from each fileIn_var linked to this oasisOut_var # accumulate values from each fileIn_var linked to this oasisOut_var
for (varname,fileIn_var) in self._fileIn_vars.items(): for (varname,fileIn_var) in self._fileIn_vars.items():
......
...@@ -24,11 +24,16 @@ total_air_mass = 5.1480e18 ...@@ -24,11 +24,16 @@ total_air_mass = 5.1480e18
# TODO add a global parameter to define this in case we use a global box model! # TODO add a global parameter to define this in case we use a global box model!
#total_air_mass = 5.1480e18 / 2.0 #total_air_mass = 5.1480e18 / 2.0
# TODO change this to a dict instead of function
def scale_factor_from_str(scale_str): def scale_factor_from_str(scale_str):
if scale_str == 'co2_mass_to_ppm': if scale_str == 'co2_mass_to_ppm':
return 1 / 1e-6 / total_air_mass * fscale return 1 / 1e-6 / total_air_mass * fscale
elif scale_str == 'co2_ppm_to_mass': elif scale_str == 'co2_ppm_to_mass':
return 1 * 1e-6 * total_air_mass / fscale 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': elif scale_str == 'second2day':
return 24 * 60 * 60 return 24 * 60 * 60
else: else:
......
...@@ -103,10 +103,12 @@ if __name__ == '__main__': ...@@ -103,10 +103,12 @@ if __name__ == '__main__':
if CO2_EMODE: if CO2_EMODE:
A_CO2_emis = pyoasis.Var("A_CO2_emis", partition, OASIS.IN) A_CO2_emis = pyoasis.Var("A_CO2_emis", partition, OASIS.IN)
logging.debug('var_id A_CO2_emis {}'.format(A_CO2_emis._id)) logging.debug('var_id A_CO2_emis {}'.format(A_CO2_emis._id))
A_CO2_land = pyoasis.Var("A_CO2_land", partition, OASIS.IN) A_CO2_veg = pyoasis.Var("A_CO2_veg", partition, OASIS.IN)
logging.debug('var_id A_CO2_land {}'.format(A_CO2_land._id)) logging.debug('var_id A_CO2_veg {}'.format(A_CO2_veg._id))
A_CO2_ocean = pyoasis.Var("A_CO2_ocean", partition, OASIS.IN) A_CO2_fire = pyoasis.Var("A_CO2_fire", partition, OASIS.IN)
logging.debug('var_id A_CO2_ocean {}'.format(A_CO2_ocean._id)) 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 # TERMINATION OF DEFINITION PHASE
...@@ -127,8 +129,9 @@ if __name__ == '__main__': ...@@ -127,8 +129,9 @@ if __name__ == '__main__':
field_recv_A_CO2_econc = pyoasis.asarray(np.full(nx_co2, -1.0)) field_recv_A_CO2_econc = pyoasis.asarray(np.full(nx_co2, -1.0))
if CO2_EMODE: if CO2_EMODE:
field_recv_A_CO2_emis = pyoasis.asarray(np.full(il_size, -1.0)) field_recv_A_CO2_emis = pyoasis.asarray(np.full(il_size, -1.0))
field_recv_A_CO2_land = 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_ocean = 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): for itap_sec in range(0, RUN_LENGTH_SEC, COUPLING_INTERVAL):
A_SST.get(itap_sec, field_recv_A_SST) A_SST.get(itap_sec, field_recv_A_SST)
...@@ -152,10 +155,12 @@ if __name__ == '__main__': ...@@ -152,10 +155,12 @@ if __name__ == '__main__':
if CO2_EMODE: if CO2_EMODE:
A_CO2_emis.get(itap_sec, field_recv_A_CO2_emis) 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))) 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_land.get(itap_sec, field_recv_A_CO2_land) A_CO2_veg.get(itap_sec, field_recv_A_CO2_veg)
logging.debug('A_CO2_land -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_land), np.mean(field_recv_A_CO2_land), np.max(field_recv_A_CO2_land))) 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_ocean.get(itap_sec, field_recv_A_CO2_ocean) A_CO2_fire.get(itap_sec, field_recv_A_CO2_fire)
logging.debug('A_CO2_ocean -> {:.3e} {:.3e} {:.3e}'.format( np.min(field_recv_A_CO2_ocean), np.mean(field_recv_A_CO2_ocean), np.max(field_recv_A_CO2_ocean))) 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') logging.debug('--------------------------------------\n')
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
......
...@@ -13,18 +13,17 @@ gridname_ifs=L128 ...@@ -13,18 +13,17 @@ gridname_ifs=L128
griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids griddef_ifs=ICMGGa22e+000000 # copy from /gpfs/scratch/bsc32/bsc32051/pub/scripts/convert-tm5-grids
gridname_AMIP=AMIP 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_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-${grid_co2_emis}.txt
griddef_co2=grid-co2_emis.txt # cdo griddes > grid-co2_emis.txt
model_ifs=IFS_TOY model_ifs=IFS_TOY
vars_ifs="A_SST A_Ice_frac" vars_ifs="A_SST A_Ice_frac"
[ -f namelist.co2box ] && CO2BOX=true || CO2BOX=false [ -f namelist.co2box ] && CO2BOX=true || CO2BOX=false
[[ ${CO2_EMODE} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_land A_CO2_ocean" [[ ${CO2_EMODE} == true ]] && vars_ifs+=" A_CO2_emis A_CO2_veg A_CO2_fire A_CO2_oce"
vars_amip="AMIP_sst AMIP_sic" vars_amip="AMIP_sst AMIP_sic"
grids="AMIP L128" #B128 A128 R128 grids="AMIP L128 B128 A128 R128"
[[ ${CO2_EMODE} == true ]] && grids+=" CO2_emis" #[[ ${CO2_EMODE} == true ]] && grids+=" CO2_emis"
grids+=" ${grid_co2_emis}"
# copy from runtime dir the following files grids.nc areas.nc masks.nc # copy from runtime dir the following files grids.nc areas.nc masks.nc
for gridname in ${grids} for gridname in ${grids}
do do
...@@ -32,10 +31,14 @@ do ...@@ -32,10 +31,14 @@ do
format=nc format=nc
suffix=".nc" suffix=".nc"
griddef=${griddef_amip} griddef=${griddef_amip}
elif [[ ${gridname} == CO2_emis ]] ; then elif [[ ${gridname} == CEDS ]] ; then
format=nc
suffix=".nc"
griddef=grid-CEDS.txt
elif [[ ${gridname} == REG_1X1 ]] ; then
format=nc format=nc
suffix=".nc" suffix=".nc"
griddef=${griddef_co2} griddef=grid-REG_1X1.txt
else else
format=grb1 format=grb1
suffix=".grb" suffix=".grb"
......
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
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
#
# gridID 1
#
gridtype = lonlat
gridsize = 64800
datatype = float
xsize = 360
ysize = 180
xname = longitude
xlongname = "Longitude"
xunits = "degrees_east"
yname = latitude
ylongname = "Latitude"
yunits = "degrees_north"
xfirst = -179.5
xinc = 1
yfirst = -89.5
yinc = 1
...@@ -31,7 +31,7 @@ cat << EOF ...@@ -31,7 +31,7 @@ cat << EOF
SCRIPR CONSERV SCRIPR CONSERV
GAUSWGT LR SCALAR LATITUDE 1 9 2.0 GAUSWGT LR SCALAR LATITUDE 1 9 2.0
AMIP_CO2_land:AMIP_CO2_ocean A_CO2_land:A_CO2_ocean 1 86400 1 rstas.nc EXPOUT 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 CO2_emis B${ifs_grid} LAG=0
P 0 P 0 P 0 P 0
SCRIPR CONSERV SCRIPR CONSERV
......
...@@ -3,7 +3,7 @@ if [ ${CO2_CMODE} == true ] ; then ...@@ -3,7 +3,7 @@ if [ ${CO2_CMODE} == true ] ; then
nfields=$((nfields+1)) nfields=$((nfields+1))
fi fi
if [ ${CO2_EMODE} == true ] ; then if [ ${CO2_EMODE} == true ] ; then
nfields=$((nfields+2)) nfields=$((nfields+4))
fi fi
cat << EOF cat << EOF
# ================================================================================================= # =================================================================================================
...@@ -47,13 +47,25 @@ if [ ${CO2_EMODE} == true ] ; then ...@@ -47,13 +47,25 @@ if [ ${CO2_EMODE} == true ] ; then
cat << EOF cat << EOF
CO2BOX_CO2_emis A_CO2_emis 1 86400 1 rstas.nc EXPOUT CO2BOX_CO2_emis A_CO2_emis 1 86400 1 rstas.nc EXPOUT
CO2_emis B${ifs_grid} LAG=0 ${grid_co2_emis} B${ifs_grid} LAG=0
P 0 P 0 P 0 P 0
SCRIPR CONSERV SCRIPR CONSERV
GAUSWGT LR SCALAR LATITUDE 1 9 2.0 GAUSWGT LR SCALAR LATITUDE 1 9 2.0
CO2BOX_CO2_land:CO2BOX_CO2_ocean A_CO2_land:A_CO2_ocean 1 86400 1 rstas.nc EXPOUT CO2BOX_CO2_veg A_CO2_veg 1 86400 1 rstas.nc EXPOUT
CO2_emis B${ifs_grid} LAG=0 ${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 P 0 P 0
SCRIPR CONSERV SCRIPR CONSERV
GAUSWGT LR SCALAR LATITUDE 1 9 2.0 GAUSWGT LR SCALAR LATITUDE 1 9 2.0
......
...@@ -8,10 +8,12 @@ cat << EOF ...@@ -8,10 +8,12 @@ cat << EOF
StartMonth = ${leg_start_date_yyyymmdd:4:2} StartMonth = ${leg_start_date_yyyymmdd:4:2}
StartDay = ${leg_start_date_yyyymmdd:6:2} StartDay = ${leg_start_date_yyyymmdd:6:2}
FixYear = ${ifs_cmip_fixyear} FixYear = ${ifs_cmip_fixyear}
${sst_conf_var} ${sst_conf_var}
${sic_conf_var} ${sic_conf_var}
${co2_conf_var} ${co2_conf_var}
${oasis_conf_var} ${oasis_conf_var}
LDebug = false LDebug = false
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
/ /
......
...@@ -23,5 +23,7 @@ echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH ...@@ -23,5 +23,7 @@ echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH
#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true #bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true
#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true false #bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true false
bash ./run_example.sh co2box co2 4 2005-01-01 2005-05-01 0 128 true false #bash ./run_example.sh co2box co2 4 2005-01-01 2005-05-01 0 128 true false
#bash ./run_example.sh co2box co2 4 2014-01-01 2014-05-01 0 128 true false
bash ./run_example.sh co2box co2 4 2014-01-01 2014-02-01 0 128 true false
#bash ./run_example.sh fortran forcing 4 2005-01-01 2005-03-01 0 128 true false #bash ./run_example.sh fortran forcing 4 2005-01-01 2005-03-01 0 128 true false
...@@ -91,10 +91,11 @@ if [ $amip_mode = forcing ] || [ $amip_mode = co2 ] ; then ...@@ -91,10 +91,11 @@ if [ $amip_mode = forcing ] || [ $amip_mode = co2 ] ; then
ln -sf $datadir/forcing/tosbcs*.nc $rundir/. ln -sf $datadir/forcing/tosbcs*.nc $rundir/.
ln -sf $datadir/forcing/rmp_AMIP_to_L${ifs_grid}_GAUSWGT*.nc $rundir/. ln -sf $datadir/forcing/rmp_AMIP_to_L${ifs_grid}_GAUSWGT*.nc $rundir/.
if [ $amip_mode = co2 ]; then if [ $amip_mode = co2 ]; then
ln -sf $datadir/co2/CO2-em-anthro_*.nc $rundir/. for f in `ls $datadir/co2/*.nc*`
ln -sf $datadir/co2/CO2-em-AIR-anthro_*.nc $rundir/. do
ln -sf $datadir/co2/mole-fraction-of-carbon-dioxide-in-air_*.nc* $rundir/. ln -sf $f $rundir/.
ln -sf $datadir/co2/rmp_CO2_emis_to_B${ifs_grid}_GAUSWGT*.nc $rundir/. done
fi fi
else else
ln -sf $datadir/$amip_mode/HadI*.nc $rundir/. ln -sf $datadir/$amip_mode/HadI*.nc $rundir/.
...@@ -149,12 +150,16 @@ else ...@@ -149,12 +150,16 @@ else
#[ $model = co2box ] && mod=CO2BOX || mod=AMIP #[ $model = co2box ] && mod=CO2BOX || mod=AMIP
if [ $model = co2box ] ; then if [ $model = co2box ] ; then
mod=CO2BOX mod=CO2BOX
CO2_CMODE=true # set to false to disable co2 concentrations reading CO2_CMODE=false # set to false to disable co2 concentrations reading
CO2_EMODE=true # set to false to disable emissions 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 else
mod=AMIP mod=AMIP
CO2_CMODE=false # don't change this! CO2_CMODE=false # don't change this!
CO2_EMODE=true # don't change this! CO2_EMODE=true # don't change this!
CO2_FLUX_SOURCE="" # don't change this!
fi fi
#this fix is required to correctly read the co2 files which havereftime 0-1-1, which isn't supported by python netcdf4 #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 #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
...@@ -163,17 +168,47 @@ else ...@@ -163,17 +168,47 @@ else
if [ ${CO2_CMODE} == true ] ; then 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_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_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_em_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' 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 land/ocean fluxes equal to 0.5/0.1 that of emissions, for demonstration purposes # add veg/ocean fluxes equal to 0.5/0.1 that of emissions, for demonstration purposes
co2_conf_var+=${var}"("$((i++))",:) = 'CO2_land_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_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_ocean_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' 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 fi
if [ ${CO2_EMODE} == true ] ; then if [ ${CO2_EMODE} == true ] ; then
# this is the 3D monthly emissions used for ECE4, the calendar fix mentionned below is probably required if [ ${CO2_FLUX_SOURCE} == "CEDS" ] ; then
co2_conf_var+=${var}"("$((i++))",:) = 'CO2_em_monthly', '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' # this is the 3D monthly emissions from input4MIPS used for CMIP6, the calendar fix mentionned below is probably required
# add land/ocean fluxes equal to 0.5/0.1 that of emissions, for demonstration purposes grid_co2_emis="CEDS"
co2_conf_var+=${var}"("$((i++))",:) = 'CO2_land_monthly', 'CO2_emis', '"$mod"_CO2_land', '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' 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'
co2_conf_var+=${var}"("$((i++))",:) = 'CO2_ocean_monthly', 'CO2_emis', '"$mod"_CO2_ocean', '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' # 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}, 'co2_c_to_co2', 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}, 'co2_mol_to_kg', 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}, 'co2_mol_to_kg', 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}, 'co2_mol_to_kg', 0, , ,true,true,"$'\n'
else
echo "Unsupported CO2_FLUX_SOURCE ${CO2_FLUX_SOURCE}"
exit 1
fi
fi fi
#OasisOutputVars(i,:) = <id> <grid_name> <timestep> <scale_factor> <offset> <reset> #OasisOutputVars(i,:) = <id> <grid_name> <timestep> <scale_factor> <offset> <reset>
if [ ${CO2_CMODE} == true ] ; then if [ ${CO2_CMODE} == true ] ; then
...@@ -181,10 +216,10 @@ else ...@@ -181,10 +216,10 @@ else
oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_econc', 'GLOBAL', 'daily', 'co2_mass_to_ppm', 0, false," oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_econc', 'GLOBAL', 'daily', 'co2_mass_to_ppm', 0, false,"
fi fi
if [ ${CO2_EMODE} == true ] ; then if [ ${CO2_EMODE} == true ] ; then
# this is the 3D monthly emissions used for ECE4 oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_emis', '${grid_co2_emis}', 'daily', 1, 0, true,"
oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_emis', '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_land', 'CO2_emis', '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_ocean', 'CO2_emis', 'daily', 1, 0, true," oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_oce', '${grid_co2_oce}', 'daily', 1, 0, true,"
fi fi
else else
co2_conf_var="" co2_conf_var=""
......