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
    57   real(RP), 
private, 
allocatable :: domain_dxy(:,:)
    59   real(RP), 
private, 
parameter :: d_large = 1e20_rp
    69     character(len=H_SHORT) :: CNVLANDUSE_name = 
'NONE'     71     namelist / param_cnvlanduse / &
    76        cnvlanduse_limit_urban_fraction
    82     log_info(
"CNVLANDUSE_setup",*) 
'Setup'    87        log_info(
"CNVLANDUSE_setup",*) 
'Not found namelist. Default used.'    88     elseif( ierr > 0 ) 
then     89        log_error(
"CNVLANDUSE_setup",*) 
'Not appropriate names in namelist PARAM_CNVLANDUSE. Check!'    92     log_nml(param_cnvlanduse)
    94     select case(cnvlanduse_name)
   110        log_error(
"CNVLANDUSE_setup",*) 
'Unsupported TYPE: ', trim(cnvlanduse_name)
   118        log_info(
"CNVLANDUSE_setup",*) 
'Use GLCC ver.2, global 30 arcsec. data'   120           log_info(
"CNVLANDUSE_setup",*) 
'Use KSJ landuse 100m data for Japan region'   121           log_info(
"CNVLANDUSE_setup",*) 
'Overwrite Japan region'   123              log_info(
"CNVLANDUSE_setup",*) 
'Use J-IBIS map 100m data for Japan region'   124              log_info(
"CNVLANDUSE_setup",*) 
'Overwrite Japan region (PFT only)'   129        log_info(
"CNVLANDUSE_setup",*) 
'Use KSJ landuse 100m data, Japan region only'   131           log_info(
"CNVLANDUSE_setup",*) 
'Use J-IBIS map 100m data for Japan region'   132           log_info(
"CNVLANDUSE_setup",*) 
'Overwrite Japan region (PFT only)'   137        log_info(
"CNVLANDUSE_setup",*) 
'Do nothing for landuse index'   173     real(RP) :: lake_wgt, ocean_wgt, urban_wgt, land_wgt
   182        log_progress(*) 
'skip  convert landuse data'   185        log_progress(*) 
'start convert landuse data'   187        domain_lats = minval( latxv(:,:) )
   188        domain_late = maxval( latxv(:,:) )
   189        domain_lons = minval( lonuy(:,:) )
   190        domain_lone = maxval( lonuy(:,:) )
   191        domain_dlat = maxval( dlat(:,:) )
   193        allocate( domain_dxy(
ia,
ja) )
   196           domain_dxy(i,j) = sqrt( area(i,j) )
   200        log_info(
"CNVLANDUSE",*) 
'Domain Information'   201        log_info_cont(*) 
'Domain (LAT)    :', domain_lats/d2r, domain_late/d2r
   202        log_info_cont(*) 
'       (LON)    :', domain_lons/d2r, domain_lone/d2r
   209           pft_weight(:,i,j) = 0.0_rp
   214           call cnvlanduse_glccv2( pft_weight(:,:,:) ) 
   218           call cnvlanduse_lu100m( pft_weight(:,:,:) ) 
   222           call cnvlanduse_jibis( pft_weight(:,:,:) ) 
   225        deallocate( domain_dxy )
   232           lake_wgt  = pft_weight(-2,i,j)
   233           ocean_wgt = pft_weight(-1,i,j)
   234           urban_wgt = pft_weight( 0,i,j)
   235           land_wgt  = sum( pft_weight(1:,i,j) )
   246           allsum = lake_wgt + ocean_wgt + urban_wgt + land_wgt
   247           zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
   248           landuse_frac_land(i,j) = ( allsum-ocean_wgt ) * ( 1.0_rp-zerosw ) / ( allsum-zerosw )
   251           allsum = lake_wgt + urban_wgt + land_wgt
   252           zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
   256           allsum = urban_wgt + land_wgt
   257           zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
   262           if ( allsum > eps ) 
then   282        if ( cnvlanduse_limit_urban_fraction < 1.0_rp ) 
then   300        log_progress(*) 
'end   convert landuse data'   312   subroutine cnvlanduse_glccv2( PFT_weight )
   325        file_tiledata_get_data
   327        mapprojection_lonlat2xy
   334     character(len=H_LONG) :: GLCCv2_IN_DIR        = 
