Skip to content

Commit

Permalink
Add lon,lat info in iHAMOCC output to more comply to cdo commands (#355)
Browse files Browse the repository at this point in the history
* Write plon, plat info to BGC output to become more cdo compliant
  • Loading branch information
jmaerz authored Jun 19, 2024
1 parent d3ec954 commit f3fd2c3
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions hamocc/mo_ncout_hamocc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ 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
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, &
Expand Down Expand Up @@ -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./

Expand Down Expand Up @@ -294,6 +295,14 @@ 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 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 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
call finlyr(jphyto(iogrp),jdp(iogrp))
Expand Down Expand Up @@ -1346,6 +1355,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,0)
else
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,0)
else
call ncdefvar('plat','x y',ndouble,0)
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', &
Expand Down

0 comments on commit f3fd2c3

Please sign in to comment.