SCALE-RM
Functions/Subroutines | Variables
mod_cnvlanduse Module Reference

module Convert LandUseIndex More...

Functions/Subroutines

subroutine, public cnvlanduse_setup
 Setup. More...
 
subroutine, public cnvlanduse
 Driver. More...
 

Variables

logical, public cnvlanduse_donothing
 
logical, public cnvlanduse_useglccv2 = .false.
 
logical, public cnvlanduse_uselu100m = .false.
 
logical, public cnvlanduse_usejibis = .false.
 

Detailed Description

module Convert LandUseIndex

Description
subroutines for preparing landuse index data (convert from external file)
Author
Team SCALE
NAMELIST
  • PARAM_CNVLANDUSE
    nametypedefault valuecomment
    CNVLANDUSE_NAME character(len=H_SHORT) 'NONE' keep backward compatibility
    CNVLANDUSE_USEGLCCV2 logical .false.
    CNVLANDUSE_USELU100M logical .false.

  • PARAM_CNVLANDUSE_GLCCv2
    nametypedefault valuecomment
    GLCCV2_IN_DIR character(len=H_LONG) '.' directory contains GLCCv2 files (GrADS format)
    GLCCV2_IN_CATALOGUE character(len=H_LONG) '' metadata files for GLCCv2

  • PARAM_CNVLANDUSE_LU100M
    nametypedefault valuecomment
    LU100M_IN_DIR character(len=H_LONG) '.' directory contains LU100M files (GrADS format)
    LU100M_IN_CATALOGUE character(len=H_LONG) '' metadata files for LU100M

History Output
No history output

Function/Subroutine Documentation

◆ cnvlanduse_setup()

subroutine, public mod_cnvlanduse::cnvlanduse_setup

Setup.

Definition at line 64 of file mod_cnvlanduse.F90.

64  use scale_prc, only: &
65  prc_abort
66  implicit none
67 
68  character(len=H_SHORT) :: CNVLANDUSE_name = 'NONE' ! keep backward compatibility
69 
70  namelist / param_cnvlanduse / &
71  cnvlanduse_name, &
72  cnvlanduse_useglccv2, &
73  cnvlanduse_uselu100m, &
74 ! CNVLANDUSE_UseJIBIS
75  cnvlanduse_limit_urban_fraction
76 
77  integer :: ierr
78  !---------------------------------------------------------------------------
79 
80  log_newline
81  log_info("CNVLANDUSE_setup",*) 'Setup'
82  !--- read namelist
83  rewind(io_fid_conf)
84  read(io_fid_conf,nml=param_cnvlanduse,iostat=ierr)
85  if( ierr < 0 ) then !--- missing
86  log_info("CNVLANDUSE_setup",*) 'Not found namelist. Default used.'
87  elseif( ierr > 0 ) then !--- fatal error
88  log_error("CNVLANDUSE_setup",*) 'Not appropriate names in namelist PARAM_CNVLANDUSE. Check!'
89  call prc_abort
90  endif
91  log_nml(param_cnvlanduse)
92 
93  select case(cnvlanduse_name)
94  case('NONE')
95  ! do nothing
96  case('GLCCv2')
97  cnvlanduse_useglccv2 = .true.
98  cnvlanduse_uselu100m = .false.
99  cnvlanduse_usejibis = .false.
100  case('LU100M')
101  cnvlanduse_useglccv2 = .false.
102  cnvlanduse_uselu100m = .true.
103  cnvlanduse_usejibis = .false.
104  case('COMBINE')
105  cnvlanduse_useglccv2 = .true.
106  cnvlanduse_uselu100m = .true.
107  cnvlanduse_usejibis = .true.
108  case default
109  log_error("CNVLANDUSE_setup",*) 'Unsupported TYPE: ', trim(cnvlanduse_name)
110  call prc_abort
111  endselect
112 
113  cnvlanduse_donothing = .true.
114 
115  if ( cnvlanduse_useglccv2 ) then
116  cnvlanduse_donothing = .false.
117  log_info("CNVLANDUSE_setup",*) 'Use GLCC ver.2, global 30 arcsec. data'
118  if ( cnvlanduse_uselu100m ) then
119  log_info("CNVLANDUSE_setup",*) 'Use KSJ landuse 100m data for Japan region'
120  log_info("CNVLANDUSE_setup",*) 'Overwrite Japan region'
121  if ( cnvlanduse_usejibis ) then
122  log_info("CNVLANDUSE_setup",*) 'Use J-IBIS map 100m data for Japan region'
123  log_info("CNVLANDUSE_setup",*) 'Overwrite Japan region (PFT only)'
124  endif
125  endif
126  elseif ( cnvlanduse_uselu100m ) then
127  cnvlanduse_donothing = .false.
128  log_info("CNVLANDUSE_setup",*) 'Use KSJ landuse 100m data, Japan region only'
129  if ( cnvlanduse_usejibis ) then
130  log_info("CNVLANDUSE_setup",*) 'Use J-IBIS map 100m data for Japan region'
131  log_info("CNVLANDUSE_setup",*) 'Overwrite Japan region (PFT only)'
132  endif
133  endif
134 
135  if ( cnvlanduse_donothing ) then
136  log_info("CNVLANDUSE_setup",*) 'Do nothing for landuse index'
137  endif
138 
139  return