'.'   335     character(len=H_LONG) :: GLCCv2_IN_CATALOGUE  = 
''   337     namelist / param_cnvlanduse_glccv2 / &
   342     integer,  
parameter :: categ_nmax = 25
   343     real(RP), 
parameter :: GLCCv2_DLAT = 30.0_rp / 60.0_rp / 60.0_rp 
   344     real(RP), 
parameter :: GLCCv2_DLON = 30.0_rp / 60.0_rp / 60.0_rp 
   346     integer  :: lookuptable(1:categ_nmax)
   347     data lookuptable /  0, & 
   376     integer, 
parameter    :: TILE_nlim = 100
   378     character(len=H_LONG) :: TILE_fname(tile_nlim)
   379     logical               :: TILE_hit  (tile_nlim)
   380     integer               :: TILE_JS   (tile_nlim)
   381     integer               :: TILE_JE   (tile_nlim)
   382     integer               :: TILE_IS   (tile_nlim)
   383     integer               :: TILE_IE   (tile_nlim)
   384     real(RP)              :: TILE_DLAT, TILE_DLON
   386     integer,  
allocatable :: LANDUSE(:,:)
   387     real(RP), 
allocatable :: LATH(:,:), LONH(:,:)
   388     real(RP), 
allocatable :: XH(:,:), YH(:,:)
   389     integer               :: nLONH, nLATH
   393     character(len=H_LONG) :: fname
   395     logical  :: hit, no_hit_x
   397     integer  :: min_i, min_j
   400     integer :: ish, ieh, jsh, jeh
   403     integer :: i, j, ii, jj, p
   408     read(
io_fid_conf,nml=param_cnvlanduse_glccv2,iostat=ierr)
   410        log_info(
"CNVLANDUSE_GLCCv2",*) 
'Not found namelist. Default used.'   411     elseif( ierr > 0 ) 
then    412        log_error(
"CNVLANDUSE_GLCCv2",*) 
'Not appropriate names in namelist PARAM_CNVLANDUSE_GLCCv2. Check!'   415     log_nml(param_cnvlanduse_glccv2)
   418     tile_dlat = glccv2_dlat * d2r
   419     tile_dlon = glccv2_dlon * d2r
   422     fname = trim(glccv2_in_dir)//
