43 private :: cnvlanduse_glccv2
44 private :: cnvlanduse_lu100m
45 private :: cnvlanduse_jibis
51 real(RP),
private :: cnvlanduse_unittile_ddeg = 0.0_rp
52 real(RP),
private :: cnvlanduse_oversampling_factor = 2.0_rp
70 character(len=H_SHORT) :: cnvlanduse_name =
'NONE' 72 namelist / param_cnvlanduse / &
77 cnvlanduse_unittile_ddeg, &
78 cnvlanduse_oversampling_factor
80 real(RP) :: drad(
ia,
ja)
87 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[convert landuseindex] / Categ[preprocess] / Origin[SCALE-RM]' 92 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 93 elseif( ierr > 0 )
then 94 write(*,*)
'xxx Not appropriate names in namelist PARAM_CNVLANDUSE. Check!' 99 select case(cnvlanduse_name)
115 write(*,*)
'xxx Unsupported TYPE:', trim(cnvlanduse_name)
123 if(
io_l )
write(
io_fid_log,*)
'*** Use GLCC ver.2, global 30 arcsec. data' 125 if(
io_l )
write(
io_fid_log,*)
'*** Use KSJ landuse 100m data for Japan region' 128 if(
io_l )
write(
io_fid_log,*)
'*** Use J-IBIS map 100m data for Japan region' 129 if(
io_l )
write(
io_fid_log,*)
'*** Overwrite Japan region (PFT only)' 134 if(
io_l )
write(
io_fid_log,*)
'*** Use KSJ landuse 100m data, Japan region only' 136 if(
io_l )
write(
io_fid_log,*)
'*** Use J-IBIS map 100m data for Japan region' 137 if(
io_l )
write(
io_fid_log,*)
'*** Overwrite Japan region (PFT only)' 145 call comm_horizontal_min( drad_min, drad(:,:) )
147 if ( cnvlanduse_unittile_ddeg > 0.0_rp )
then 148 cnvlanduse_oversampling_factor = ( drad_min / d2r ) / cnvlanduse_unittile_ddeg
150 cnvlanduse_oversampling_factor = max( 1.0_rp, cnvlanduse_oversampling_factor )
151 cnvlanduse_unittile_ddeg = ( drad_min / d2r ) / cnvlanduse_oversampling_factor
153 if(
io_l )
write(
io_fid_log,*)
'*** The size of tile [deg] = ', cnvlanduse_unittile_ddeg
154 if(
io_l )
write(
io_fid_log,*)
'*** oversampling factor = ', cnvlanduse_oversampling_factor
173 if(
io_l )
write(
io_fid_log,*)
'++++++ SKIP CONVERT LANDUSE DATA ++++++' 176 if(
io_l )
write(
io_fid_log,*)
'++++++ START CONVERT LANDUSE DATA ++++++' 179 call cnvlanduse_glccv2
183 call cnvlanduse_lu100m
187 call cnvlanduse_jibis
193 if(
io_l )
write(
io_fid_log,*)
'++++++ END CONVERT LANDUSE DATA ++++++' 204 subroutine cnvlanduse_glccv2
225 character(len=H_LONG) :: glccv2_in_catalogue =
'' 226 character(len=H_LONG) :: glccv2_in_dir =
'' 227 real(RP) :: limit_urban_fraction = 1.0_rp
229 namelist / param_cnvlanduse_glccv2 / &
230 glccv2_in_catalogue, &
235 integer,
parameter :: tile_nlim = 100
237 real(RP) :: tile_lats (tile_nlim)
238 real(RP) :: tile_late (tile_nlim)
239 real(RP) :: tile_lons (tile_nlim)
240 real(RP) :: tile_lone (tile_nlim)
241 character(len=H_LONG) :: tile_fname(tile_nlim)
244 integer,
parameter :: isize_orig = 3600
245 integer(1) :: tile_landuse_orig(isize_orig,isize_orig)
246 real(RP) :: tile_dlat_orig, tile_dlon_orig
251 integer(1),
allocatable :: tile_landuse(:,:)
252 real(RP),
allocatable :: tile_lath (:)
253 real(RP),
allocatable :: tile_lonh (:)
254 real(RP) :: tile_dlat, tile_dlon
255 real(RP) :: area, area_fraction
262 real(RP) :: real_lonx_mod(0:
ia,
ja)
263 real(RP) :: domain_lats, domain_late
264 real(RP) :: domain_lons, domain_lone
265 integer :: domain_lonsloc(2), domain_loneloc(2)
271 integer :: lookuptable(1:25)
272 data lookuptable / 0, &
298 real(RP) :: categ_pftsum, allsum
304 character(len=H_LONG) :: fname
307 logical :: hit_lat, hit_lon
310 integer :: i, j, ii, jj, iii, jjj, t, p, pp
314 if(
io_l )
write(
io_fid_log,*)
'+++ Module[GLCCv2]/Categ[CNVLANDUSE]' 318 read(
io_fid_conf,nml=param_cnvlanduse_glccv2,iostat=ierr)
320 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 321 elseif( ierr > 0 )
then 322 write(*,*)
'xxx Not appropriate names in namelist PARAM_CNVLANDUSE_GLCCv2. Check!' 330 categ_sum(i,j,p) = 0.0_rp
335 real_lonx_mod(:,:) = mod(
real_lonx(:,:)+3.0_dp*pi, 2.0_dp*pi ) - pi
339 domain_lons = minval(real_lonx_mod(:,:))
340 domain_lone = maxval(real_lonx_mod(:,:))
342 domain_lonsloc = minloc(real_lonx_mod(:,:))
343 domain_loneloc = maxloc(real_lonx_mod(:,:))
346 if ( domain_lons < real_lonx_mod(0 ,domain_lonsloc(2)) &
347 .OR. domain_lone > real_lonx_mod(
ia,domain_loneloc(2)) )
then 349 domain_lons = minval(real_lonx_mod(:,:),mask=(real_lonx_mod>0.0_rp))
350 domain_lone = maxval(real_lonx_mod(:,:),mask=(real_lonx_mod<0.0_rp))
353 ios = nint( 30.0_rp / 60.0_rp / 60.0_rp / cnvlanduse_unittile_ddeg - 0.5_rp ) + 1
354 isize = isize_orig * ios
356 allocate( tile_landuse(isize,isize) )
357 allocate( tile_lath(0:isize) )
358 allocate( tile_lonh(0:isize) )
360 if(
io_l )
write(
io_fid_log,*)
'*** Oversampling orig = ', isize_orig,
', use = ', isize
362 tile_dlat_orig = 30.0_rp / 60.0_rp / 60.0_rp * d2r
363 tile_dlon_orig = 30.0_rp / 60.0_rp / 60.0_rp * d2r
364 if(
io_l )
write(
io_fid_log,*)
'*** TILE_DLAT :', tile_dlat_orig/d2r
365 if(
io_l )
write(
io_fid_log,*)
'*** TILE_DLON :', tile_dlon_orig/d2r
367 tile_dlat = tile_dlat_orig / ios
368 tile_dlon = tile_dlon_orig / ios
369 if(
io_l )
write(
io_fid_log,*)
'*** TILE_DLAT (OS) :', tile_dlat/d2r
370 if(
io_l )
write(
io_fid_log,*)
'*** TILE_DLON (OS) :', tile_dlon/d2r
375 fname = trim(glccv2_in_dir)//
'/'//trim(glccv2_in_catalogue)
378 if(
io_l )
write(
io_fid_log,*)
'+++ Input catalogue file:', trim(fname)
382 file = trim(fname), &
383 form =
'formatted', &
387 if ( ierr /= 0 )
then 388 write(*,*)
'xxx catalogue file not found!', trim(fname)
393 read(fid,*,iostat=ierr) index, tile_lats(t), tile_late(t), &
394 tile_lons(t), tile_lone(t), &
396 if ( ierr /= 0 )
exit 398 if ( tile_lons(t) >= 180.0_rp )
then 399 tile_lons(t) = tile_lons(t) - 360.0_rp
400 tile_lone(t) = tile_lone(t) - 360.0_rp
402 if ( tile_lons(t) < -180.0_rp ) tile_lons(t) = tile_lons(t) + 360.0_rp
403 if ( tile_lone(t) < -180.0_rp ) tile_lone(t) = tile_lone(t) + 360.0_rp
415 if ( ( tile_lats(t)*d2r >= domain_lats .AND. tile_lats(t)*d2r < domain_late ) &
416 .OR. ( tile_late(t)*d2r >= domain_lats .AND. tile_late(t)*d2r < domain_late ) )
then 420 if ( ( domain_lats >= tile_lats(t)*d2r .AND. domain_lats < tile_late(t)*d2r ) &
421 .OR. ( domain_late >= tile_lats(t)*d2r .AND. domain_late < tile_late(t)*d2r ) )
then 425 if ( check_idl )
then 426 if ( ( tile_lons(t)*d2r >= domain_lons .AND. tile_lons(t)*d2r < pi ) &
427 .OR. ( tile_lons(t)*d2r >= -pi .AND. tile_lons(t)*d2r < domain_lone ) &
428 .OR. ( tile_lone(t)*d2r >= domain_lons .AND. tile_lone(t)*d2r < pi ) &
429 .OR. ( tile_lone(t)*d2r >= -pi .AND. tile_lone(t)*d2r < domain_lone ) )
then 433 if ( ( tile_lons(t)*d2r >= domain_lons .AND. tile_lons(t)*d2r < domain_lone ) &
434 .OR. ( tile_lone(t)*d2r >= domain_lons .AND. tile_lone(t)*d2r < domain_lone ) )
then 439 if ( ( domain_lons >= tile_lons(t)*d2r .AND. domain_lons < tile_lone(t)*d2r ) &
440 .OR. ( domain_lone >= tile_lons(t)*d2r .AND. domain_lone < tile_lone(t)*d2r ) )
then 444 if ( hit_lat .AND. hit_lon )
then 445 fname = trim(glccv2_in_dir)//
'/'//trim(tile_fname(t))
448 if(
io_l )
write(
io_fid_log,*)
'+++ Input data file :', trim(fname)
449 if(
io_l )
write(
io_fid_log,*)
'*** Domain (LAT) :', domain_lats/d2r, domain_late/d2r
450 if(
io_l )
write(
io_fid_log,*)
'*** (LON) :', domain_lons/d2r, domain_lone/d2r
451 if ( check_idl )
then 452 if(
io_l )
write(
io_fid_log,*)
'*** (Date line exists within the domain)' 454 if(
io_l )
write(
io_fid_log,*)
'*** Tile (LAT) :', tile_lats(t), tile_late(t)
455 if(
io_l )
write(
io_fid_log,*)
'*** (LON) :', tile_lons(t), tile_lone(t)
459 file = trim(fname), &
460 form =
'unformatted', &
463 recl = isize_orig*isize_orig*1, &
466 if ( ierr /= 0 )
then 467 write(*,*)
'xxx data file not found!' 471 read(fid,rec=1) tile_landuse_orig(:,:)
475 do jj = 1, isize_orig
476 do ii = 1, isize_orig
479 jjj = (jj-1) * ios + j
480 iii = (ii-1) * ios + i
482 tile_landuse(iii,jjj) = tile_landuse_orig(ii,jj)
488 tile_lath(0) = tile_lats(t) * d2r
490 tile_lath(jj) = tile_lath(jj-1) + tile_dlat
494 tile_lonh(0) = tile_lons(t) * d2r
496 tile_lonh(ii) = tile_lonh(ii-1) + tile_dlon
510 if ( tile_lath(jj ) < domain_lats &
511 .OR. tile_lath(jj-1) > domain_late )
then 515 if ( check_idl )
then 516 if ( tile_lonh(ii ) < domain_lons &
517 .AND. tile_lonh(ii-1) > domain_lone )
then 521 if ( tile_lonh(ii ) < domain_lons &
522 .OR. tile_lonh(ii-1) > domain_lone )
then 527 jloop:
do j =
js-1,
je+1
528 iloop:
do i =
is-1,
ie+1
529 if ( tile_lonh(ii-1) >= real_lonx_mod(i-1,j ) &
530 .AND. tile_lonh(ii-1) < real_lonx_mod(i ,j ) &
531 .AND. tile_lath(jj-1) >=
real_laty(i ,j-1) &
532 .AND. tile_lath(jj-1) <
real_laty(i ,j ) )
then 535 ifrac_l = min( real_lonx_mod(i,j)-tile_lonh(ii-1), tile_dlon ) / tile_dlon
538 jfrac_b = min(
real_laty(i,j)-tile_lath(jj-1), tile_dlat ) / tile_dlat
543 if ( real_lonx_mod(i-1,j) >= real_lonx_mod(i ,j ) &
544 .AND. tile_lath(jj-1) >=
real_laty(i ,j-1) &
545 .AND. tile_lath(jj-1) <
real_laty(i ,j ) )
then 547 if ( tile_lonh(ii-1) >= real_lonx_mod(i-1,j) &
548 .AND. tile_lonh(ii-1) < pi )
then 551 ifrac_l = min( real_lonx_mod(i,j)-tile_lonh(ii-1)+2.0_rp*pi, tile_dlon ) / tile_dlon
554 jfrac_b = min(
real_laty(i,j)-tile_lath(jj-1), tile_dlat ) / tile_dlat
557 elseif( tile_lonh(ii-1) >= -pi &
558 .AND. tile_lonh(ii-1) < real_lonx_mod(i ,j) )
then 561 ifrac_l = min( real_lonx_mod(i,j)-tile_lonh(ii-1), tile_dlon ) / tile_dlon
564 jfrac_b = min(
real_laty(i,j)-tile_lath(jj-1), tile_dlat ) / tile_dlat
573 if( iloc == 1 .AND. jloc == 1 ) cycle
575 area = radius * radius * tile_dlon * ( sin(tile_lath(jj))-sin(tile_lath(jj-1)) )
577 pp = min( max( int(tile_landuse(ii,jj),kind=4), 0 ), 25 )
582 area_fraction = ( ifrac_l) * ( jfrac_b) * area
583 categ_sum(iloc ,jloc ,p) = categ_sum(iloc ,jloc ,p) + area_fraction
585 area_fraction = (1.0_rp-ifrac_l) * ( jfrac_b) * area
586 categ_sum(iloc+1,jloc ,p) = categ_sum(iloc+1,jloc ,p) + area_fraction
588 area_fraction = ( ifrac_l) * (1.0_rp-jfrac_b) * area
589 categ_sum(iloc ,jloc+1,p) = categ_sum(iloc ,jloc+1,p) + area_fraction
591 area_fraction = (1.0_rp-ifrac_l) * (1.0_rp-jfrac_b) * area
592 categ_sum(iloc+1,jloc+1,p) = categ_sum(iloc+1,jloc+1,p) + area_fraction
608 pft(p) = categ_sum(i,j,p)
615 if ( pft(pp) > pft(p) )
then 620 temp_idx = pft_idx(p)
621 pft_idx(p) = pft_idx(pp)
622 pft_idx(pp) = temp_idx
627 categ_pftsum = sum( pft(:) )
630 allsum = categ_sum(i,j,-2) + categ_sum(i,j,-1) + categ_sum(i,j,0) + categ_pftsum
631 zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
632 landuse_frac_land(i,j) = ( allsum-categ_sum(i,j,-1) ) * ( 1.0_rp-zerosw ) / ( allsum-zerosw )
635 allsum = categ_sum(i,j,-2) + categ_sum(i,j,0) + categ_pftsum
636 zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
637 landuse_frac_lake(i,j) = categ_sum(i,j,-2) * ( 1.0_rp-zerosw ) / ( allsum-zerosw )
640 allsum = categ_sum(i,j,0) + categ_pftsum
641 zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
646 if ( abs(allsum) > eps )
then 666 if ( limit_urban_fraction < 1.0_rp )
then 680 end subroutine cnvlanduse_glccv2
684 subroutine cnvlanduse_lu100m
705 character(len=H_LONG) :: lu100m_in_catalogue =
'' 706 character(len=H_LONG) :: lu100m_in_dir =
'' 707 real(RP) :: limit_urban_fraction = 1.0_rp
709 namelist / param_cnvlanduse_lu100m / &
710 lu100m_in_catalogue, &
715 integer,
parameter :: tile_nlim = 1000
717 real(RP) :: tile_lats (tile_nlim)
718 real(RP) :: tile_late (tile_nlim)
719 real(RP) :: tile_lons (tile_nlim)
720 real(RP) :: tile_lone (tile_nlim)
721 character(len=H_LONG) :: tile_fname(tile_nlim)
724 integer,
parameter :: isize_orig = 800
725 real(SP) :: tile_landuse_orig(isize_orig,isize_orig)
726 real(RP) :: tile_dlat_orig, tile_dlon_orig
731 real(RP),
allocatable :: tile_landuse(:,:)
732 real(RP),
allocatable :: tile_lath (:)
733 real(RP),
allocatable :: tile_lonh (:)
734 real(RP) :: tile_dlat, tile_dlon
735 real(RP) :: area, area_fraction
742 real(RP) :: real_lonx_mod(0:
ia,
ja)
743 real(RP) :: domain_lats, domain_late
744 real(RP) :: domain_lons, domain_lone
745 integer :: domain_lonsloc(2), domain_loneloc(2)
751 integer :: lookuptable(0:16)
752 data lookuptable / -1, &
770 real(RP) :: categ_pftsum, allsum
775 real(RP) :: frac, mask
777 character(len=H_LONG) :: fname
780 logical :: hit_lat, hit_lon
783 integer :: i, j, ii, jj, iii, jjj, t, p, pp
787 if(
io_l )
write(
io_fid_log,*)
'+++ Module[LU100M]/Categ[CNVLANDUSE]' 791 read(
io_fid_conf,nml=param_cnvlanduse_lu100m,iostat=ierr)
793 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 794 elseif( ierr > 0 )
then 795 write(*,*)
'xxx Not appropriate names in namelist PARAM_CNVLANDUSE_LU100M. Check!' 803 categ_sum(i,j,p) = 0.0_rp
808 real_lonx_mod(:,:) = mod(
real_lonx(:,:)+3.0_dp*pi, 2.0_dp*pi ) - pi
812 domain_lons = minval(real_lonx_mod(:,:))
813 domain_lone = maxval(real_lonx_mod(:,:))
815 domain_lonsloc = minloc(real_lonx_mod(:,:))
816 domain_loneloc = maxloc(real_lonx_mod(:,:))
819 if ( domain_lons < real_lonx_mod(0 ,domain_lonsloc(2)) &
820 .OR. domain_lone > real_lonx_mod(
ia,domain_loneloc(2)) )
then 822 domain_lons = minval(real_lonx_mod(:,:),mask=(real_lonx_mod>0.0_rp))
823 domain_lone = maxval(real_lonx_mod(:,:),mask=(real_lonx_mod<0.0_rp))
826 ios = nint( 5.0_rp / 60.0_rp / 100.0_rp / cnvlanduse_unittile_ddeg - 0.5_rp ) + 1
827 isize = isize_orig * ios
829 allocate( tile_landuse(isize,isize) )
830 allocate( tile_lath(0:isize) )
831 allocate( tile_lonh(0:isize) )
833 if(
io_l )
write(
io_fid_log,*)
'*** Oversampling orig = ', isize_orig,
', use = ', isize
835 tile_dlat_orig = 5.0_rp / 60.0_rp / 100.0_rp * d2r
836 tile_dlon_orig = 7.5_rp / 60.0_rp / 100.0_rp * d2r
837 if(
io_l )
write(
io_fid_log,*)
'*** TILE_DLAT :', tile_dlat_orig/d2r
838 if(
io_l )
write(
io_fid_log,*)
'*** TILE_DLON :', tile_dlon_orig/d2r
840 tile_dlat = tile_dlat_orig / ios
841 tile_dlon = tile_dlon_orig / ios
842 if(
io_l )
write(
io_fid_log,*)
'*** TILE_DLAT (OS) :', tile_dlat/d2r
843 if(
io_l )
write(
io_fid_log,*)
'*** TILE_DLON (OS) :', tile_dlon/d2r
848 fname = trim(lu100m_in_dir)//
'/'//trim(lu100m_in_catalogue)
851 if(
io_l )
write(
io_fid_log,*)
'+++ Input catalogue file:', trim(fname)
855 file = trim(fname), &
856 form =
'formatted', &
860 if ( ierr /= 0 )
then 861 write(*,*)
'xxx catalogue file not found!', trim(fname)
866 read(fid,*,iostat=ierr) index, tile_lats(t), tile_late(t), &
867 tile_lons(t), tile_lone(t), &
869 if ( ierr /= 0 )
exit 871 if ( tile_lons(t) >= 180.0_rp )
then 872 tile_lons(t) = tile_lons(t) - 360.0_rp
873 tile_lone(t) = tile_lone(t) - 360.0_rp
875 if ( tile_lons(t) < -180.0_rp ) tile_lons(t) = tile_lons(t) + 360.0_rp
876 if ( tile_lone(t) < -180.0_rp ) tile_lone(t) = tile_lone(t) + 360.0_rp
888 if ( ( tile_lats(t)*d2r >= domain_lats .AND. tile_lats(t)*d2r < domain_late ) &
889 .OR. ( tile_late(t)*d2r >= domain_lats .AND. tile_late(t)*d2r < domain_late ) )
then 893 if ( ( domain_lats >= tile_lats(t)*d2r .AND. domain_lats < tile_late(t)*d2r ) &
894 .OR. ( domain_late >= tile_lats(t)*d2r .AND. domain_late < tile_late(t)*d2r ) )
then 898 if ( check_idl )
then 899 if ( ( tile_lons(t)*d2r >= domain_lons .AND. tile_lons(t)*d2r < pi ) &
900 .OR. ( tile_lons(t)*d2r >= -pi .AND. tile_lons(t)*d2r < domain_lone ) &
901 .OR. ( tile_lone(t)*d2r >= domain_lons .AND. tile_lone(t)*d2r < pi ) &
902 .OR. ( tile_lone(t)*d2r >= -pi .AND. tile_lone(t)*d2r < domain_lone ) )
then 906 if ( ( tile_lons(t)*d2r >= domain_lons .AND. tile_lons(t)*d2r < domain_lone ) &
907 .OR. ( tile_lone(t)*d2r >= domain_lons .AND. tile_lone(t)*d2r < domain_lone ) )
then 912 if ( ( domain_lons >= tile_lons(t)*d2r .AND. domain_lons < tile_lone(t)*d2r ) &
913 .OR. ( domain_lone >= tile_lons(t)*d2r .AND. domain_lone < tile_lone(t)*d2r ) )
then 917 if ( hit_lat .AND. hit_lon )
then 918 fname = trim(lu100m_in_dir)//
'/'//trim(tile_fname(t))
921 if(
io_l )
write(
io_fid_log,*)
'+++ Input data file :', trim(fname)
922 if(
io_l )
write(
io_fid_log,*)
'*** Domain (LAT) :', domain_lats/d2r, domain_late/d2r
923 if(
io_l )
write(
io_fid_log,*)
'*** (LON) :', domain_lons/d2r, domain_lone/d2r
924 if ( check_idl )
then 925 if(
io_l )
write(
io_fid_log,*)
'*** (Date line exists within the domain)' 927 if(
io_l )
write(
io_fid_log,*)
'*** Tile (LAT) :', tile_lats(t), tile_late(t)
928 if(
io_l )
write(
io_fid_log,*)
'*** (LON) :', tile_lons(t), tile_lone(t)
932 file = trim(fname), &
933 form =
'unformatted', &
936 recl = isize_orig*isize_orig*4, &
939 if ( ierr /= 0 )
then 940 write(*,*)
'xxx data file not found!' 944 read(fid,rec=1) tile_landuse_orig(:,:)
948 do jj = 1, isize_orig
949 do ii = 1, isize_orig
952 jjj = (jj-1) * ios + j
953 iii = (ii-1) * ios + i
955 tile_landuse(iii,jjj) =
real( TILE_LANDUSE_orig(ii,jj), kind=
rp )
961 tile_lath(0) = tile_lats(t) * d2r
963 tile_lath(jj) = tile_lath(jj-1) + tile_dlat
967 tile_lonh(0) = tile_lons(t) * d2r
969 tile_lonh(ii) = tile_lonh(ii-1) + tile_dlon
983 if ( tile_lath(jj ) < domain_lats &
984 .OR. tile_lath(jj-1) > domain_late )
then 988 if ( check_idl )
then 989 if ( tile_lonh(ii ) < domain_lons &
990 .AND. tile_lonh(ii-1) > domain_lone )
then 994 if ( tile_lonh(ii ) < domain_lons &
995 .OR. tile_lonh(ii-1) > domain_lone )
then 1000 jloop:
do j =
js-1,
je+1
1001 iloop:
do i =
is-1,
ie+1
1002 if ( tile_lonh(ii-1) >= real_lonx_mod(i-1,j ) &
1003 .AND. tile_lonh(ii-1) < real_lonx_mod(i ,j ) &
1004 .AND. tile_lath(jj-1) >=
real_laty(i ,j-1) &
1005 .AND. tile_lath(jj-1) <
real_laty(i ,j ) )
then 1008 ifrac_l = min( real_lonx_mod(i,j)-tile_lonh(ii-1), tile_dlon ) / tile_dlon
1011 jfrac_b = min(
real_laty(i,j)-tile_lath(jj-1), tile_dlat ) / tile_dlat
1016 if ( real_lonx_mod(i-1,j) >= real_lonx_mod(i ,j ) &
1017 .AND. tile_lath(jj-1) >=
real_laty(i ,j-1) &
1018 .AND. tile_lath(jj-1) <
real_laty(i ,j ) )
then 1020 if ( tile_lonh(ii-1) >= real_lonx_mod(i-1,j) &
1021 .AND. tile_lonh(ii-1) < pi )
then 1024 ifrac_l = min( real_lonx_mod(i,j)-tile_lonh(ii-1)+2.0_rp*pi, tile_dlon ) / tile_dlon
1027 jfrac_b = min(
real_laty(i,j)-tile_lath(jj-1), tile_dlat ) / tile_dlat
1030 elseif( tile_lonh(ii-1) >= -pi &
1031 .AND. tile_lonh(ii-1) < real_lonx_mod(i ,j) )
then 1034 ifrac_l = min( real_lonx_mod(i,j)-tile_lonh(ii-1), tile_dlon ) / tile_dlon
1037 jfrac_b = min(
real_laty(i,j)-tile_lath(jj-1), tile_dlat ) / tile_dlat
1046 if( iloc == 1 .AND. jloc == 1 ) cycle
1048 area = radius * radius * tile_dlon * ( sin(tile_lath(jj))-sin(tile_lath(jj-1)) )
1050 pp = int( max( tile_landuse(ii,jj), 0.0_rp ) )
1055 area_fraction = ( ifrac_l) * ( jfrac_b) * area
1056 categ_sum(iloc ,jloc ,p) = categ_sum(iloc ,jloc ,p) + area_fraction
1058 area_fraction = (1.0_rp-ifrac_l) * ( jfrac_b) * area
1059 categ_sum(iloc+1,jloc ,p) = categ_sum(iloc+1,jloc ,p) + area_fraction
1061 area_fraction = ( ifrac_l) * (1.0_rp-jfrac_b) * area
1062 categ_sum(iloc ,jloc+1,p) = categ_sum(iloc ,jloc+1,p) + area_fraction
1064 area_fraction = (1.0_rp-ifrac_l) * (1.0_rp-jfrac_b) * area
1065 categ_sum(iloc+1,jloc+1,p) = categ_sum(iloc+1,jloc+1,p) + area_fraction
1081 pft(p) = categ_sum(i,j,p)
1088 if ( pft(pp) > pft(p) )
then 1093 temp_idx = pft_idx(p)
1094 pft_idx(p) = pft_idx(pp)
1095 pft_idx(pp) = temp_idx
1100 categ_pftsum = sum( pft(:) )
1103 allsum = categ_sum(i,j,-2) + categ_sum(i,j,0) + categ_pftsum
1104 mask = 0.5_rp + sign( 0.5_rp, allsum-eps )
1107 allsum = categ_sum(i,j,-2) + categ_sum(i,j,-1) + categ_sum(i,j,0) + categ_pftsum
1108 zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
1109 frac = ( 1.0_rp-zerosw ) - categ_sum(i,j,-1) * ( 1.0_rp-zerosw ) / ( allsum-zerosw )
1114 allsum = categ_sum(i,j,-2) + categ_sum(i,j,0) + categ_pftsum
1115 zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
1116 frac = categ_sum(i,j,-2) * ( 1.0_rp-zerosw ) / ( allsum-zerosw )
1121 allsum = categ_sum(i,j,0) + categ_pftsum
1122 zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
1123 frac = categ_sum(i,j,0) * ( 1.0_rp-zerosw ) / ( allsum-zerosw )
1129 if ( abs(allsum) > eps )
then 1156 if ( limit_urban_fraction < 1.0_rp )
then 1170 end subroutine cnvlanduse_lu100m
1174 subroutine cnvlanduse_jibis
1179 end subroutine cnvlanduse_jibis
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 landuse_frac_pft
fraction of PFT for each mosaic
subroutine, public prc_mpistop
Abort MPI.
logical, public io_l
output log or not? (this process)
real(rp), public const_radius
radius of the planet [m]
subroutine, public landuse_calc_fact
subroutine, public cnvlanduse
Driver.
real(rp), public const_d2r
degree to radian
real(rp), dimension(:,:), allocatable, public landuse_frac_urban
urban fraction
logical, public cnvlanduse_useglccv2
logical, public io_nml
output log or not? (for namelist, this process)
integer, public ia
of whole cells: x, local, with HALO
integer function, public io_get_available_fid()
search & get available file ID
real(rp), dimension(:,:), allocatable, public real_dlon
delta longitude
subroutine, public landuse_write
Write landuse data.
integer, public js
start point of inner domain: y, local
integer, public landuse_pft_mosaic
number of PFT mosaic
real(rp), dimension(:,:), allocatable, public real_dlat
delta latitude
integer, dimension(:,:,:), allocatable, public landuse_index_pft
index of PFT for each mosaic
module Convert LandUseIndex
integer, public ie
end point of inner domain: x, local
subroutine, public cnvlanduse_setup
Setup.
real(rp), public const_eps
small number
real(rp), dimension(:,:), allocatable, public landuse_frac_lake
lake fraction
logical, public cnvlanduse_uselu100m
logical, public cnvlanduse_usejibis
real(rp), public const_pi
pi
integer, public landuse_pft_nmax
number of plant functional type(PFT)
integer, public io_fid_conf
Config file ID.
integer, public io_fid_log
Log file ID.
integer, parameter, public rp
logical, public cnvlanduse_donothing
real(rp), dimension(:,:), allocatable, public real_lonx
longitude at staggered point (uy) [rad,0-2pi]
real(rp), dimension(:,:), allocatable, public landuse_frac_land
land fraction
integer, public io_fid_nml
Log file ID (only for output namelist)
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