From c3c8210ab986d937443056d360dd687bc2d58d15 Mon Sep 17 00:00:00 2001 From: yanchunhe Date: Tue, 24 Sep 2019 15:20:42 +0200 Subject: [PATCH] Add CMIP6_Oday table for bgc --- namelists/var_CMIP6_NorESM2_default.nml | 9 ++++ source/m_modelsocn.F | 64 +++++++++++++++++++++++++ source/m_namelists.F | 46 ++++++++++++++---- 3 files changed, 111 insertions(+), 8 deletions(-) diff --git a/namelists/var_CMIP6_NorESM2_default.nml b/namelists/var_CMIP6_NorESM2_default.nml index ffe5ba47..17fbf911 100644 --- a/namelists/var_CMIP6_NorESM2_default.nml +++ b/namelists/var_CMIP6_NorESM2_default.nml @@ -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', diff --git a/source/m_modelsocn.F b/source/m_modelsocn.F index ac91a551..be3c9526 100644 --- a/source/m_modelsocn.F +++ b/source/m_modelsocn.F @@ -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 diff --git a/source/m_namelists.F b/source/m_namelists.F index 08fe1fe1..9d937af2 100644 --- a/source/m_namelists.F +++ b/source/m_namelists.F @@ -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, @@ -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 @@ -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 @@ -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 @@ -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. @@ -476,6 +486,7 @@ SUBROUTINE read_namelists dEyr = .FALSE. dOclim = .FALSE. dOday = .FALSE. + dOdaybgc = .FALSE. dOdec = .FALSE. dCOfx = .FALSE. dSIday = .FALSE. @@ -520,6 +531,7 @@ SUBROUTINE read_namelists vEyr = ' ' vOclim = ' ' vOday = ' ' + vOdaybgc = ' ' vOdec = ' ' vCOfx = ' ' vSIday = ' ' @@ -564,6 +576,7 @@ SUBROUTINE read_namelists pEyr = ' ' pOclim = ' ' pOday = ' ' + pOdaybgc = ' ' pOdec = ' ' pCOfx = ' ' pSIday = ' ' @@ -607,6 +620,7 @@ SUBROUTINE read_namelists rEyr = 1000000 rOclim = 1000000 rOday = 1000000 + rOdaybgc = 1000000 rOdec = 1000000 rCOfx = 1000000 rSIday = 1000000 @@ -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' @@ -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(*,*) @@ -1041,6 +1060,7 @@ SUBROUTINE read_namelists nEyr = 0 nOclim = 0 nOday = 0 + nOdaybgc = 0 nOdec = 0 nCOfx = 0 nSIday = 0 @@ -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 @@ -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' @@ -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 @@ -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:'