'/'//trim(glccv2_in_catalogue)
   425                                  tile_dlat, tile_dlon,                               & 
   426                                  domain_lats, domain_late, domain_lons, domain_lone, & 
   430                                  tile_fname(:), tile_hit(:),                         & 
   431                                  tile_js(:), tile_je(:), tile_is(:), tile_ie(:),     & 
   432                                  nlath, nlonh, jsh, jeh, ish, ieh                    ) 
   434     allocate( landuse(nlonh,nlath) )
   435     allocate( lath(nlonh,nlath) )
   436     allocate( lonh(nlonh,nlath) )
   437     allocate( yh(nlonh,nlath) )
   438     allocate( xh(nlonh,nlath) )
   440     call file_tiledata_get_data( nlath, nlonh,                                   & 
   444                                  tile_dlat, tile_dlon,                           & 
   445                                  tile_fname(:), tile_hit(:),                     & 
   446                                  tile_js(:), tile_je(:), tile_is(:), tile_ie(:), & 
   447                                  jsh, jeh, ish, ieh,                             & 
   449                                  landuse(:,:), lath(:,:), lonh(:,:)              ) 
   451     call mapprojection_lonlat2xy( nlonh, 1, nlonh, nlath, 1, nlath, &
   452                                   lonh(:,:), lath(:,:), & 
   455     limit = ( tile_dlat * radius * 1.5_rp )**2
   467              if (       fx(i-1) <= xh(ii,jj) .and. xh(ii,jj) < fx(i) &
   468                   .and. fy(j-1) <= yh(ii,jj) .and. yh(ii,jj) < fy(j) ) 
then   470                 lu = min( landuse(ii,jj), categ_nmax )
   473                    pft_weight(p,i,j) = pft_weight(p,i,j) + cos(lath(ii,jj)) 
   478              d = ( xh(ii,jj)-cx(i) )**2 + ( yh(ii,jj)-cy(j) )**2
   479              lu = min( landuse(ii,jj), categ_nmax )
   480              if ( d < dmin .and. 1 <= lu ) 
then   486           if ( hit .and. no_hit_x ) 
exit   488        if ( ( .not. hit ) .and. dmin < limit ) 
then   489           lu = min( landuse(min_i,min_j), categ_nmax )
   491           pft_weight(p,i,j) = 1.0_rp
   496     deallocate( landuse, lath, lonh, yh, xh )
   499   end subroutine cnvlanduse_glccv2
   503   subroutine cnvlanduse_lu100m( PFT_weight )
   517        file_tiledata_get_data
   519        mapprojection_lonlat2xy
   526     character(len=H_LONG) :: LU100M_IN_DIR       = 
'.'   527     character(len=H_LONG) :: LU100M_IN_CATALOGUE = 
''   529     namelist / param_cnvlanduse_lu100m / &
   534     integer,  
parameter :: categ_nmax = 16
   535     real(RP), 
parameter :: LU100M_DLAT = 5.0_rp / 60.0_rp / 100.0_rp
   536     real(RP), 
parameter :: LU100M_DLON = 7.5_rp / 60.0_rp / 100.0_rp
   538     integer  :: lookuptable(0:16)
   539     data lookuptable / -1, & 
   560     integer, 
parameter    :: TILE_nlim = 1000
   562     character(len=H_LONG) :: TILE_fname(tile_nlim)
   563     logical               :: TILE_hit  (tile_nlim)
   564     integer               :: TILE_JS   (tile_nlim)
   565     integer               :: TILE_JE   (tile_nlim)
   566     integer               :: TILE_IS   (tile_nlim)
   567     integer               :: TILE_IE   (tile_nlim)
   568     real(RP)              :: TILE_DLAT, TILE_DLON
   570     integer,  
allocatable :: LANDUSE(:,:)
   571     real(RP), 
allocatable :: LATH   (:,:)
   572     real(RP), 
allocatable :: LONH   (:,:)
   573     real(RP), 
allocatable :: XH(:,:), YH(:,:)
   574     integer               :: nLONH, nLATH
   578     character(len=H_LONG) :: fname
   580     logical  :: hit, no_hit_x
   582     integer  :: min_i, min_j
   585     integer :: ish, ieh, jsh, jeh
   588     integer :: i, j, ii, jj, p
   593     read(
io_fid_conf,nml=param_cnvlanduse_lu100m,iostat=ierr)
   595        log_info(
"CNVLANDUSE_LU100M",*) 
'Not found namelist. Default used.'   596     elseif( ierr > 0 ) 
then    597        log_error(
"CNVLANDUSE_LU100M",*) 
'Not appropriate names in namelist PARAM_CNVLANDUSE_LU100M. Check!'   600     log_nml(param_cnvlanduse_lu100m)
   603     tile_dlat = lu100m_dlat * d2r
   604     tile_dlon = lu100m_dlon * d2r
   607     fname = trim(lu100m_in_dir)//
'/'//trim(lu100m_in_catalogue)
   610                                  tile_dlat, tile_dlon,                               & 
   611                                  domain_lats, domain_late, domain_lons, domain_lone, & 
   615                                  tile_fname(:), tile_hit(:),                         & 
   616                                  tile_js(:), tile_je(:), tile_is(:), tile_ie(:),     & 
   617                                  nlath, nlonh, jsh, jeh, ish, ieh                    ) 
   619     if ( .not. any(tile_hit(1:tile_nmax) ) ) 