References cnvlanduse_donothing, cnvlanduse_useglccv2, cnvlanduse_usejibis, cnvlanduse_uselu100m, scale_io::io_fid_conf, and scale_prc::prc_abort().

Referenced by mod_convert::convert_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cnvlanduse()

subroutine, public mod_cnvlanduse::cnvlanduse

Driver.

Definition at line 145 of file mod_cnvlanduse.F90.

145  use scale_const, only: &
146  eps => const_eps, &
147  d2r => const_d2r
148  use scale_prc, only: &
149  prc_abort
150  use scale_sort, only: &
151  sort_exec
152  use scale_landuse, only: &
162  use scale_atmos_grid_cartesc_real, only: &
166  implicit none
167 
168  real(RP) :: PFT_weight(-2:LANDUSE_PFT_nmax,IA,JA)
169  integer :: PFT_idx(LANDUSE_PFT_nmax)
170  real(RP) :: lake_wgt, ocean_wgt, urban_wgt, land_wgt
171  real(RP) :: allsum
172  real(RP) :: zerosw
173 
174  integer :: i, j, p
175  !---------------------------------------------------------------------------
176 
177  if ( cnvlanduse_donothing ) then
178  log_newline
179  log_progress(*) 'skip convert landuse data'
180  else
181  log_newline
182  log_progress(*) 'start convert landuse data'
183 
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(:,:) )
189 
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
193 
194 
195  !$omp parallel do
196 !OCL XFILL
197  do j = 1, ja
198  do i = 1, ia
199  pft_weight(:,i,j) = 0.0_rp
200  end do
201  end do
202 
203  if ( cnvlanduse_useglccv2 ) then
204  call cnvlanduse_glccv2( pft_weight(:,:,:) ) ! [INOUT]
205  endif
206 
207  if ( cnvlanduse_uselu100m ) then
208  call cnvlanduse_lu100m( pft_weight(:,:,:) ) ! [INOUT]
209  endif
210 
211  if ( cnvlanduse_usejibis ) then
212  call cnvlanduse_jibis( pft_weight(:,:,:) ) ! [INOUT]
213  endif
214 
215  !$omp parallel do &
216  !$omp private(lake_wgt,ocean_wgt,urban_wgt,land_wgt,allsum,zerosw,PFT_idx)
217  do j = js, je
218  do i = is, ie
219 
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) )
224 
225  do p = 1, landuse_pft_nmax
226  pft_idx(p) = p
227  end do
228  call sort_exec( landuse_pft_nmax, pft_weight(1:,i,j), pft_idx(:) )
229 
230 
231  ! total = ocean + lake + urban + land
232 
233  ! land fraction : total - ocean / total
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 )
237 
238  ! lake fraction : lake / ( lake + urban + land )
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 )
242 
243  ! urban fraction : urban / ( urban + land )
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 )
247 
248  ! PFT fraction : PFT / sum( PFT(1:mosaic) )
249  allsum = sum( pft_weight(landuse_pft_nmax-landuse_pft_mosaic+1:,i,j) )
250  if ( allsum > eps ) then
251  do p = 1, landuse_pft_mosaic
252  landuse_frac_pft(i,j,p) = min( pft_weight(landuse_pft_nmax-p+1,i,j) / allsum, 1.0_rp )
253  landuse_index_pft(i,j,p) = pft_idx(landuse_pft_nmax-p+1)
254  enddo
255  ! if no second PFT, set to same as PFT1
256  if ( abs(landuse_frac_pft(i,j,1)-1.0_rp) <= eps ) then
257  landuse_frac_pft(i,j,:) = 0.0_rp
258  landuse_frac_pft(i,j,1) = 1.0_rp
259  landuse_index_pft(i,j,:) = pft_idx(landuse_pft_nmax)
260  endif
261  else ! if no PFT, set to bare ground
262  landuse_frac_pft(i,j,:) = 0.0_rp
263  landuse_frac_pft(i,j,1) = 1.0_rp
264  landuse_index_pft(i,j,:) = 1
265  endif
266 
267  enddo
268  enddo
269 
270  if ( cnvlanduse_limit_urban_fraction < 1.0_rp ) then
271  !$omp parallel do
272  do j = js, je
273  do i = is, ie
274  if ( landuse_frac_urban(i,j) == 1.0_rp ) then ! if no PFT, set to grassland
275  landuse_frac_pft(i,j,:) = 0.0_rp
276  landuse_frac_pft(i,j,1) = 1.0_rp
277  landuse_index_pft(i,j,:) = 2 ! Grassland
278  endif
279  landuse_frac_urban(i,j) = min( landuse_frac_urban(i,j), cnvlanduse_limit_urban_fraction )
280  enddo
281  enddo
282  endif
283 
284  !$acc update device(LANDUSE_frac_land, LANDUSE_frac_lake, LANDUSE_frac_urban)
285  !$acc update device(LANDUSE_frac_PFT, LANDUSE_index_PFT)
286 
287  ! calculate landuse factors
288  call landuse_fillhalo( fill_bnd=.true. )
289  call landuse_calc_fact
290 
291  log_progress(*) 'end convert landuse data'
292 
293  endif
294 
295  return

