44 private :: cnvlanduse_glccv2
45 private :: cnvlanduse_lu100m
46 private :: cnvlanduse_jibis
52 real(
rp),
private :: cnvlanduse_limit_urban_fraction = 1.0_rp
54 real(
rp),
private :: domain_lats, domain_late
55 real(
rp),
private :: domain_lons, domain_lone
56 real(
rp),
private :: domain_dlat
58 real(
rp),
private,
parameter :: d_large = 1e20_rp
68 character(len=H_SHORT) :: cnvlanduse_name =
'NONE'
70 namelist / param_cnvlanduse / &
75 cnvlanduse_limit_urban_fraction
81 log_info(
"CNVLANDUSE_setup",*)
'Setup'
86 log_info(
"CNVLANDUSE_setup",*)
'Not found namelist. Default used.'
87 elseif( ierr > 0 )
then
88 log_error(
"CNVLANDUSE_setup",*)
'Not appropriate names in namelist PARAM_CNVLANDUSE. Check!'
91 log_nml(param_cnvlanduse)
93 select case(cnvlanduse_name)
109 log_error(
"CNVLANDUSE_setup",*)
'Unsupported TYPE: ', trim(cnvlanduse_name)
117 log_info(
"CNVLANDUSE_setup",*)
'Use GLCC ver.2, global 30 arcsec. data'
119 log_info(
"CNVLANDUSE_setup",*)
'Use KSJ landuse 100m data for Japan region'
120 log_info(
"CNVLANDUSE_setup",*)
'Overwrite Japan region'
122 log_info(
"CNVLANDUSE_setup",*)
'Use J-IBIS map 100m data for Japan region'
123 log_info(
"CNVLANDUSE_setup",*)
'Overwrite Japan region (PFT only)'
128 log_info(
"CNVLANDUSE_setup",*)
'Use KSJ landuse 100m data, Japan region only'
130 log_info(
"CNVLANDUSE_setup",*)
'Use J-IBIS map 100m data for Japan region'
131 log_info(
"CNVLANDUSE_setup",*)
'Overwrite Japan region (PFT only)'
136 log_info(
"CNVLANDUSE_setup",*)
'Do nothing for landuse index'
170 real(
rp) :: lake_wgt, ocean_wgt, urban_wgt, land_wgt
179 log_progress(*)
'skip convert landuse data'
182 log_progress(*)
'start convert landuse data'
184 domain_lats = minval( latxv(:,:) )
185 domain_late = maxval( latxv(:,:) )
186 domain_lons = minval( lonuy(:,:) )
187 domain_lone = maxval( lonuy(:,:) )
188 domain_dlat = maxval( dlat(:,:) )
190 log_info(
"CNVLANDUSE",*)
'Domain Information'
191 log_info_cont(*)
'Domain (LAT) :', domain_lats/d2r, domain_late/d2r
192 log_info_cont(*)
' (LON) :', domain_lons/d2r, domain_lone/d2r
199 pft_weight(:,i,j) = 0.0_rp
204 call cnvlanduse_glccv2( pft_weight(:,:,:) )
208 call cnvlanduse_lu100m( pft_weight(:,:,:) )
212 call cnvlanduse_jibis( pft_weight(:,:,:) )
220 lake_wgt = pft_weight(-2,i,j)
221 ocean_wgt = pft_weight(-1,i,j)
222 urban_wgt = pft_weight( 0,i,j)
223 land_wgt = sum( pft_weight(1:,i,j) )
234 allsum = lake_wgt + ocean_wgt + urban_wgt + land_wgt
235 zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
236 landuse_frac_land(i,j) = min( ( allsum-ocean_wgt ) * ( 1.0_rp-zerosw ) / ( allsum-zerosw ), 1.0_rp )
239 allsum = lake_wgt + urban_wgt + land_wgt
240 zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
241 landuse_frac_lake(i,j) = min( lake_wgt * ( 1.0_rp-zerosw ) / ( allsum-zerosw ), 1.0_rp )
244 allsum = urban_wgt + land_wgt
245 zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
246 landuse_frac_urban(i,j) = min( urban_wgt * ( 1.0_rp-zerosw ) / ( allsum-zerosw ), 1.0_rp )
250 if ( allsum > eps )
then
270 if ( cnvlanduse_limit_urban_fraction < 1.0_rp )
then
288 log_progress(*)
'end convert landuse data'
297 subroutine cnvlanduse_glccv2( PFT_weight )
311 file_tiledata_get_data
313 mapprojection_lonlat2xy
320 character(len=H_LONG) :: glccv2_in_dir =
'.'
321 character(len=H_LONG) :: glccv2_in_catalogue =
''
323 namelist / param_cnvlanduse_glccv2 / &
328 integer,
parameter :: categ_nmax = 25
329 real(
rp),
parameter :: glccv2_dlat = 30.0_rp / 60.0_rp / 60.0_rp
330 real(
rp),
parameter :: glccv2_dlon = 30.0_rp / 60.0_rp / 60.0_rp
332 integer :: lookuptable(1:categ_nmax)
333 data lookuptable / 0, &
362 integer,
parameter :: tile_nlim = 100
364 character(len=H_LONG) :: tile_fname(tile_nlim)
365 logical :: tile_hit (tile_nlim)
366 integer :: tile_js (tile_nlim)
367 integer :: tile_je (tile_nlim)
368 integer :: tile_is (tile_nlim)
369 integer :: tile_ie (tile_nlim)
370 real(
rp) :: tile_dlat, tile_dlon
372 integer,
allocatable :: landuse(:,:)
373 real(
rp),
allocatable :: lath(:,:), lonh(:,:)
374 real(
rp),
allocatable :: lath_1d(:), lonh_1d(:)
375 real(
rp),
allocatable :: xh(:,:), yh(:,:)
376 integer :: nlonh, nlath
380 character(len=H_LONG) :: fname
382 logical :: hit, no_hit_x
384 integer :: min_i, min_j
387 integer :: ish,
ieh, jsh,
jeh
388 logical :: zonal, pole
391 integer :: i, j, ii, jj, p
396 read(
io_fid_conf,nml=param_cnvlanduse_glccv2,iostat=ierr)
398 log_info(
"CNVLANDUSE_GLCCv2",*)
'Not found namelist. Default used.'
399 elseif( ierr > 0 )
then
400 log_error(
"CNVLANDUSE_GLCCv2",*)
'Not appropriate names in namelist PARAM_CNVLANDUSE_GLCCv2. Check!'
403 log_nml(param_cnvlanduse_glccv2)
406 tile_dlat = glccv2_dlat * d2r
407 tile_dlon = glccv2_dlon * d2r
410 fname = trim(glccv2_in_dir)//
'/'//trim(glccv2_in_catalogue)
413 tile_dlat, tile_dlon, &
414 domain_lats, domain_late, domain_lons, domain_lone, &
418 tile_fname(:), tile_hit(:), &
419 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
420 nlath, nlonh, jsh,
jeh, ish,
ieh, zonal, pole )
422 allocate( landuse(nlonh,nlath) )
423 allocate( lath(nlonh,nlath) )
424 allocate( lonh(nlonh,nlath) )
425 allocate( lath_1d(nlath) )
426 allocate( lonh_1d(nlonh) )
427 allocate( yh(nlonh,nlath) )
428 allocate( xh(nlonh,nlath) )
432 tile_dlat, tile_dlon, &
433 lath_1d(:), lonh_1d(:) )
435 call file_tiledata_get_data( nlath, nlonh, &
439 tile_dlat, tile_dlon, &
440 tile_fname(:), tile_hit(:), &
441 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
449 lath(i,j) = lath_1d(j)
450 lonh(i,j) = lonh_1d(i)
454 call mapprojection_lonlat2xy( nlonh, 1, nlonh, nlath, 1, nlath, &
455 lonh(:,:), lath(:,:), &
458 limit = ( tile_dlat * radius * 1.5_rp )**2
470 if ( fx(i-1) <= xh(ii,jj) .and. xh(ii,jj) < fx(i) &
471 .and. fy(j-1) <= yh(ii,jj) .and. yh(ii,jj) < fy(j) )
then
473 lu = min( landuse(ii,jj), categ_nmax )
476 pft_weight(p,i,j) = pft_weight(p,i,j) + cos(lath(ii,jj))
481 d = ( xh(ii,jj)-cx(i) )**2 + ( yh(ii,jj)-cy(j) )**2
482 lu = min( landuse(ii,jj), categ_nmax )
483 if ( d < dmin .and. 1 <= lu )
then
489 if ( hit .and. no_hit_x )
exit
491 if ( ( .not. hit ) .and. dmin < limit )
then
492 lu = min( landuse(min_i,min_j), categ_nmax )
494 pft_weight(p,i,j) = 1.0_rp
499 deallocate( landuse, lath, lonh, yh, xh )
502 end subroutine cnvlanduse_glccv2
506 subroutine cnvlanduse_lu100m( PFT_weight )
521 file_tiledata_get_data
523 mapprojection_lonlat2xy
530 character(len=H_LONG) :: lu100m_in_dir =
'.'
531 character(len=H_LONG) :: lu100m_in_catalogue =
''
533 namelist / param_cnvlanduse_lu100m / &
538 integer,
parameter :: categ_nmax = 16
539 real(
rp),
parameter :: lu100m_dlat = 5.0_rp / 60.0_rp / 100.0_rp
540 real(
rp),
parameter :: lu100m_dlon = 7.5_rp / 60.0_rp / 100.0_rp
542 integer :: lookuptable(1:16)
543 data lookuptable / 10, &
563 integer,
parameter :: tile_nlim = 1000
565 character(len=H_LONG) :: tile_fname(tile_nlim)
566 logical :: tile_hit (tile_nlim)
567 integer :: tile_js (tile_nlim)
568 integer :: tile_je (tile_nlim)
569 integer :: tile_is (tile_nlim)
570 integer :: tile_ie (tile_nlim)
571 real(
rp) :: tile_dlat, tile_dlon
573 integer,
allocatable :: landuse(:,:)
574 real(
rp),
allocatable :: lath (:,:)
575 real(
rp),
allocatable :: lonh (:,:)
576 real(
rp),
allocatable :: lath_1d(:)
577 real(
rp),
allocatable :: lonh_1d(:)
578 real(
rp),
allocatable :: xh(:,:), yh(:,:)
579 integer :: nlonh, nlath
583 character(len=H_LONG) :: fname
585 logical :: hit, no_hit_x
587 integer :: min_i, min_j
590 integer :: ish,
ieh, jsh,
jeh
591 logical :: zonal, pole
594 integer :: i, j, ii, jj, p
599 read(
io_fid_conf,nml=param_cnvlanduse_lu100m,iostat=ierr)
601 log_info(
"CNVLANDUSE_LU100M",*)
'Not found namelist. Default used.'
602 elseif( ierr > 0 )
then
603 log_error(
"CNVLANDUSE_LU100M",*)
'Not appropriate names in namelist PARAM_CNVLANDUSE_LU100M. Check!'
606 log_nml(param_cnvlanduse_lu100m)
609 tile_dlat = lu100m_dlat * d2r
610 tile_dlon = lu100m_dlon * d2r
613 fname = trim(lu100m_in_dir)//
'/'//trim(lu100m_in_catalogue)
616 tile_dlat, tile_dlon, &
617 domain_lats, domain_late, domain_lons, domain_lone, &
621 tile_fname(:), tile_hit(:), &
622 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
623 nlath, nlonh, jsh,
jeh, ish,
ieh, zonal, pole )
625 if ( .not. any(tile_hit(1:tile_nmax) ) )
return
627 allocate( landuse(nlonh,nlath) )
628 allocate( lath(nlonh,nlath) )
629 allocate( lonh(nlonh,nlath) )
630 allocate( lath_1d(nlath) )
631 allocate( lonh_1d(nlonh) )
632 allocate( yh(nlonh,nlath) )
633 allocate( xh(nlonh,nlath) )
637 tile_dlat, tile_dlon, &
638 lath_1d(:), lonh_1d(:) )
640 call file_tiledata_get_data( nlath, nlonh, &
644 tile_dlat, tile_dlon, &
645 tile_fname(:), tile_hit(:), &
646 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
655 lath(i,j) = lath_1d(j)
656 lonh(i,j) = lonh_1d(i)
660 call mapprojection_lonlat2xy( nlonh, 1, nlonh, nlath, 1, nlath, &
661 lonh(:,:), lath(:,:), &
664 limit = ( tile_dlat * radius * 1.5_rp )**2
676 if ( fx(i-1) <= xh(ii,jj) .and. xh(ii,jj) < fx(i) &
677 .and. fy(j-1) <= yh(ii,jj) .and. yh(ii,jj) < fy(j) )
then
680 if ( lu /= undef2 )
then
681 if ( .not. hit ) pft_weight(:,i,j) = 0.0_rp
683 pft_weight(p,i,j) = pft_weight(p,i,j) + 1.0_rp
688 d = ( xh(ii,jj)-cx(i) )**2 + ( yh(ii,jj)-cy(j) )**2
695 if ( hit .and. no_hit_x )
exit
697 if ( ( .not. hit ) .and. dmin < limit )
then
698 lu = landuse(min_i,min_j)
699 if ( lu /= undef2 )
then
700 pft_weight(:,i,j) = 0.0_rp
702 pft_weight(p,i,j) = 1.0_rp
708 deallocate( landuse, lath, lonh, yh, xh )
711 end subroutine cnvlanduse_lu100m
715 subroutine cnvlanduse_jibis( PFT_weight )
724 end subroutine cnvlanduse_jibis