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
291 log_progress(*)
'end convert landuse data'
300 subroutine cnvlanduse_glccv2( PFT_weight )
314 file_tiledata_get_data
316 mapprojection_lonlat2xy
323 character(len=H_LONG) :: glccv2_in_dir =
'.'
324 character(len=H_LONG) :: glccv2_in_catalogue =
''
326 namelist / param_cnvlanduse_glccv2 / &
331 integer,
parameter :: categ_nmax = 25
332 real(
rp),
parameter :: glccv2_dlat = 30.0_rp / 60.0_rp / 60.0_rp
333 real(
rp),
parameter :: glccv2_dlon = 30.0_rp / 60.0_rp / 60.0_rp
335 integer :: lookuptable(1:categ_nmax)
336 data lookuptable / 0, &
365 integer,
parameter :: tile_nlim = 100
367 character(len=H_LONG) :: tile_fname(tile_nlim)
368 logical :: tile_hit (tile_nlim)
369 integer :: tile_js (tile_nlim)
370 integer :: tile_je (tile_nlim)
371 integer :: tile_is (tile_nlim)
372 integer :: tile_ie (tile_nlim)
373 real(
rp) :: tile_dlat, tile_dlon
375 integer,
allocatable :: landuse(:,:)
376 real(
rp),
allocatable :: lath(:,:), lonh(:,:)
377 real(
rp),
allocatable :: lath_1d(:), lonh_1d(:)
378 real(
rp),
allocatable :: xh(:,:), yh(:,:)
379 integer :: nlonh, nlath
383 character(len=H_LONG) :: fname
385 logical :: hit, no_hit_x
387 integer :: min_i, min_j
390 integer :: ish,
ieh, jsh,
jeh
391 logical :: zonal, pole
394 integer :: i, j, ii, jj, p
399 read(
io_fid_conf,nml=param_cnvlanduse_glccv2,iostat=ierr)
401 log_info(
"CNVLANDUSE_GLCCv2",*)
'Not found namelist. Default used.'
402 elseif( ierr > 0 )
then
403 log_error(
"CNVLANDUSE_GLCCv2",*)
'Not appropriate names in namelist PARAM_CNVLANDUSE_GLCCv2. Check!'
406 log_nml(param_cnvlanduse_glccv2)
409 tile_dlat = glccv2_dlat * d2r
410 tile_dlon = glccv2_dlon * d2r
413 fname = trim(glccv2_in_dir)//
'/'//trim(glccv2_in_catalogue)
416 tile_dlat, tile_dlon, &
417 domain_lats, domain_late, domain_lons, domain_lone, &
421 tile_fname(:), tile_hit(:), &
422 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
423 nlath, nlonh, jsh,
jeh, ish,
ieh, zonal, pole )
425 allocate( landuse(nlonh,nlath) )
426 allocate( lath(nlonh,nlath) )
427 allocate( lonh(nlonh,nlath) )
428 allocate( lath_1d(nlath) )
429 allocate( lonh_1d(nlonh) )
430 allocate( yh(nlonh,nlath) )
431 allocate( xh(nlonh,nlath) )
435 tile_dlat, tile_dlon, &
436 lath_1d(:), lonh_1d(:) )
438 call file_tiledata_get_data( nlath, nlonh, &
442 tile_dlat, tile_dlon, &
443 tile_fname(:), tile_hit(:), &
444 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
452 lath(i,j) = lath_1d(j)
453 lonh(i,j) = lonh_1d(i)
457 call mapprojection_lonlat2xy( nlonh, 1, nlonh, nlath, 1, nlath, &
458 lonh(:,:), lath(:,:), &
461 limit = ( tile_dlat * radius * 1.5_rp )**2
473 if ( fx(i-1) <= xh(ii,jj) .and. xh(ii,jj) < fx(i) &
474 .and. fy(j-1) <= yh(ii,jj) .and. yh(ii,jj) < fy(j) )
then
476 lu = min( landuse(ii,jj), categ_nmax )
479 pft_weight(p,i,j) = pft_weight(p,i,j) + cos(lath(ii,jj))
484 d = ( xh(ii,jj)-cx(i) )**2 + ( yh(ii,jj)-cy(j) )**2
485 lu = min( landuse(ii,jj), categ_nmax )
486 if ( d < dmin .and. 1 <= lu )
then
492 if ( hit .and. no_hit_x )
exit
494 if ( ( .not. hit ) .and. dmin < limit )
then
495 lu = min( landuse(min_i,min_j), categ_nmax )
497 pft_weight(p,i,j) = 1.0_rp
502 deallocate( landuse, lath, lonh, yh, xh )
505 end subroutine cnvlanduse_glccv2
509 subroutine cnvlanduse_lu100m( PFT_weight )
524 file_tiledata_get_data
526 mapprojection_lonlat2xy
533 character(len=H_LONG) :: lu100m_in_dir =
'.'
534 character(len=H_LONG) :: lu100m_in_catalogue =
''
536 namelist / param_cnvlanduse_lu100m / &
541 integer,
parameter :: categ_nmax = 16
542 real(
rp),
parameter :: lu100m_dlat = 5.0_rp / 60.0_rp / 100.0_rp
543 real(
rp),
parameter :: lu100m_dlon = 7.5_rp / 60.0_rp / 100.0_rp
545 integer :: lookuptable(1:16)
546 data lookuptable / 10, &
566 integer,
parameter :: tile_nlim = 1000
568 character(len=H_LONG) :: tile_fname(tile_nlim)
569 logical :: tile_hit (tile_nlim)
570 integer :: tile_js (tile_nlim)
571 integer :: tile_je (tile_nlim)
572 integer :: tile_is (tile_nlim)
573 integer :: tile_ie (tile_nlim)
574 real(
rp) :: tile_dlat, tile_dlon
576 integer,
allocatable :: landuse(:,:)
577 real(
rp),
allocatable :: lath (:,:)
578 real(
rp),
allocatable :: lonh (:,:)
579 real(
rp),
allocatable :: lath_1d(:)
580 real(
rp),
allocatable :: lonh_1d(:)
581 real(
rp),
allocatable :: xh(:,:), yh(:,:)
582 integer :: nlonh, nlath
586 character(len=H_LONG) :: fname
588 logical :: hit, no_hit_x
590 integer :: min_i, min_j
593 integer :: ish,
ieh, jsh,
jeh
594 logical :: zonal, pole
597 integer :: i, j, ii, jj, p
602 read(
io_fid_conf,nml=param_cnvlanduse_lu100m,iostat=ierr)
604 log_info(
"CNVLANDUSE_LU100M",*)
'Not found namelist. Default used.'
605 elseif( ierr > 0 )
then
606 log_error(
"CNVLANDUSE_LU100M",*)
'Not appropriate names in namelist PARAM_CNVLANDUSE_LU100M. Check!'
609 log_nml(param_cnvlanduse_lu100m)
612 tile_dlat = lu100m_dlat * d2r
613 tile_dlon = lu100m_dlon * d2r
616 fname = trim(lu100m_in_dir)//
'/'//trim(lu100m_in_catalogue)
619 tile_dlat, tile_dlon, &
620 domain_lats, domain_late, domain_lons, domain_lone, &
624 tile_fname(:), tile_hit(:), &
625 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
626 nlath, nlonh, jsh,
jeh, ish,
ieh, zonal, pole )
628 if ( .not. any(tile_hit(1:tile_nmax) ) )
return
630 allocate( landuse(nlonh,nlath) )
631 allocate( lath(nlonh,nlath) )
632 allocate( lonh(nlonh,nlath) )
633 allocate( lath_1d(nlath) )
634 allocate( lonh_1d(nlonh) )
635 allocate( yh(nlonh,nlath) )
636 allocate( xh(nlonh,nlath) )
640 tile_dlat, tile_dlon, &
641 lath_1d(:), lonh_1d(:) )
643 call file_tiledata_get_data( nlath, nlonh, &
647 tile_dlat, tile_dlon, &
648 tile_fname(:), tile_hit(:), &
649 tile_js(:), tile_je(:), tile_is(:), tile_ie(:), &
658 lath(i,j) = lath_1d(j)
659 lonh(i,j) = lonh_1d(i)
663 call mapprojection_lonlat2xy( nlonh, 1, nlonh, nlath, 1, nlath, &
664 lonh(:,:), lath(:,:), &
667 limit = ( tile_dlat * radius * 1.5_rp )**2
679 if ( fx(i-1) <= xh(ii,jj) .and. xh(ii,jj) < fx(i) &
680 .and. fy(j-1) <= yh(ii,jj) .and. yh(ii,jj) < fy(j) )
then
683 if ( lu /= undef2 )
then
684 if ( .not. hit ) pft_weight(:,i,j) = 0.0_rp
686 pft_weight(p,i,j) = pft_weight(p,i,j) + 1.0_rp
691 d = ( xh(ii,jj)-cx(i) )**2 + ( yh(ii,jj)-cy(j) )**2
698 if ( hit .and. no_hit_x )
exit
700 if ( ( .not. hit ) .and. dmin < limit )
then
701 lu = landuse(min_i,min_j)
702 if ( lu /= undef2 )
then
703 pft_weight(:,i,j) = 0.0_rp
705 pft_weight(p,i,j) = 1.0_rp
711 deallocate( landuse, lath, lonh, yh, xh )
714 end subroutine cnvlanduse_lu100m
718 subroutine cnvlanduse_jibis( PFT_weight )
727 end subroutine cnvlanduse_jibis