Skip to content

Commit

Permalink
Add CMIP6_Oday table for bgc
Browse files Browse the repository at this point in the history
  • Loading branch information
YanchunHe committed Sep 24, 2019
1 parent ca5b932 commit c3c8210
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 8 deletions.
9 changes: 9 additions & 0 deletions namelists/var_CMIP6_NorESM2_default.nml
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,15 @@
!====todo list====
/

&table_Odaybgc
dOdaybgc = .true.
tOdaybgc = 'CMIP6_Oday.json',
rOdaybgc = 1000000,
vOdaybgc =
'chlos ','srfphyc ','mol P m-3 -> kg Chl m-3',
'phycos ','srfphyc ','mol m-3 ',
/

&table_3hr
d3hr = .true.
t3hr = 'CMIP6_3hr.json',
Expand Down
64 changes: 64 additions & 0 deletions source/m_modelsocn.F
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,70 @@ SUBROUTINE ocn2cmor
IF (MOD(m,rOday).GT.0) CALL close_ofile
c
ENDDO

c --- Process table Odaybgc
WRITE(*,*) 'Process table Odaybgc'
fnm=pOdaybgc
table=tOdaybgc
DO n=1,nOdaybgc
IF (skip_variable(n,nOdaybgc,dOdaybgc)) CYCLE
c
c --- - Map namelist variables
ovnm=vOdaybgc(ovnmpos,n)
ivnm=vOdaybgc(ivnmpos,n)
special=vOdaybgc(3,n)
vunits=' '
vpositive=' '
vcomment=' '
c
c --- - Check if vertical coordinate required
CALL get_vertcoord(TRIM(tabledir)//TRIM(table),ovnm,zcoord)
c
c --- - Choose history file
itag=tagodaybgc
c
c --- - Check if input variable is present
IF (LEN_TRIM(pOdaybgc).eq.0) CALL scan_files(reset=.TRUE.)
IF (.NOT.var_in_file(fnm,ivnm)) CYCLE
c
c --- - Prepare output file
CALL special_pre
c --- - Loop over input files
m=0
DO
m=m+1
c
c --- --- Open output file
IF (MOD(m-1,rOdaybgc).EQ.0) CALL open_ofile
c
c --- --- Read variable into buffer
rec=0
IF (LEN_TRIM(pOdaybgc).eq.0) CALL scan_files(reset=.false.)
IF (rec.EQ.0) EXIT
tbnds(1,1)=tval(1)-0.5
tbnds(2,1)=tval(1)+0.5
tval=0.5*(tbnds(1,1)+tbnds(2,1))
c
c --- --- Read data
CALL read_tslice(rec,badrec,fnm)
c
c --- --- Post processing
CALL special_post
c
c --- --- Write time slice to output file
IF (badrec) fld=1e20
CALL write_tslice
c
c --- --- Close output file if max rec has been reached
IF (MOD(m,rOdaybgc).EQ.0) CALL close_ofile
c
c --- - End loop over files and records
ENDDO
c
c --- - Close output file if still open
IF (MOD(m,rOdaybgc).GT.0) CALL close_ofile
c
ENDDO
#endif
c
c exception for fill day
Expand Down
46 changes: 38 additions & 8 deletions source/m_namelists.F
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ MODULE m_namelists
LOGICAL, SAVE :: do_ofx,do_6hrPlevPt,do_AERday,do_AERhr,
. do_AERmonZ,do_CF3hr,do_CFday,do_CFmon,do_CFsubhr,do_E1hrClimMon,
. do_E1hr,do_E3hr,do_CE3hrPt,do_E6hrZ,do_Eday,do_EdayZ,do_Efx,
. do_Emon,do_EmonZ,do_Esubhr,do_Eyr,do_Oclim,do_Oday,do_Odec,
. do_COfx,do_SIday
. do_Emon,do_EmonZ,do_Esubhr,do_Eyr,do_Oclim,do_Oday,do_Odaybgc,
. do_Odec,do_COfx,do_SIday
CHARACTER(LEN=slenmax), SAVE ::
. activity_id,parent_variant_label,parent_mip_era,mip_era,
. sub_experiment,parent_sub_experiment,parent_activity_id,
Expand Down Expand Up @@ -192,6 +192,7 @@ MODULE m_namelists
. do_Eyr, ! hidden
. do_Oclim, ! hidden
. do_Oday, ! hidden
. do_Odaybgc, ! hidden
. do_Odec, ! hidden
. do_COfx, ! hidden
. do_SIday, ! hidden
Expand Down Expand Up @@ -247,27 +248,33 @@ MODULE m_namelists
LOGICAL, SAVE ::
. dofx,d6hrPlevPt,dAERday,dAERhr,dAERmonZ,dCF3hr,dCFday,dCFmon,
. dCFsubhr,dE1hrClimMon,dE1hr,dE3hr,dCE3hrPt,dE6hrZ,dEday,dEdayZ,
. dEfx,dEmon,dEmonZ,dEsubhr,dEyr,dOclim,dOday,dOdec,dCOfx,dSIday
. dEfx,dEmon,dEmonZ,dEsubhr,dEyr,dOclim,dOday,dOdaybgc,dOdec,
. dCOfx,dSIday
CHARACTER(len=lenmax),DIMENSION(colmax,rowmax), SAVE ::
. vofx,v6hrPlevPt,vAERday,vAERhr,vAERmonZ,vCF3hr,vCFday,vCFmon,
. vCFsubhr,vE1hrClimMon,vE1hr,vE3hr,vCE3hrPt,vE6hrZ,vEday,vEdayZ,
. vEfx,vEmon,vEmonZ,vEsubhr,vEyr,vOclim,vOday,vOdec,vCOfx,vSIday
. vEfx,vEmon,vEmonZ,vEsubhr,vEyr,vOclim,vOday,vOdaybgc,vOdec,
. vCOfx,vSIday
CHARACTER(len=slenmax), SAVE ::
. pofx,p6hrPlevPt,pAERday,pAERhr,pAERmonZ,pCF3hr,pCFday,pCFmon,
. pCFsubhr,pE1hrClimMon,pE1hr,pE3hr,pCE3hrPt,pE6hrZ,pEday,pEdayZ,
. pEfx,pEmon,pEmonZ,pEsubhr,pEyr,pOclim,pOday,pOdec,pCOfx,pSIday
. pEfx,pEmon,pEmonZ,pEsubhr,pEyr,pOclim,pOday,pOdaybgc,pOdec,
. pCOfx,pSIday
CHARACTER(len=slenmax), SAVE ::
. tofx,t6hrPlevPt,tAERday,tAERhr,tAERmonZ,tCF3hr,tCFday,tCFmon,
. tCFsubhr,tE1hrClimMon,tE1hr,tE3hr,tCE3hrPt,tE6hrZ,tEday,tEdayZ,
. tEfx,tEmon,tEmonZ,tEsubhr,tEyr,tOclim,tOday,tOdec,tCOfx,tSIday
. tEfx,tEmon,tEmonZ,tEsubhr,tEyr,tOclim,tOday,tOdaybgc,tOdec,
. tCOfx,tSIday
INTEGER, SAVE ::
. nofx,n6hrPlevPt,nAERday,nAERhr,nAERmonZ,nCF3hr,nCFday,nCFmon,
. nCFsubhr,nE1hrClimMon,nE1hr,nE3hr,nCE3hrPt,nE6hrZ,nEday,nEdayZ,
. nEfx,nEmon,nEmonZ,nEsubhr,nEyr,nOclim,nOday,nOdec,nCOfx,nSIday
. nEfx,nEmon,nEmonZ,nEsubhr,nEyr,nOclim,nOday,nOdaybgc,nOdec,
. nCOfx,nSIday
INTEGER, SAVE ::
. rofx,r6hrPlevPt,rAERday,rAERhr,rAERmonZ,rCF3hr,rCFday,rCFmon,
. rCFsubhr,rE1hrClimMon,rE1hr,rE3hr,rCE3hrPt,rE6hrZ,rEday,rEdayZ,
. rEfx,rEmon,rEmonZ,rEsubhr,rEyr,rOclim,rOday,rOdec,rCOfx,rSIday
. rEfx,rEmon,rEmonZ,rEsubhr,rEyr,rOclim,rOday,rOdaybgc,rOdec,
. rCOfx,rSIday
NAMELIST /table_ofx/ dofx,pofx,tofx,vofx
NAMELIST /table_6hrPlevPt/ d6hrPlevPt,p6hrPlevPt,t6hrPlevPt,
. v6hrPlevPt
Expand All @@ -293,6 +300,8 @@ MODULE m_namelists
NAMELIST /table_Eyr/ dEyr,pEyr,tEyr,vEyr
NAMELIST /table_Oclim/ dOclim,pOclim,tOclim,vOclim
NAMELIST /table_Oday/ dOday,pOday,tOday,rOday,vOday
NAMELIST /table_Odaybgc/ dOdaybgc,pOdaybgc,tOdaybgc,rOdaybgc,
. vOdaybgc
NAMELIST /table_Odec/ dOdec,pOdec,tOdec,vOdec
NAMELIST /table_COfx/ dCOfx,pCOfx,tCOfx,vCOfx
NAMELIST /table_SIday/ dSIday,pSIday,tSIday,rSIday,vSIday
Expand Down Expand Up @@ -407,6 +416,7 @@ SUBROUTINE read_namelists
do_Eyr = .TRUE.
do_Oclim = .TRUE.
do_Oday = .TRUE.
do_Odaybgc = .TRUE.
do_Odec = .TRUE.
do_COfx = .TRUE.
do_SIday = .TRUE.
Expand Down Expand Up @@ -476,6 +486,7 @@ SUBROUTINE read_namelists
dEyr = .FALSE.
dOclim = .FALSE.
dOday = .FALSE.
dOdaybgc = .FALSE.
dOdec = .FALSE.
dCOfx = .FALSE.
dSIday = .FALSE.
Expand Down Expand Up @@ -520,6 +531,7 @@ SUBROUTINE read_namelists
vEyr = ' '
vOclim = ' '
vOday = ' '
vOdaybgc = ' '
vOdec = ' '
vCOfx = ' '
vSIday = ' '
Expand Down Expand Up @@ -564,6 +576,7 @@ SUBROUTINE read_namelists
pEyr = ' '
pOclim = ' '
pOday = ' '
pOdaybgc = ' '
pOdec = ' '
pCOfx = ' '
pSIday = ' '
Expand Down Expand Up @@ -607,6 +620,7 @@ SUBROUTINE read_namelists
rEyr = 1000000
rOclim = 1000000
rOday = 1000000
rOdaybgc = 1000000
rOdec = 1000000
rCOfx = 1000000
rSIday = 1000000
Expand Down Expand Up @@ -670,6 +684,7 @@ SUBROUTINE read_namelists
tEyr = 'CMIP6_Eyr.json'
tOclim = 'CMIP6_Oclim.json'
tOday = 'CMIP6_Oday.json'
tOdaybgc = 'CMIP6_Oday.json'
tOdec = 'CMIP6_Odec.json'
tCOfx = 'CMIP6_COfx.json'
tSIday = 'CMIP6_SIday.json'
Expand Down Expand Up @@ -929,6 +944,10 @@ SUBROUTINE read_namelists
REWIND(funit)
IF (istatus.NE.0) WRITE(*,*)
. 'WARNING: Table Oday not in namelist file. Skipping table...'
READ(funit,nml=table_Odaybgc,IOSTAT=istatus)
REWIND(funit)
IF (istatus.NE.0) WRITE(*,*)
. 'WARNING: Table Odaybgc not in namelist file. Skipping table...'
READ(funit,nml=table_Odec,IOSTAT=istatus)
REWIND(funit)
IF (istatus.NE.0) WRITE(*,*)
Expand Down Expand Up @@ -1041,6 +1060,7 @@ SUBROUTINE read_namelists
nEyr = 0
nOclim = 0
nOday = 0
nOdaybgc = 0
nOdec = 0
nCOfx = 0
nSIday = 0
Expand Down Expand Up @@ -1068,6 +1088,7 @@ SUBROUTINE read_namelists
IF (LEN_TRIM(vEyr(1,n)).ne.0) nEyr=nEyr+1
IF (LEN_TRIM(vOclim(1,n)).ne.0) nOclim=nOclim+1
IF (LEN_TRIM(vOday(1,n)).ne.0) nOday=nOday+1
IF (LEN_TRIM(vOdaybgc(1,n)).ne.0) nOdaybgc=nOdaybgc+1
IF (LEN_TRIM(vOdec(1,n)).ne.0) nOdec=nOdec+1
IF (LEN_TRIM(vCOfx(1,n)).ne.0) nCOfx=nCOfx+1
IF (LEN_TRIM(vSIday(1,n)).ne.0) nSIday=nSIday+1
Expand Down Expand Up @@ -1104,6 +1125,8 @@ SUBROUTINE read_namelists
IF (TRIM(vsingle).NE.TRIM(vEyr(po,n))) vEyr(pi,n)='SKIP'
IF (TRIM(vsingle).NE.TRIM(vOclim(po,n))) vOclim(pi,n)='SKIP'
IF (TRIM(vsingle).NE.TRIM(vOday(po,n))) vOday(pi,n)='SKIP'
IF (TRIM(vsingle).NE.TRIM(vOdaybgc(po,n)))
. vOdaybgc(pi,n)='SKIP'
IF (TRIM(vsingle).NE.TRIM(vOdec(po,n))) vOdec(pi,n)='SKIP'
IF (TRIM(vsingle).NE.TRIM(vCOfx(po,n))) vCOfx(pi,n)='SKIP'
IF (TRIM(vsingle).NE.TRIM(vSIday(po,n))) vSIday(pi,n)='SKIP'
Expand Down Expand Up @@ -1151,6 +1174,7 @@ SUBROUTINE read_namelists
if (.not.do_Eyr) nEyr=0
if (.not.do_Oclim) nOclim=0
if (.not.do_Oday) nOday=0
if (.not.do_Odaybgc) nOdaybgc=0
if (.not.do_Odec) nOdec=0
if (.not.do_COfx) nCOfx=0
if (.not.do_SIday) nSIday=0
Expand Down Expand Up @@ -1473,6 +1497,12 @@ SUBROUTINE print_namelists
DO n=1,nOday
WRITE(*,'(1X,A20,A20,A20)') vOday(:,n)
ENDDO
c
WRITE(*,*)
WRITE(*,*) 'Table Odaybgc:'
DO n=1,nOdaybgc
WRITE(*,'(1X,A20,A20,A20)') vOdaybgc(:,n)
ENDDO
c
WRITE(*,*)
WRITE(*,*) 'Table Odec:'
Expand Down

0 comments on commit c3c8210

Please sign in to comment.