References scale_atmos_grid_cartesc::atmos_grid_cartesc_cx, scale_atmos_grid_cartesc::atmos_grid_cartesc_cy, scale_atmos_grid_cartesc::atmos_grid_cartesc_fx, scale_atmos_grid_cartesc::atmos_grid_cartesc_fy, scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_dlat, scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_latxv, scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lonuy, cnvlanduse_donothing, cnvlanduse_useglccv2, cnvlanduse_usejibis, cnvlanduse_uselu100m, scale_const::const_d2r, scale_const::const_eps, scale_const::const_radius, scale_const::const_undef2, scale_file_tiledata::file_tiledata_get_info(), scale_file_tiledata::file_tiledata_get_latlon(), scale_atmos_grid_cartesc_index::ia, scale_atmos_grid_cartesc_index::ie, scale_atmos_grid_cartesc_index::ieh, scale_io::io_fid_conf, scale_atmos_grid_cartesc_index::is, scale_atmos_grid_cartesc_index::ja, scale_atmos_grid_cartesc_index::je, scale_atmos_grid_cartesc_index::jeh, scale_atmos_grid_cartesc_index::js, scale_landuse::landuse_calc_fact(), scale_landuse::landuse_fillhalo(), scale_landuse::landuse_frac_lake, scale_landuse::landuse_frac_land, scale_landuse::landuse_frac_pft, scale_landuse::landuse_frac_urban, scale_landuse::landuse_index_pft, scale_landuse::landuse_pft_mosaic, scale_landuse::landuse_pft_nmax, and scale_prc::prc_abort().

