191 subroutine gas_init( me, co2usr_file, co2cyc_file, ico2flg, &
192 & ictmflg, con_pi, errflg, errmsg)
234 integer,
intent(in) :: me, ictmflg, ico2flg
235 character(len=26),
intent(in) :: co2usr_file,co2cyc_file
236 real(kind=kind_phys),
intent(in) :: con_pi
239 character(len=*),
intent(out) :: errmsg
240 integer,
intent(out) :: errflg
243 real (kind=kind_phys),
dimension(IMXCO2,JMXCO2) :: co2dat
244 real (kind=kind_phys) :: co2g1, co2g2
246 integer :: i, j, k, iyr, imo
247 logical :: file_exist, lextpl
248 character :: cline*100, cform*8
249 data cform /
'(24f7.2)' /
262 if ( me == 0 ) print *, vtaggas
271 lab_ico2 :
if ( ico2flg == 0 )
then
274 print *,
' - Using prescribed co2 global mean value=', &
280 lab_ictm :
if ( ictmflg == -1 )
then
282 inquire (file=co2usr_file, exist=file_exist)
283 if ( .not. file_exist )
then
285 errmsg =
'ERROR(gas_init): Cannot find user CO2 data file'//&
290 open(nico2cn,file=co2usr_file,form=
'formatted',status=
'old')
292 read (nico2cn, 25) iyr, cline, co2g1, co2g2
293 25
format(i4,a94,f7.2,16x,f5.2)
296 if ( ico2flg == 1 )
then
298 print *,
' - Using co2 global annual mean value from', &
299 &
' user provided data set:',co2usr_file
300 print *, iyr,cline(1:94),co2g1,
' GROWTH RATE =', co2g2
302 elseif ( ico2flg == 2 )
then
306 read (nico2cn,cform) co2dat
317 print *,
' - Using co2 monthly 2-d data from user', &
318 &
' provided data set:',co2usr_file
319 print *, iyr,cline(1:94),co2g1,
' GROWTH RATE =', co2g2
321 print *,
' CHECK: Sample of selected months of CO2 data'
323 print *,
' Month =',imo
328 print *,
' ICO2=',ico2flg,
' is not a valid selection'
330 errmsg =
'ERROR(gas_init): ICO2 is not a valid selection'
339 if ( ico2flg == 1 )
then
341 print *,
' - Using observed co2 global annual mean value'
343 elseif ( ico2flg == 2 )
then
347 print *,
' - Using observed co2 monthly 2-d data'
350 print *,
' ICO2=',ico2flg,
' is not a valid selection'
352 errmsg =
'ERROR(gas_init): ICO2 is not a valid selection'
356 if ( ictmflg == -2 )
then
357 inquire (file=co2cyc_file, exist=file_exist)
358 if ( .not. file_exist )
then
360 errmsg =
'ERROR(gas_init): Cannot find seasonal cycle '// &
361 &
'CO2 data file: '//co2cyc_file
368 open (nico2cn,file=co2cyc_file,form=
'formatted', &
371 read (nico2cn, 35) cline, co2g1, co2g2
372 35
format(a98,f7.2,16x,f5.2)
373 read (nico2cn,cform) co2dat
376 print *,
' - Superimpose seasonal cycle to mean CO2 data'
377 print *,
' Opened CO2 climatology seasonal cycle data',&
378 &
' file: ',co2cyc_file
383 read (nico2cn,45) cline,
gco2cyc(imo)
388 read (nico2cn,cform) co2dat
425 & me, co2dat_file, co2gbl_file, ictmflg, ico2flg, &
480 integer,
intent(in) :: iyear,imon,iday,ihour,me,ictmflg,ico2flg
481 character(len=26),
intent(in) :: co2dat_file, co2gbl_file
482 logical,
intent(in) :: ldoco2
485 character(len=*),
intent(out) :: errmsg
486 integer,
intent(out) :: errflg
489 real (kind=kind_phys),
dimension(IMXCO2,JMXCO2) :: co2dat, co2ann
490 real (kind=kind_phys) :: co2g1, co2g2, rate
492 integer :: i, id, j, l, iyr, imo, iyr1, iyr2, jyr, idyr
493 integer,
save :: mdays(13), midmon=15, midm=15, midp=45
495 data mdays / 31,28,31,30,31,30,31,31,30,31,30,31,30 /
497 logical :: file_exist, lextpl, change
498 character :: cline*100, cform*8, cfile1*26
499 data cform /
'(24f7.2)' /
509 if ( ico2flg == 0 )
return
510 if ( ictmflg ==-1 )
return
511 if ( .not. ldoco2 )
return
513 if ( ictmflg < 0 )
then
517 lextpl = ( mod(ictmflg,10) == 1 )
519 if ( idyr == 0 ) idyr = iyear
525 if (
kyrsav == iyear )
return
533 lab_if_idyr :
if ( idyr <
minyear .and. ictmflg > 0 )
then
536 print *,
' Requested CO2 data year',iyear,
' earlier than', &
538 print *,
' Which is the earliest monthly observation', &
540 print *,
' Thus, historical global mean data is used'
545 inquire (file=co2gbl_file, exist=file_exist)
546 if ( .not. file_exist )
then
548 errmsg =
'ERROR(gas_update): Requested co2 data file not '// &
549 &
'found: '//co2gbl_file
553 open (nico2cn,file=co2gbl_file,form=
'formatted',status=
'old')
556 read (nico2cn, 24) iyr1, iyr2, cline
557 24
format(i4,4x,i4,a48)
560 print *,
' Opened co2 data file: ',co2gbl_file
564 if ( idyr < iyr1 )
then
572 lab_dowhile1 :
do while ( i >= iyr1 )
575 read (nico2cn, *) jyr, co2g1, co2g2
577 if ( i == iyr .and. iyr == jyr )
then
578 co2_glb = (co2g1+co2g2) * 0.5e-6
579 if ( ico2flg == 2 )
then
588 if ( me == 0 ) print *,
' Co2 data for year',iyear, &
605 write(cfile1(19:22),34) idyr
610 inquire (file=cfile1, exist=file_exist)
611 if ( .not. file_exist )
then
613 lab_if_ictm :
if ( ictmflg > 10 )
then
615 print *,
' Specified co2 data for year',idyr, &
616 &
' not found !! Need to change namelist ICTM !!'
619 errmsg =
'ERROR(gas_update): Specified co2 data for year '//&
624 print *,
' Requested co2 data for year',idyr, &
625 &
' not found, check for other available data set'
628 lab_dowhile2 :
do while ( iyr >=
minyear )
630 write(cfile1(19:22),34) iyr
632 inquire (file=cfile1, exist=file_exist)
634 print *,
' Looking for CO2 file ',cfile1
637 if ( file_exist )
then
642 if ( .not. file_exist )
then
644 errmsg =
'ERROR(gas_update): Cannot find co2 data '// &
645 &
'source file: '//co2dat_file
654 open (nico2cn,file=cfile1,form=
'formatted',status=
'old')
656 read (nico2cn, 36) iyr, cline, co2g1, co2g2
657 36
format(i4,a94,f7.2,16x,f5.2)
660 print *,
' Opened co2 data file: ',cfile1
661 print *, iyr, cline(1:94), co2g1,
' GROWTH RATE =', co2g2
668 rate = 2.00 * (iyear - iyr)
673 co2_glb = (co2g1 + rate) * 1.0e-6
675 print *,
' Global annual mean CO2 data for year', &
679 if ( ictmflg == -2 )
then
681 if ( ico2flg == 1 )
then
683 print *,
' CHECK: Monthly deviations of climatology ', &
684 &
'to be superimposed on global annual mean'
687 elseif ( ico2flg == 2 )
then
691 read (nico2cn,cform) co2dat
696 co2ann(i,j) = co2ann(i,j) + co2dat(i,j)
703 co2ann(i,j) = co2ann(i,j) * 1.0e-6 / float(12)
716 print *,
' CHECK: Sample of 2-d annual mean of CO2 ', &
717 &
'data used for year:',iyear
719 print *,
' CHECK: AFTER adding seasonal cycle, Sample ', &
720 &
'of selected months of CO2 data for year:',iyear
722 print *,
' Month =',imo
730 if ( ico2flg == 2 )
then
732 read (nico2cn,cform) co2dat
737 co2vmr_sav(i,j,imo) = (co2dat(i,j) + rate) * 1.0e-6
743 print *,
' CHECK: Sample of selected months of CO2 ', &
744 &
'data used for year:',iyear
746 print *,
' Month =',imo
subroutine, public getgases(plvl, xlon, xlat, imax, lmax, ico2flg, top_at_1, con_pi, gasdat)
This subroutine sets up global distribution of radiation absorbing gases in volume mixing ratio....
subroutine, public gas_update(iyear, imon, iday, ihour, ldoco2, me, co2dat_file, co2gbl_file, ictmflg, ico2flg, errflg, errmsg)
This subroutine reads in 2-d monthly co2 data set for a specified year. Data are in a 15 degree lat/l...