Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lon,lat info in iHAMOCC output to more comply to cdo commands #355

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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