Referenced by mod_convert::convert().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cnvlanduse_donothing

logical, public mod_cnvlanduse::cnvlanduse_donothing

Definition at line 35 of file mod_cnvlanduse.F90.

35  logical, public :: CNVLANDUSE_DoNothing

Referenced by cnvlanduse(), and cnvlanduse_setup().

◆ cnvlanduse_useglccv2

logical, public mod_cnvlanduse::cnvlanduse_useglccv2 = .false.

Definition at line 36 of file mod_cnvlanduse.F90.

36  logical, public :: CNVLANDUSE_UseGLCCv2 = .false.

Referenced by cnvlanduse(), and cnvlanduse_setup().

◆ cnvlanduse_uselu100m

logical, public mod_cnvlanduse::cnvlanduse_uselu100m = .false.

Definition at line 37 of file mod_cnvlanduse.F90.

37  logical, public :: CNVLANDUSE_UseLU100M = .false.

Referenced by cnvlanduse(), and cnvlanduse_setup().

◆ cnvlanduse_usejibis

logical, public mod_cnvlanduse::cnvlanduse_usejibis = .false.

Definition at line 38 of file mod_cnvlanduse.F90.

38  logical, public :: CNVLANDUSE_UseJIBIS = .false.

Referenced by cnvlanduse(), and cnvlanduse_setup().

scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:350
scale_landuse::landuse_calc_fact
subroutine, public landuse_calc_fact
Definition: scale_landuse.F90:238
scale_sort
module SORT
Definition: scale_sort.F90:11
scale_const::const_eps
real(rp), public const_eps
small number
Definition: scale_const.F90:35
scale_landuse::landuse_pft_mosaic
integer, public landuse_pft_mosaic
number of PFT mosaic
Definition: scale_landuse.F90:65
scale_atmos_grid_cartesc_real
module Atmosphere GRID CartesC Real(real space)
Definition: scale_atmos_grid_cartesC_real.F90:11
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_landuse::landuse_frac_urban
real(rp), dimension(:,:), allocatable, public landuse_frac_urban
urban fraction
Definition: scale_landuse.F90:56
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_landuse::landuse_frac_land
real(rp), dimension(:,:), allocatable, public landuse_frac_land
land fraction
Definition: scale_landuse.F90:55
scale_landuse::landuse_index_pft
integer, dimension(:,:,:), allocatable, public landuse_index_pft
index of PFT for each mosaic
Definition: scale_landuse.F90:68
scale_landuse::landuse_pft_nmax
integer, public landuse_pft_nmax
number of plant functional type(PFT)
Definition: scale_landuse.F90:64
scale_landuse::landuse_frac_pft
real(rp), dimension(:,:,:), allocatable, public landuse_frac_pft
fraction of PFT for each mosaic
Definition: scale_landuse.F90:67
scale_landuse::landuse_frac_lake
real(rp), dimension(:,:), allocatable, public landuse_frac_lake
lake fraction
Definition: scale_landuse.F90:57
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_dlat
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_dlat
delta latitude
Definition: scale_atmos_grid_cartesC_real.F90:58
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_latxv
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_latxv
latitude at staggered point (xv) [rad,-pi,pi]
Definition: scale_atmos_grid_cartesC_real.F90:55
scale_const::const_d2r
real(rp), public const_d2r
degree to radian
Definition: scale_const.F90:33
scale_landuse
module LANDUSE
Definition: scale_landuse.F90:19
scale_landuse::landuse_fillhalo
subroutine, public landuse_fillhalo(FILL_BND)
HALO Communication.
Definition: scale_landuse.F90:275
scale_atmos_grid_cartesc_real::atmos_grid_cartesc_real_lonuy
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_lonuy
longitude at staggered point (uy) [rad,0-2pi]
Definition: scale_atmos_grid_cartesC_real.F90:50