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
284 print *,
' Can not find user CO2 data file: ',co2usr_file
286 errmsg =
'ERROR(gas_init): Can not 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 valid'
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 valid'
356 if ( ictmflg == -2 )
then
357 inquire (file=co2cyc_file, exist=file_exist)
358 if ( .not. file_exist )
then
360 print *,
' Can not find seasonal cycle CO2 data: ', &
364 errmsg =
'ERROR(gas_init): Can not find seasonal cycle '//&
372 open (nico2cn,file=co2cyc_file,form=
'formatted', &
375 read (nico2cn, 35) cline, co2g1, co2g2
376 35
format(a98,f7.2,16x,f5.2)
377 read (nico2cn,cform) co2dat
380 print *,
' - Superimpose seasonal cycle to mean CO2 data'
381 print *,
' Opened CO2 climatology seasonal cycle data',&
382 &
' file: ',co2cyc_file
387 read (nico2cn,45) cline,
gco2cyc(imo)
392 read (nico2cn,cform) co2dat
431 & me, co2dat_file, co2gbl_file, ictmflg, ico2flg, &
486 integer,
intent(in) :: iyear,imon,iday,ihour,me,ictmflg,ico2flg
487 character(len=26),
intent(in) :: co2dat_file, co2gbl_file
488 logical,
intent(in) :: ldoco2
491 character(len=*),
intent(out) :: errmsg
492 integer,
intent(out) :: errflg
495 real (kind=kind_phys),
dimension(IMXCO2,JMXCO2) :: co2dat, co2ann
496 real (kind=kind_phys) :: co2g1, co2g2, rate
498 integer :: i, id, j, l, iyr, imo, iyr1, iyr2, jyr, idyr
499 integer,
save :: mdays(13), midmon=15, midm=15, midp=45
501 data mdays / 31,28,31,30,31,30,31,31,30,31,30,31,30 /
503 logical :: file_exist, lextpl, change
504 character :: cline*100, cform*8, cfile1*26
505 data cform /
'(24f7.2)' /
515 if ( ico2flg == 0 )
return
516 if ( ictmflg ==-1 )
return
517 if ( .not. ldoco2 )
return
519 if ( ictmflg < 0 )
then
523 lextpl = ( mod(ictmflg,10) == 1 )
525 if ( idyr == 0 ) idyr = iyear
531 if (
kyrsav == iyear )
return
539 lab_if_idyr :
if ( idyr <
minyear .and. ictmflg > 0 )
then
542 print *,
' Requested CO2 data year',iyear,
' earlier than', &
544 print *,
' Which is the earliest monthly observation', &
546 print *,
' Thus, historical global mean data is used'
551 inquire (file=co2gbl_file, exist=file_exist)
552 if ( .not. file_exist )
then
553 print *,
' Requested co2 data file "',co2gbl_file, &
556 errmsg =
'ERROR(gas_update): Requested co2 data file not '// &
561 open (nico2cn,file=co2gbl_file,form=
'formatted',status=
'old')
564 read (nico2cn, 24) iyr1, iyr2, cline
565 24
format(i4,4x,i4,a48)
568 print *,
' Opened co2 data file: ',co2gbl_file
572 if ( idyr < iyr1 )
then
580 lab_dowhile1 :
do while ( i >= iyr1 )
583 read (nico2cn, *) jyr, co2g1, co2g2
585 if ( i == iyr .and. iyr == jyr )
then
586 co2_glb = (co2g1+co2g2) * 0.5e-6
587 if ( ico2flg == 2 )
then
596 if ( me == 0 ) print *,
' Co2 data for year',iyear, &
613 write(cfile1(19:22),34) idyr
618 inquire (file=cfile1, exist=file_exist)
619 if ( .not. file_exist )
then
621 lab_if_ictm :
if ( ictmflg > 10 )
then
623 print *,
' Specified co2 data for year',idyr, &
624 &
' not found !! Need to change namelist ICTM !!'
627 errmsg =
'ERROR(gas_update): Specified co2 data for year '//&
632 print *,
' Requested co2 data for year',idyr, &
633 &
' not found, check for other available data set'
636 lab_dowhile2 :
do while ( iyr >=
minyear )
638 write(cfile1(19:22),34) iyr
640 inquire (file=cfile1, exist=file_exist)
642 print *,
' Looking for CO2 file ',cfile1
645 if ( file_exist )
then
650 if ( .not. file_exist )
then
652 print *,
' Can not find co2 data source file'
655 errmsg =
'ERROR(gas_update): Can not find co2 data '// &
665 open (nico2cn,file=cfile1,form=
'formatted',status=
'old')
667 read (nico2cn, 36) iyr, cline, co2g1, co2g2
668 36
format(i4,a94,f7.2,16x,f5.2)
671 print *,
' Opened co2 data file: ',cfile1
672 print *, iyr, cline(1:94), co2g1,
' GROWTH RATE =', co2g2
679 rate = 2.00 * (iyear - iyr)
684 co2_glb = (co2g1 + rate) * 1.0e-6
686 print *,
' Global annual mean CO2 data for year', &
690 if ( ictmflg == -2 )
then
692 if ( ico2flg == 1 )
then
694 print *,
' CHECK: Monthly deviations of climatology ', &
695 &
'to be superimposed on global annual mean'
698 elseif ( ico2flg == 2 )
then
702 read (nico2cn,cform) co2dat
707 co2ann(i,j) = co2ann(i,j) + co2dat(i,j)
714 co2ann(i,j) = co2ann(i,j) * 1.0e-6 / float(12)
727 print *,
' CHECK: Sample of 2-d annual mean of CO2 ', &
728 &
'data used for year:',iyear
730 print *,
' CHECK: AFTER adding seasonal cycle, Sample ', &
731 &
'of selected months of CO2 data for year:',iyear
733 print *,
' Month =',imo
741 if ( ico2flg == 2 )
then
743 read (nico2cn,cform) co2dat
748 co2vmr_sav(i,j,imo) = (co2dat(i,j) + rate) * 1.0e-6
754 print *,
' CHECK: Sample of selected months of CO2 ', &
755 &
'data used for year:',iyear
757 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...