49 end interface hist_put
53 module procedure hist_in_1d
54 module procedure hist_in_2d
55 module procedure hist_in_3d
59 module procedure hist_get_1d
62 end interface hist_get
72 private :: hist_put_axes
78 integer,
private,
parameter :: I_MODEL = 0
79 integer,
private,
parameter :: I_Z = 1
80 integer,
private,
parameter :: I_PRES = 2
82 integer,
private :: HIST_item_limit
83 integer,
private :: HIST_item_count
84 character(len=H_SHORT),
private,
allocatable :: HIST_item (:)
85 integer,
private,
allocatable :: HIST_variant(:)
86 integer,
private,
allocatable :: HIST_zcoord (:,:)
88 integer,
private,
parameter :: HIST_PRES_nlim = 300
89 integer,
private :: HIST_PRES_nlayer = -1
90 real(RP),
private,
allocatable :: HIST_PRES_val(:)
92 logical,
private :: enabled
93 integer,
private :: im, jm, km
94 integer,
private :: ims, ime
95 integer,
private :: jms, jme
97 logical,
private :: HIST_BND = .false.
122 character(len=H_MID) :: history_h_title =
'SCALE-RM HISTORY OUTPUT' 123 character(len=H_MID) :: history_t_since
125 real(RP) :: hist_pres(hist_pres_nlim) = 0.0_rp
127 namelist / param_hist / &
132 integer :: hist_variant_limit
134 real(DP) :: start_daysec
135 integer :: rankidx(2)
141 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[HISTORY] / Categ[ATMOS-RM IO] / Origin[SCALElib]' 147 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 148 elseif( ierr > 0 )
then 149 write(*,*)
'xxx Not appropriate names in namelist PARAM_HIST. Check!' 155 if ( hist_pres_nlayer > 0 )
then 156 if ( hist_pres_nlayer > 100 )
then 157 write(*,*)
'xxx number of layers of pressure is larger the KMAX' 161 do k = 1, hist_pres_nlayer
162 if ( hist_pres(k) <= 0.0_rp )
then 163 write(*,*)
'xxx Invalid value found in pressure coordinate! (k,value)=', k, hist_pres(k)
165 elseif ( hist_pres(k+1) >= hist_pres(k) )
then 166 write(*,*)
'xxx The value of pressure coordinate must be descending order! ', &
167 '(k,value[k],value[k+1])=', k, hist_pres(k), hist_pres(k+1)
174 if(
io_l )
write(
io_fid_log,*)
'*** Output with pressure coordinate is disabled' 184 write(history_t_since,
'(I4.4,5(A1,I2.2))')
time_nowdate(1), &
214 hist_variant_limit, &
222 time_start = start_daysec, &
224 time_since = history_t_since, &
225 default_zcoord =
'model', &
229 if ( hist_item_limit > 0 )
then 230 allocate( hist_item(hist_item_limit) )
231 allocate( hist_variant(hist_item_limit) )
232 allocate( hist_zcoord(hist_item_limit,hist_variant_limit) )
238 if ( hist_pres_nlayer > 0 )
then 239 allocate( hist_pres_val(hist_pres_nlayer) )
241 do k = 1, hist_pres_nlayer
242 hist_pres_val(k) = hist_pres(k) * 100.0_rp
261 subroutine hist_put_axes
264 historyputassociatedcoordinates
329 real(RP) :: axis (im,jm,
kmax)
330 character(len=2) :: axis_name(3)
333 integer :: rankidx(2)
335 integer :: startx, starty, startz
366 if ( rankidx(2) .GT. 0 ) startx = -1
367 if ( rankidx(1) .GT. 0 ) starty = -1
379 call historyputaxis(
'x',
'X',
'm',
'x',
grid_cx(ims:ime), gsize=xag, start=startx )
380 call historyputaxis(
'y',
'Y',
'm',
'y',
grid_cy(jms:jme), gsize=yag, start=starty )
381 call historyputaxis(
'z',
'Z',
'm',
'z',
grid_cz(
ks:
ke), gsize=
kmax, start=startz )
382 call historyputaxis(
'xh',
'X (half level)',
'm',
'xh',
grid_fx(ims:ime), gsize=xag, start=startx )
383 call historyputaxis(
'yh',
'Y (half level)',
'm',
'yh',
grid_fy(jms:jme), gsize=yag, start=starty )
384 call historyputaxis(
'zh',
'Z (half level)',
'm',
'zh',
grid_fz(
ks:
ke), gsize=
kmax, start=startz )
386 if ( hist_pres_nlayer > 0 )
then 387 call historyputaxis(
'pressure',
'Pressure',
'hPa',
'pressure', &
388 hist_pres_val(:)/100.0_rp, down=.true., gsize=hist_pres_nlayer, start=startz )
391 call historyputaxis(
'lz',
'LZ',
'm',
'lz',
grid_lcz(
lks:
lke), down=.true., gsize=
lkmax, start=startz )
392 call historyputaxis(
'lzh',
'LZ (half level)',
'm',
'lzh',
grid_lfz(
lks:
lke), down=.true., gsize=
lkmax, start=startz )
394 call historyputaxis(
'uz',
'UZ',
'm',
'uz',
grid_ucz(
uks:
uke), down=.true., gsize=
ukmax, start=startz )
395 call historyputaxis(
'uzh',
'UZ (half level)',
'm',
'uzh',
grid_ufz(
uks:
uke), down=.true., gsize=
ukmax, start=startz )
398 call historyputaxis(
'CZ',
'Atmos Grid Center Position Z',
'm',
'CZ',
grid_cz, gsize=
ka, start=startz )
399 call historyputaxis(
'FZ',
'Atmos Grid Face Position Z',
'm',
'FZ',
grid_fz, gsize=
ka+1, start=startz )
400 call historyputaxis(
'CDZ',
'Grid Cell length Z',
'm',
'CZ',
grid_cdz, gsize=
ka, start=startz )
401 call historyputaxis(
'FDZ',
'Grid distance Z',
'm',
'FDZ',
grid_fdz, gsize=
ka-1, start=startz )
403 call historyputaxis(
'CX',
'Atmos Grid Center Position X',
'm',
'CX',
grid_cxg, gsize=
iag, start=startz )
404 call historyputaxis(
'CY',
'Atmos Grid Center Position Y',
'm',
'CY',
grid_cyg, gsize=
jag, start=startz )
405 call historyputaxis(
'FX',
'Atmos Grid Face Position X',
'm',
'FX',
grid_fxg, gsize=
iag+1, start=startz )
406 call historyputaxis(
'FY',
'Atmos Grid Face Position Y',
'm',
'FY',
grid_fyg, gsize=
jag+1, start=startz )
407 call historyputaxis(
'CDX',
'Grid Cell length X',
'm',
'CX',
grid_cdxg, gsize=
iag, start=startz )
408 call historyputaxis(
'CDY',
'Grid Cell length Y',
'm',
'CY',
grid_cdyg, gsize=
jag, start=startz )
409 call historyputaxis(
'FDX',
'Grid distance X',
'm',
'FDX',
grid_fdxg, gsize=
iag-1, start=startz )
410 call historyputaxis(
'FDY',
'Grid distance Y',
'm',
'FDY',
grid_fdyg, gsize=
jag-1, start=startz )
412 call historyputaxis(
'CX',
'Atmos Grid Center Position X',
'm',
'CX',
grid_cx )
413 call historyputaxis(
'CY',
'Atmos Grid Center Position Y',
'm',
'CY',
grid_cy )
414 call historyputaxis(
'FX',
'Atmos Grid Face Position X',
'm',
'FX',
grid_fx )
415 call historyputaxis(
'FY',
'Atmos Grid Face Position Y',
'm',
'FY',
grid_fy )
416 call historyputaxis(
'CDX',
'Grid Cell length X',
'm',
'CX',
grid_cdx )
417 call historyputaxis(
'CDY',
'Grid Cell length Y',
'm',
'CY',
grid_cdy )
418 call historyputaxis(
'FDX',
'Grid distance X',
'm',
'FDX',
grid_fdx )
419 call historyputaxis(
'FDY',
'Grid distance Y',
'm',
'FDY',
grid_fdy )
422 call historyputaxis(
'LCZ',
'Land Grid Center Position Z',
'm',
'LCZ',
grid_lcz, down=.true., gsize=
lkmax, start=startz )
423 call historyputaxis(
'LFZ',
'Land Grid Face Position Z',
'm',
'LFZ',
grid_lfz, down=.true., gsize=
lkmax+1, start=startz )
424 call historyputaxis(
'LCDZ',
'Land Grid Cell length Z',
'm',
'LCZ',
grid_lcdz, gsize=
lkmax, start=startz )
426 call historyputaxis(
'UCZ',
'Urban Grid Center Position Z',
'm',
'UCZ',
grid_ucz, down=.true., gsize=
ukmax, start=startz )
427 call historyputaxis(
'UFZ',
'Urban Grid Face Position Z',
'm',
'UFZ',
grid_ufz, down=.true., gsize=
ukmax+1, start=startz )
428 call historyputaxis(
'UCDZ',
'Urban Grid Cell length Z',
'm',
'UCZ',
grid_ucdz, gsize=
ukmax, start=startz )
430 call historyputaxis(
'CBFZ',
'Boundary factor Center Z',
'1',
'CZ',
grid_cbfz, gsize=
ka, start=startz )
431 call historyputaxis(
'FBFZ',
'Boundary factor Face Z',
'1',
'CZ',
grid_fbfz, gsize=
ka, start=startz )
433 call historyputaxis(
'CBFX',
'Boundary factor Center X',
'1',
'CX',
grid_cbfxg, gsize=
iag, start=startz )
434 call historyputaxis(
'CBFY',
'Boundary factor Center Y',
'1',
'CY',
grid_cbfyg, gsize=
jag, start=startz )
435 call historyputaxis(
'FBFX',
'Boundary factor Face X',
'1',
'CX',
grid_fbfxg, gsize=
iag, start=startz )
436 call historyputaxis(
'FBFY',
'Boundary factor Face Y',
'1',
'CY',
grid_fbfyg, gsize=
jag, start=startz )
438 call historyputaxis(
'CBFX',
'Boundary factor Center X',
'1',
'CX',
grid_cbfx )
439 call historyputaxis(
'CBFY',
'Boundary factor Center Y',
'1',
'CY',
grid_cbfy )
440 call historyputaxis(
'FBFX',
'Boundary factor Face X',
'1',
'CX',
grid_fbfx )
441 call historyputaxis(
'FBFY',
'Boundary factor Face Y',
'1',
'CY',
grid_fbfy )
445 call historyputaxis(
'CXG',
'Grid Center Position X (global)',
'm',
'CXG',
grid_cxg, gsize=
iag, start=startz )
446 call historyputaxis(
'CYG',
'Grid Center Position Y (global)',
'm',
'CYG',
grid_cyg, gsize=
jag, start=startz )
447 call historyputaxis(
'FXG',
'Grid Face Position X (global)',
'm',
'FXG',
grid_fxg, gsize=
iag+1, start=startz )
448 call historyputaxis(
'FYG',
'Grid Face Position Y (global)',
'm',
'FYG',
grid_fyg, gsize=
jag+1, start=startz )
450 call historyputaxis(
'CBFXG',
'Boundary factor Center X (global)',
'1',
'CXG',
grid_cbfxg, gsize=
iag, start=startz )
451 call historyputaxis(
'CBFYG',
'Boundary factor Center Y (global)',
'1',
'CYG',
grid_cbfyg, gsize=
jag, start=startz )
452 call historyputaxis(
'FBFXG',
'Boundary factor Face X (global)',
'1',
'CXG',
grid_fbfxg, gsize=
iag, start=startz )
453 call historyputaxis(
'FBFYG',
'Boundary factor Face Y (global)',
'1',
'CYG',
grid_fbfyg, gsize=
jag, start=startz )
470 axis(1:im,1:jm,k) =
real_cz(k+
ks-1,ims:ime,jms:jme)
472 axis_name(1:3) = (/
'x ',
'y ',
'z '/)
473 call historyputassociatedcoordinates(
'height',
'height above ground level', &
474 'm', axis_name(1:3), axis(:,:,:), start=start )
477 axis(1:im,1:jm,k) =
real_fz(k+
ks-1,ims:ime,jms:jme)
479 axis_name(1:3) = (/
'x ',
'y ',
'zh'/)
480 call historyputassociatedcoordinates(
'height_xyw',
'height above ground level (half level xyw)', &
481 'm' , axis_name(1:3), axis(:,:,:), start=start )
485 do i = 1, min(im,
ia-ims)
486 axis(i,j,k) = (
real_cz(k+
ks-1,ims+i-1,jms+j-1) +
real_cz(k+
ks-1,ims+i,jms+j-1) ) * 0.5_rp
490 if ( im ==
ia-ims+1 )
then 493 axis(im,j,k) =
real_cz(k+
ks-1,ims+im-1,jms+j-1)
497 axis_name(1:3) = (/
'xh',
'y ',
'z '/)
498 call historyputassociatedcoordinates(
'height_uyz',
'height above ground level (half level uyz)', &
499 'm', axis_name(1:3), axis(:,:,:), start=start )
502 do j = 1, min(jm,
ja-jms)
504 axis(i,j,k) = (
real_cz(k+
ks-1,ims+i-1,jms+j-1) +
real_cz(k+
ks-1,ims+i-1,jms+j) ) * 0.5_rp
508 if ( jm ==
ja-jms+1 )
then 511 axis(i,jm,k) =
real_cz(k+
ks-1,ims+i-1,jms+jm-1)
515 axis_name(1:3) = (/
'x ',
'yh',
'z '/)
516 call historyputassociatedcoordinates(
'height_xvz',
'height above ground level (half level xvz)', &
517 'm', axis_name(1:3), axis(:,:,:), start=start )
520 do j = 1, min(jm,
ja-jms)
521 do i = 1, min(im,
ia-ims)
527 if ( jm ==
ja-jms+1 )
then 529 do i = 1, min(im,
ia-ims)
530 axis(i,jm,k) = (
real_cz(k+
ks-1,ims+i-1,jms+jm-1) +
real_cz(k+
ks-1,ims+i,jms+jm-1) ) * 0.5_rp
534 if ( im ==
ia-ims+1 )
then 536 do j = 1, min(jm,
ja-jms)
537 axis(im,j,k) = (
real_cz(k+
ks-1,ims+im-1,jms+j-1) +
real_cz(k+
ks-1,ims+im-1,jms+j) ) * 0.5_rp
541 if ( im ==
ia-ims+1 .and. jm ==
ja-jms+1 )
then 543 axis(im,jm,k) =
real_cz(k+
ks-1,ims+im-1,jms+jm-1)
546 axis_name(1:3) = (/
'xh',
'yh',
'z '/)
547 call historyputassociatedcoordinates(
'height_uvz',
'height above ground level (half level uvz)', &
548 'm', axis_name(1:3), axis(:,:,:), start=start )
552 do i = 1, min(im,
ia-ims)
553 axis(i,j,k) = (
real_fz(k+
ks-1,ims+i-1,jms+j-1) +
real_fz(k+
ks-1,ims+i,jms+j-1) ) * 0.5_rp
557 if ( im ==
ia-ims+1 )
then 560 axis(im,j,k) =
real_fz(k+
ks-1,ims+im-1,jms+j-1)
564 axis_name(1:3) = (/
'xh',
'y ',
'zh'/)
565 call historyputassociatedcoordinates(
'height_uyw',
'height above ground level (half level uyw)', &
566 'm', axis_name(1:3), axis(:,:,:), start=start )
569 do j = 1, min(jm,
ja-jms)
571 axis(i,j,k) = (
real_fz(k+
ks-1,ims+i-1,jms+j-1) +
real_fz(k+
ks-1,ims+i-1,jms+j) ) * 0.5_rp
575 if ( jm ==
ja-jms+1 )
then 578 axis(i,jm,k) =
real_fz(k+
ks-1,ims+i-1,jms+jm-1)
582 axis_name(1:3) = (/
'x ',
'yh',
'zh'/)
583 call historyputassociatedcoordinates(
'height_xvw',
'height above ground level (half level xvw)', &
584 'm', axis_name(1:3), axis(:,:,:), start=start )
587 do j = 1, min(jm,
ja-jms)
588 do i = 1, min(im,
ia-ims)
594 if ( jm ==
ja-jms+1 )
then 596 do i = 1, min(im,
ia-ims)
597 axis(i,jm,k) = (
real_fz(k+
ks-1,ims+i-1,jms+jm-1) +
real_fz(k+
ks-1,ims+i,jms+jm-1) ) * 0.5_rp
601 if ( im ==
ia-ims+1 )
then 603 do j = 1, min(jm,
ja-jms)
604 axis(im,j,k) = (
real_fz(k+
ks-1,ims+im-1,jms+j-1) +
real_fz(k+
ks-1,ims+im-1,jms+j) ) * 0.5_rp
608 if ( im ==
ia-ims+1 .and. jm ==
ja-jms+1 )
then 610 axis(im,jm,k) =
real_fz(k+
ks-1,ims+im-1,jms+jm-1)
613 axis_name(1:3) = (/
'xh',
'yh',
'zh'/)
614 call historyputassociatedcoordinates(
'height_uvw',
'height above ground level (half level uvw)', &
615 'm', axis_name(1:3), axis(:,:,:), start=start )
617 axis(1:im,1:jm,1) =
real_lon(ims:ime,jms:jme) / d2r
618 axis_name(1:2) = (/
'x ',
'y '/)
619 call historyputassociatedcoordinates(
'lon',
'longitude', &
620 'degrees_east', axis_name(1:2), axis(:,:,1), start=start )
622 axis(1:im,1:jm,1) =
real_lonx(ims:ime,jms:jme) / d2r
623 axis_name(1:2) = (/
'xh',
'y '/)
624 call historyputassociatedcoordinates(
'lon_uy',
'longitude (half level uy)', &
625 'degrees_east', axis_name(1:2), axis(:,:,1), start=start )
627 axis(1:im,1:jm,1) =
real_lony(ims:ime,jms:jme) / d2r
628 axis_name(1:2) = (/
'x ',
'yh'/)
629 call historyputassociatedcoordinates(
'lon_xv',
'longitude (half level xv)', &
630 'degrees_east', axis_name(1:2), axis(:,:,1), start=start )
632 axis(1:im,1:jm,1) =
real_lonxy(ims:ime,jms:jme) / d2r
633 axis_name(1:2) = (/
'xh',
'yh'/)
634 call historyputassociatedcoordinates(
'lon_uv',
'longitude (half level uv)', &
635 'degrees_east', axis_name(1:2), axis(:,:,1), start=start )
637 axis(1:im,1:jm,1) =
real_lat(ims:ime,jms:jme) / d2r
638 axis_name(1:2) = (/
'x ',
'y '/)
639 call historyputassociatedcoordinates(
'lat',
'latitude', &
640 'degrees_north', axis_name(1:2), axis(:,:,1), start=start )
642 axis(1:im,1:jm,1) =
real_latx(ims:ime,jms:jme) / d2r
643 axis_name(1:2) = (/
'xh',
'y '/)
644 call historyputassociatedcoordinates(
'lat_uy',
'latitude (half level uy)', &
645 'degrees_north', axis_name(1:2), axis(:,:,1), start=start )
647 axis(1:im,1:jm,1) =
real_laty(ims:ime,jms:jme) / d2r
648 axis_name(1:2) = (/
'x ',
'yh'/)
649 call historyputassociatedcoordinates(
'lat_xv',
'latitude (half level xv)', &
650 'degrees_north', axis_name(1:2), axis(:,:,1), start=start )
652 axis(1:im,1:jm,1) =
real_latxy(ims:ime,jms:jme) / d2r
653 axis_name(1:2) = (/
'xh',
'yh'/)
654 call historyputassociatedcoordinates(
'lat_uv',
'latitude (half level uv)', &
655 'degrees_north', axis_name(1:2), axis(:,:,1), start=start )
657 axis(1:im,1:jm,1) =
topo_zsfc(ims:ime,jms:jme)
658 axis_name(1:2) = (/
'x ',
'y '/)
659 call historyputassociatedcoordinates(
'topo',
'topography', &
660 'm', axis_name(1:2), axis(:,:,1), start=start )
663 axis_name(1:2) = (/
'x ',
'y '/)
664 call historyputassociatedcoordinates(
'lsmask',
'fraction for land-sea mask', &
665 '1', axis_name(1:2), axis(:,:,1), start=start )
668 end subroutine hist_put_axes
675 logical,
intent(in) :: switch
692 real(RP),
intent(in) :: pres (
ka,
ia,
ja)
693 real(RP),
intent(in) :: sfc_pres(
ia,
ja)
696 if ( hist_pres_nlayer > 0 )
then 734 integer,
intent(out) :: itemid
735 character(len=*),
intent(in) :: item
736 character(len=*),
intent(in) :: desc
737 character(len=*),
intent(in) :: unit
738 integer,
intent(in) :: ndim
739 character(len=*),
intent(in),
optional :: xdim
740 character(len=*),
intent(in),
optional :: ydim
741 character(len=*),
intent(in),
optional :: zdim
743 logical :: flag_half_x
744 logical :: flag_half_y
745 logical :: flag_half_z
747 character(len=H_SHORT) :: dims(3)
749 integer :: nvariant1, nvariant2, nvariant3
753 integer :: rankidx(2)
754 integer :: start(4), count(4)
760 if( .NOT. enabled )
return 762 if( hist_item_limit == 0 )
return 764 do id = 1, hist_item_count
765 if ( item == hist_item(id) )
then 775 if ( len_trim(item) >=
h_short )
then 776 write(*,
'(1x,A,I2,A,A)')
'xxx Length of history name should be <= ',
h_short-1 ,
' chars. STOP', trim(item)
788 if ( ndim == 1 )
then 792 if (
present(zdim) )
then 793 if ( zdim ==
'half' )
then 803 elseif ( ndim == 2 )
then 806 flag_half_x = .false.
807 if (
present(xdim) )
then 808 if( xdim ==
'half' ) flag_half_x = .true.
811 flag_half_y = .false.
812 if (
present(ydim) )
then 813 if( ydim ==
'half' ) flag_half_y = .true.
816 if ( flag_half_x .AND. flag_half_y )
then 819 elseif( flag_half_x )
then 822 elseif( flag_half_y )
then 830 elseif ( ndim == 3 )
then 833 flag_half_x = .false.
835 if (
present(xdim) )
then 836 if( xdim ==
'half' ) flag_half_x = .true.
839 flag_half_y = .false.
840 if (
present(ydim) )
then 841 if( ydim ==
'half' ) flag_half_y = .true.
844 flag_half_z = .false.
845 if (
present(zdim) )
then 846 if( zdim ==
'half' ) flag_half_z = .true.
849 if ( flag_half_x .AND. flag_half_y )
then 852 if ( flag_half_z )
then 853 dims(3) =
'height_uvw' 855 dims(3) =
'height_uvz' 857 elseif( flag_half_x )
then 860 if ( flag_half_z )
then 861 dims(3) =
'height_uyw' 863 dims(3) =
'height_uyz' 865 elseif( flag_half_y )
then 868 if ( flag_half_z )
then 869 dims(3) =
'height_xvw' 871 dims(3) =
'height_xvz' 876 if ( flag_half_z )
then 877 dims(3) =
'height_xyw' 887 if (
present(zdim) )
then 888 if ( zdim ==
'land' )
then 892 elseif( zdim ==
'landhalf' )
then 896 elseif( zdim ==
'urban' )
then 900 elseif( zdim ==
'urbanhalf' )
then 910 if ( ndim >= 2 )
then 961 if ( hist_pres_nlayer > 0 )
then 995 if ( nvariant1 + nvariant2 + nvariant3 > 0 )
then 996 hist_item_count = hist_item_count + 1
997 itemid = hist_item_count
998 hist_item(itemid) = item
1001 hist_variant(itemid) = hist_variant(itemid) + 1
1002 hist_zcoord(itemid,hist_variant(itemid)) = i_model
1006 hist_variant(itemid) = hist_variant(itemid) + 1
1007 hist_zcoord(itemid,hist_variant(itemid)) = i_z
1011 hist_variant(itemid) = hist_variant(itemid) + 1
1012 hist_zcoord(itemid,hist_variant(itemid)) = i_pres
1032 integer,
intent(in) :: itemid
1033 logical,
intent(out) :: answer
1038 if( .NOT. enabled )
return 1040 if( itemid < 0 )
return 1064 integer,
intent(in) :: itemid
1065 real(RP),
intent(in) :: var
1070 if( .NOT. enabled )
return 1072 if( itemid < 0 )
return 1078 id = id + hist_variant(n)
1081 do v = 1, hist_variant(itemid)
1084 call historyput( id, &
1105 integer,
intent(in) :: itemid
1106 real(RP),
intent(in) :: var(:)
1108 real(RP) :: var_trim(KMAX)
1114 if( .NOT. enabled )
return 1116 if( itemid < 0 )
return 1121 var_trim(k) = var(
ks+k-1)
1126 id = id + hist_variant(n)
1129 do v = 1, hist_variant(itemid)
1132 call historyput( id, &
1156 integer,
intent(in) :: itemid
1157 real(RP),
intent(in) :: var(:,:)
1158 logical,
intent(in),
optional :: nohalo
1160 real(RP) :: var_trim(im*jm)
1167 if( .NOT. enabled )
return 1169 if( itemid < 0 )
return 1175 var_trim((j-1)*im+i) = var(ims+i-1,jms+j-1)
1180 if(
present(nohalo) ) nohalo_ = nohalo
1186 var_trim((j-1)*im+i) =
rmiss 1191 do i =
ie-ims+2, ime-ims+1
1192 var_trim((j-1)*im+i) =
rmiss 1198 var_trim((j-1)*im+i) =
rmiss 1202 do j =
je-jms+2, jme-jms+1
1204 var_trim((j-1)*im+i) =
rmiss 1211 id = id + hist_variant(n)
1214 do v = 1, hist_variant(itemid)
1217 call historyput( id, &
1248 integer,
intent(in) :: itemid
1249 real(RP),
intent(in) :: var(:,:,:)
1250 character(len=*),
intent(in),
optional :: xdim
1251 character(len=*),
intent(in),
optional :: ydim
1252 character(len=*),
intent(in),
optional :: zdim
1253 logical,
intent(in),
optional :: nohalo
1255 character(len=H_SHORT) :: xd, yd, zd
1256 integer :: isize, jsize, ksize
1257 integer :: istart, jstart, kstart
1259 real(RP) :: var_Z(KA ,IA,JA)
1260 real(RP) :: var_P(HIST_PRES_nlayer,IA,JA)
1262 real(RP) :: var_trim(km*im*jm)
1272 if( .NOT. enabled )
return 1274 if( itemid < 0 )
return 1281 if(
present(xdim) ) xd = xdim
1282 if(
present(ydim) ) yd = ydim
1283 if(
present(zdim) ) zd = zdim
1286 if(
present(nohalo) ) nohalo_ = nohalo
1332 id = id + hist_variant(n)
1335 do v = 1, hist_variant(itemid)
1338 .AND. ksize ==
kmax &
1339 .AND. hist_zcoord(itemid,v) == i_z &
1350 var_trim((k-1)*jsize*isize+(j-1)*isize+i) = var_z(kstart+k-1,istart+i-1,jstart+j-1)
1355 elseif( s(1) == ka &
1356 .AND. ksize ==
kmax &
1357 .AND. hist_zcoord(itemid,v) == i_pres )
then 1359 ksize = hist_pres_nlayer
1370 var_trim((k-1)*jsize*isize+(j-1)*isize+i) = var_p(k,istart+i-1,jstart+j-1)
1380 var_trim((k-1)*jsize*isize+(j-1)*isize+i) = var(kstart+k-1,istart+i-1,jstart+j-1)
1392 var_trim((k-1)*jsize*isize+(j-1)*isize+i) =
rmiss 1399 do i =
ie-istart+2, ime-istart+1
1400 var_trim((k-1)*jsize*isize+(j-1)*isize+i) =
rmiss 1408 var_trim((k-1)*jsize*isize+(j-1)*isize+i) =
rmiss 1414 do j =
je-jstart+2, jme-jstart+1
1416 var_trim((k-1)*jsize*isize+(j-1)*isize+i) =
rmiss 1424 call historyput( id, &
1426 var_trim(1:isize*jsize*ksize) )
1443 real(RP),
intent(in) :: var
1444 character(len=*),
intent(in) :: item
1445 character(len=*),
intent(in) :: desc
1446 character(len=*),
intent(in) :: unit
1452 if( .NOT. enabled )
return 1466 call hist_put( itemid, &
1475 subroutine hist_in_1d( &
1483 real(RP),
intent(in) :: var(:)
1484 character(len=*),
intent(in) :: item
1485 character(len=*),
intent(in) :: desc
1486 character(len=*),
intent(in) :: unit
1487 character(len=*),
intent(in),
optional :: zdim
1489 character(len=H_SHORT) :: zd
1495 if( .NOT. enabled )
return 1498 if(
present(zdim) ) zd = zdim
1513 call hist_put( itemid, &
1518 end subroutine hist_in_1d
1522 subroutine hist_in_2d( &
1532 real(RP),
intent(in) :: var(:,:)
1533 character(len=*),
intent(in) :: item
1534 character(len=*),
intent(in) :: desc
1535 character(len=*),
intent(in) :: unit
1536 character(len=*),
intent(in),
optional :: xdim
1537 character(len=*),
intent(in),
optional :: ydim
1538 logical,
intent(in),
optional :: nohalo
1540 character(len=H_SHORT) :: xd, yd
1546 if( .NOT. enabled )
return 1550 if(
present(xdim) ) xd = xdim
1551 if(
present(ydim) ) yd = ydim
1567 call hist_put( itemid, &
1573 end subroutine hist_in_2d
1577 subroutine hist_in_3d( &
1588 real(RP),
intent(in) :: var(:,:,:)
1589 character(len=*),
intent(in) :: item
1590 character(len=*),
intent(in) :: desc
1591 character(len=*),
intent(in) :: unit
1592 character(len=*),
intent(in),
optional :: xdim
1593 character(len=*),
intent(in),
optional :: ydim
1594 character(len=*),
intent(in),
optional :: zdim
1595 logical,
intent(in),
optional :: nohalo
1597 character(len=H_SHORT) :: xd, yd, zd
1603 if( .NOT. enabled )
return 1608 if(
present(xdim) ) xd = xdim
1609 if(
present(ydim) ) yd = ydim
1610 if(
present(zdim) ) zd = zdim
1627 call hist_put( itemid, &
1636 end subroutine hist_in_3d
1640 subroutine hist_get_1d( &
1650 real(RP),
intent(out) :: var(:)
1651 character(len=*),
intent(in) :: basename
1652 character(len=*),
intent(in) :: varname
1653 integer,
intent(in) :: step
1654 logical,
intent(in),
optional :: allow_missing
1662 if(
present(allow_missing) ) am = allow_missing
1664 call historyget( var(:), &
1673 end subroutine hist_get_1d
1687 real(RP),
intent(out) :: var(:,:)
1688 character(len=*),
intent(in) :: basename
1689 character(len=*),
intent(in) :: varname
1690 integer,
intent(in) :: step
1691 logical,
intent(in),
optional :: allow_missing
1699 if(
present(allow_missing) ) am = allow_missing
1701 call historyget( var(:,:), &
1724 real(RP),
intent(out) :: var(:,:,:)
1725 character(len=*),
intent(in) :: basename
1726 character(len=*),
intent(in) :: varname
1727 integer,
intent(in) :: step
1728 logical,
intent(in),
optional :: allow_missing
1736 if(
present(allow_missing) ) am = allow_missing
1738 call historyget( var(:,:,:), &
integer, public imax
of computational cells: x, local
integer, public time_nowstep
current step [number]
integer, public iagb
of computational grids
integer, public prc_num_x
x length of 2D processor topology
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
real(rp), dimension(:), allocatable, public grid_cyg
center coordinate [m]: y, global
integer, public prc_local_comm_world
local communicator
subroutine, public interp_vertical_xi2p(Kpres, var, var_P)
subroutine, public prc_mpistop
Abort MPI.
real(rp), dimension(:), allocatable, public grid_cbfyg
center buffer factor (0-1): y, global
real(dp), public time_nowms
subsecond part of current time [millisec]
real(rp), dimension(:), allocatable, public grid_cxg
center coordinate [m]: x, global
subroutine, public historyaddvariable(nregist, item, dims, desc, units, now_step, zcoord, options, start, count, comm)
real(rp), dimension(:), allocatable, public grid_fdy
y-length of grid(j+1) to grid(j) [m]
logical, public io_l
output log or not? (this process)
subroutine, public hist_switch(switch)
set switch
subroutine, public historycheck(existed, item, zcoord)
real(rp), dimension(:), allocatable, public grid_cdyg
center coordinate [m]: y, global
real(rp), dimension(:), allocatable, public grid_cz
center coordinate [m]: z, local=global
integer, public jsgb
start point of the inner domain: y, global
real(rp), dimension(:), allocatable, public grid_fxg
face coordinate [m]: x, global
real(rp), dimension(:), allocatable, public grid_fbfy
face buffer factor (0-1): y
real(dp), public time_startdaysec
second of start time [sec]
integer, public ke
end point of inner domain: z, local
real(rp), dimension(:,:,:), allocatable, public real_fz
geopotential height [m] (cell face )
subroutine, public interp_vertical_xi2z(var, var_Z)
real(rp), dimension(:,:,:), allocatable, public real_cz
geopotential height [m] (cell center)
real(rp), public const_d2r
degree to radian
module GRID (cartesian) for land
real(rp), dimension(:), allocatable, public grid_cdxg
center coordinate [m]: x, global
subroutine hist_put_1d(itemid, var)
Put 1D data to history buffer.
real(rp), dimension(:), allocatable, public grid_fx
face coordinate [m]: x, local
real(rp), dimension(:), allocatable, public grid_lfz
face coordinate [m]: z, local=global
subroutine hist_in_0d(var, item, desc, unit)
Wrapper routine of HIST_reg+HIST_put 0D.
integer, public prc_num_y
y length of 2D processor topology
real(rp), dimension(:), allocatable, public grid_ucdz
z-length of control volume [m]
logical, public io_nml
output log or not? (for namelist, this process)
integer, public isgb
start point of the inner domain: x, global
subroutine, public hist_query(itemid, answer)
Check time to putting data.
integer, public ia
of whole cells: x, local, with HALO
character(len=h_mid), public h_source
for file header
real(rp), dimension(:,:), allocatable, public real_latx
latitude at staggered point (uy) [rad,-pi,pi]
integer, public jag
of computational grids
module GRID (cartesian) for urban
real(rp), dimension(:), allocatable, public grid_fbfx
face buffer factor (0-1): x
real(rp), dimension(:), allocatable, public grid_fdz
z-length of grid(k+1) to grid(k) [m]
subroutine, public interp_update_pres(Kpres, PRES, SFC_PRES, Paxis)
real(rp), dimension(:), allocatable, public grid_ufz
face coordinate [m]: z, local=global
real(dp), public time_dtsec
time interval of model [sec]
integer, public ka
of whole cells: z, local, with HALO
subroutine, public hist_setpres(PRES, SFC_PRES)
set interpolation factor for pressure coordinate
real(rp), dimension(:), allocatable, public grid_fbfxg
face buffer factor (0-1): x, global
subroutine, public hist_write
Flush history buffer to file.
real(rp), dimension(:), allocatable, public grid_fdyg
center coordinate [m]: y, global
subroutine, public interp_setup_pres(Kpres)
Reset random seed.
integer, public kmax
of computational cells: z, local
real(rp), dimension(:), allocatable, public grid_fz
face coordinate [m]: z, local=global
real(rp), dimension(:,:), allocatable, public real_lonxy
longitude at staggered point (uv) [rad,0-2pi]
subroutine hist_get_3d(var, basename, varname, step, allow_missing)
Get 3D data from file.
real(rp), dimension(:), allocatable, public grid_fbfz
face buffer factor (0-1): z
subroutine hist_get_2d(var, basename, varname, step, allow_missing)
Get 2D data from file.
integer, public js
start point of inner domain: y, local
integer, public iag
of computational grids
real(rp), dimension(:), allocatable, public grid_cbfx
center buffer factor (0-1): x
real(rp), dimension(:), allocatable, public grid_fbfyg
face buffer factor (0-1): y, global
real(rp), dimension(:), allocatable, public grid_ucz
center coordinate [m]: z, local=global
integer, public jagb
of computational grids
integer, parameter, public prc_masterrank
master process in each communicator
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:), allocatable, public grid_cbfz
center buffer factor (0-1): z
integer, public prc_myrank
process num in local communicator
real(rp), dimension(:), allocatable, public grid_cx
center coordinate [m]: x, local
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
subroutine, public hist_setup
Setup.
subroutine hist_put_0d(itemid, var)
Put 1D data to history buffer.
integer, public ie
end point of inner domain: x, local
integer, parameter, public h_short
Character length (short=16)
integer, public imaxg
of computational cells: x, global
real(rp), dimension(:), allocatable, public grid_lcdz
z-length of control volume [m]
character(len=h_mid), public h_institute
for file header
real(rp), dimension(:,:), allocatable, public real_lon
longitude [rad,0-2pi]
logical, public interp_available
topography exists & vertical interpolation has meaning?
logical, public io_aggregate
do parallel I/O through PnetCDF
real(rp), dimension(:), allocatable, public grid_fdxg
center coordinate [m]: x, global
integer, dimension(:,:), allocatable, public prc_2drank
node index in 2D topology
real(rp), dimension(:,:), allocatable, public topo_zsfc
absolute ground height [m]
real(rp), dimension(:), allocatable, public grid_cdz
z-length of control volume [m]
subroutine, public historywriteall(step_now)
real(rp), dimension(:), allocatable, public grid_fdx
x-length of grid(i+1) to grid(i) [m]
real(rp), dimension(:), allocatable, public grid_lcz
center coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public grid_cdy
y-length of control volume [m]
real(rp), dimension(:), allocatable, public grid_cbfy
center buffer factor (0-1): y
integer, dimension(6), public time_nowdate
current time [YYYY MM DD HH MM SS]
integer, public io_fid_conf
Config file ID.
real(rp), dimension(:,:), allocatable, public real_lat
latitude [rad,-pi,pi]
real(rp), dimension(:,:), allocatable, public real_lony
longitude at staggered point (xv) [rad,0-2pi]
subroutine, public historyquery(item, step_now, answer)
subroutine, public historyinit(item_count, variant_count, isize, jsize, ksize, master, myrank, rankidx, title, source, institution, time_start, time_interval, time_units, time_since, default_basename, default_zcoord, default_tinterval, default_tunit, default_taverage, default_datatype, namelist_filename, namelist_fid)
integer, public io_fid_log
Log file ID.
subroutine, public hist_reg(itemid, item, desc, unit, ndim, xdim, ydim, zdim)
Register/Append variable to history file.
integer, public jmaxg
of computational cells: y, global
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
real(rp), dimension(:,:), allocatable, public real_latxy
latitude at staggered point (uv) [rad,-pi,pi]
real(rp), dimension(:,:), allocatable, public real_lonx
longitude at staggered point (uy) [rad,0-2pi]
real(rp), dimension(:), allocatable, public grid_cdx
x-length of control volume [m]
real(rp), dimension(:,:), allocatable, public landuse_frac_land
land fraction
integer, public jmax
of computational cells: y, local
integer, public io_fid_nml
Log file ID (only for output namelist)
real(rp), dimension(:), allocatable, public grid_fyg
face coordinate [m]: y, global
real(rp), dimension(:), allocatable, public grid_cy
center coordinate [m]: y, local
subroutine hist_put_2d(itemid, var, nohalo)
Put 2D data to history buffer.
real(rp), dimension(:), allocatable, public grid_cbfxg
center buffer factor (0-1): x, global
subroutine hist_put_3d(itemid, var, xdim, ydim, zdim, nohalo)
Put 3D data to history buffer.
real(rp), dimension(:,:), allocatable, public real_laty
latitude at staggered point (xv) [rad,-pi,pi]
integer, public ja
of whole cells: y, local, with HALO
real(rp), dimension(:), allocatable, public grid_fy
face coordinate [m]: y, local