return   621     allocate( landuse(nlonh,nlath) )
   622     allocate( lath(nlonh,nlath) )
   623     allocate( lonh(nlonh,nlath) )
   624     allocate( yh(nlonh,nlath) )
   625     allocate( xh(nlonh,nlath) )
   627     call file_tiledata_get_data( nlath, nlonh,                                   & 
   631                                  tile_dlat, tile_dlon,                           & 
   632                                  tile_fname(:), tile_hit(:),                     & 
   633                                  tile_js(:), tile_je(:), tile_is(:), tile_ie(:), & 
   634                                  jsh, jeh, ish, ieh,                             & 
   636                                  landuse(:,:), lath(:,:), lonh(:,:),             & 
   639     call mapprojection_lonlat2xy( nlonh, 1, nlonh, nlath, 1, nlath, &
   640                                   lonh(:,:), lath(:,:), & 
   643     limit = ( tile_dlat * radius * 1.5_rp )**2
   655              if (       fx(i-1) <= xh(ii,jj) .and. xh(ii,jj) < fx(i) &
   656                   .and. fy(j-1) <= yh(ii,jj) .and. yh(ii,jj) < fy(j) ) 
then   659                 if ( lu /= undef2 ) 
then   660                    p = lookuptable( max(0,lu) ) 
   661                    pft_weight(p,i,j) = pft_weight(p,i,j) + 1.0_rp
   666              d = ( xh(ii,jj)-cx(i) )**2 + ( yh(ii,jj)-cy(j) )**2
   668              if ( d < dmin .and. lu /= undef2 ) 
then   674           if ( hit .and. no_hit_x ) 
exit   676        if ( ( .not. hit ) .and. dmin < limit ) 
then   677           lu = landuse(min_i,min_j)
   678           if ( lu /= undef2 ) 
then   679              p = lookuptable( max(0,lu) ) 
   680              pft_weight(p,i,j) = 1.0_rp
   686     deallocate( landuse, lath, lonh, yh, xh )
   689   end subroutine cnvlanduse_lu100m
   693   subroutine cnvlanduse_jibis( PFT_weight )
   702   end subroutine cnvlanduse_jibis
 real(rp), dimension(:,:,:), allocatable, public landuse_frac_pft
fraction of PFT for each mosaic 
 
integer, public ia
of whole cells: x, local, with HALO
 
subroutine, public landuse_fillhalo(FILL_BND)
HALO Communication. 
 
real(rp), public const_radius
radius of the planet [m] 
 
subroutine, public landuse_calc_fact
 
integer, public ja
of whole cells: y, local, with HALO
 
subroutine, public cnvlanduse
Driver. 
 
integer, public io_fid_conf
Config file ID. 
 
real(rp), public const_d2r
degree to radian 
 
real(rp), dimension(:,:), allocatable, public landuse_frac_urban
urban fraction 
 
logical, public cnvlanduse_useglccv2
 
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cy
center coordinate [m]: y, local 
 
integer, public is
start point of inner domain: x, local 
 
integer, public ie
end point of inner domain: x, local 
 
module atmosphere / grid / cartesC index 
 
integer, public je
end point of inner domain: y, local 
 
subroutine, public landuse_write
Write landuse data. 
 
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cx
center coordinate [m]: x, local 
 
integer, parameter, public const_undef2
undefined value (INT2) 
 
module atmosphere / grid / cartesC 
 
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lonuy
longitude at staggered point (uy) [rad,0-2pi] 
 
integer, public landuse_pft_mosaic
number of PFT mosaic 
 
integer, dimension(:,:,:), allocatable, public landuse_index_pft
index of PFT for each mosaic 
 
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_dlat
delta latitude 
 
subroutine, public prc_abort
Abort Process. 
 
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fy
face coordinate [m]: y, local 
 
integer, public js
start point of inner domain: y, local 
 
module Convert LandUseIndex 
 
subroutine, public cnvlanduse_setup
Setup. 
 
real(rp), public const_eps
small number 
 
real(rp), dimension(:,:), allocatable, public landuse_frac_lake
lake fraction 
 
module Atmosphere GRID CartesC Real(real space) 
 
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_area
horizontal area ( xy, normal z) [m2] 
 
logical, public cnvlanduse_uselu100m
 
logical, public cnvlanduse_usejibis
 
subroutine, public file_tiledata_get_info(TILE_nlim, TILE_DLAT, TILE_DLON, DOMAIN_LATS, DOMAIN_LATE, DOMAIN_LONS, DOMAIN_LONE, catalog_fname, GLOBAL_IA, TILE_nmax, TILE_fname, TILE_hit, TILE_JS, TILE_JE, TILE_IS, TILE_IE, nLATH, nLONH, jsh, jeh, ish, ieh, single_fname, LATS, LATE, LONS, LONE)
get tile information 
 
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fx
face coordinate [m]: x, local 
 
integer, public landuse_pft_nmax
number of plant functional type(PFT) 
 
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latxv
latitude at staggered point (xv) [rad,-pi,pi] 
 
logical, public cnvlanduse_donothing
 
real(rp), dimension(:,:), allocatable, public landuse_frac_land
land fraction