From bccd7b32e8f19dcb08ee5b1a98b136c359848b81 Mon Sep 17 00:00:00 2001 From: joeran maerz Date: Wed, 12 Jun 2024 14:55:17 +0200 Subject: [PATCH 1/2] Write plon, plat info to BGC output to become more cdo compliant --- hamocc/mo_ncout_hamocc.F90 | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/hamocc/mo_ncout_hamocc.F90 b/hamocc/mo_ncout_hamocc.F90 index 98073b3c..38e42ce1 100644 --- a/hamocc/mo_ncout_hamocc.F90 +++ b/hamocc/mo_ncout_hamocc.F90 @@ -31,8 +31,8 @@ subroutine ncwrt_bgc(iogrp) ! ********************************************************************************************** use mod_time, only: date0,date,calendar,nstep,nstep_in_day,nday_of_year,time0,time - use mod_xc, only: kdm,mnproc,itdm,jtdm,lp - use mod_grid, only: depths + use mod_xc, only: kdm,mnproc,itdm,jtdm,lp,idm,jdm,nbdy + use mod_grid, only: depths,plat,plon use mod_dia, only: diafnm,sigmar1,iotype,ddm,depthslev,depthslev_bnds use mo_control_bgc, only: dtbgc,use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO, & use_sedbypass,use_BOXATM,use_M4AGO,use_extNcycle @@ -294,6 +294,13 @@ subroutine ncwrt_bgc(iogrp) call ncwrt1('sigma','sigma',sigmar1) call ncwrt1('depth','depth',depthslev) call ncwrt1('depth_bnds','bounds depth',depthslev_bnds) + if (cmpflg.ne.0) then + call ncwrt1('plon','pcomp',plon(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy)) + call ncwrt1('plat','pcomp',plat(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy)) + else + call ncwrt1('plon','x y',plon(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy)) + call ncwrt1('plat','x y',plat(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy)) + endif ! --- finalize accumulation call finlyr(jphyto(iogrp),jdp(iogrp)) @@ -1346,6 +1353,22 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncattr('positive','down') call ncattr('bounds','depth_bnds') call ncdefvar('depth_bnds','bounds depth',ndouble,8) + + if (cmpflg == 1) then + call ncdefvar('plon','pcomp',ndouble,8) + else + call ncdefvar('plon','x y',ndouble,8) + endif + call ncattr('long_name','longitude') + call ncattr('units','degrees_east') + if (cmpflg == 1) then + call ncdefvar('plat','pcomp',ndouble,8) + else + call ncdefvar('plat','x y',ndouble,8) + endif + call ncattr('long_name','latitude') + call ncattr('units','degrees_north') + call ncdefvar3d(SRF_KWCO2(iogrp),cmpflg,'p', & & 'kwco2','CO2 piston velocity',' ','m s-1',0) call ncdefvar3d(SRF_KWCO2KHM(iogrp),cmpflg,'p', & From 67466c6c65427cf822592f5a1175578d97891c03 Mon Sep 17 00:00:00 2001 From: joeran maerz Date: Wed, 12 Jun 2024 16:30:18 +0200 Subject: [PATCH 2/2] Write plon, plat info to BGC output to become more cdo compliant --- hamocc/mo_ncout_hamocc.F90 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/hamocc/mo_ncout_hamocc.F90 b/hamocc/mo_ncout_hamocc.F90 index 38e42ce1..4e794472 100644 --- a/hamocc/mo_ncout_hamocc.F90 +++ b/hamocc/mo_ncout_hamocc.F90 @@ -38,7 +38,7 @@ subroutine ncwrt_bgc(iogrp) use_sedbypass,use_BOXATM,use_M4AGO,use_extNcycle use mo_vgrid, only: k0100,k0500,k1000,k2000,k4000 use mo_param1_bgc, only: ks - use mod_nctools, only: ncwrt1,ncdims,nctime,ncfcls,ncfopn,ncdimc,ncputr,ncputi + use mod_nctools, only: ncwrt1,ncdims,nctime,ncfcls,ncfopn,ncdimc,ncputr,ncputi,ncwrtr use mo_bgcmean, only: domassfluxes,flx_ndepnoy,flx_oalk, & flx_cal0100,flx_cal0500,flx_cal1000, & flx_cal2000,flx_cal4000,flx_cal_bot, & @@ -221,6 +221,7 @@ subroutine ncwrt_bgc(iogrp) character(len=20) :: startdate character(len=30) :: timeunits real :: datenum,rnacc + integer,dimension(2,2) :: dummy data append2file /nbgcmax*.false./ @@ -294,12 +295,13 @@ subroutine ncwrt_bgc(iogrp) call ncwrt1('sigma','sigma',sigmar1) call ncwrt1('depth','depth',depthslev) call ncwrt1('depth_bnds','bounds depth',depthslev_bnds) + dummy = 0 if (cmpflg.ne.0) then - call ncwrt1('plon','pcomp',plon(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy)) - call ncwrt1('plat','pcomp',plat(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy)) + call ncwrtr('plon','pcomp',plon(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),dummy,0,1.,0.,8) + call ncwrtr('plat','pcomp',plat(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),dummy,0,1.,0.,8) else - call ncwrt1('plon','x y',plon(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy)) - call ncwrt1('plat','x y',plat(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy)) + call ncwrtr('plon','x y',plon(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),dummy,0,1.,0.,8) + call ncwrtr('plat','x y',plat(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),dummy,0,1.,0.,8) endif ! --- finalize accumulation @@ -1355,16 +1357,16 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg) call ncdefvar('depth_bnds','bounds depth',ndouble,8) if (cmpflg == 1) then - call ncdefvar('plon','pcomp',ndouble,8) + call ncdefvar('plon','pcomp',ndouble,0) else - call ncdefvar('plon','x y',ndouble,8) + call ncdefvar('plon','x y',ndouble,0) endif call ncattr('long_name','longitude') call ncattr('units','degrees_east') if (cmpflg == 1) then - call ncdefvar('plat','pcomp',ndouble,8) + call ncdefvar('plat','pcomp',ndouble,0) else - call ncdefvar('plat','x y',ndouble,8) + call ncdefvar('plat','x y',ndouble,0) endif call ncattr('long_name','latitude') call ncattr('units','degrees_north')