SCALE-RM
mod_cnvlanduse.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
9 !-------------------------------------------------------------------------------
10 #include "scalelib.h"
12  !-----------------------------------------------------------------------------
13  !
14  !++ used modules
15  !
16  use scale_precision
17  use scale_io
18  use scale_prof
20  use scale_tracer
21  !-----------------------------------------------------------------------------
22  implicit none
23  private
24  !-----------------------------------------------------------------------------
25  !
26  !++ Public procedure
27  !
28  public :: cnvlanduse_setup
29  public :: cnvlanduse
30 
31  !-----------------------------------------------------------------------------
32  !
33  !++ Public parameters & variables
34  !
35  logical, public :: cnvlanduse_donothing
36  logical, public :: cnvlanduse_useglccv2 = .false.
37  logical, public :: cnvlanduse_uselu100m = .false.
38  logical, public :: cnvlanduse_usejibis = .false.
39 
40  !-----------------------------------------------------------------------------
41  !
42  !++ Private procedure
43  !
44  private :: cnvlanduse_glccv2
45  private :: cnvlanduse_lu100m
46  private :: cnvlanduse_jibis
47 
48  !-----------------------------------------------------------------------------
49  !
50  !++ Private parameters & variables
51  !
52  real(RP), private :: cnvlanduse_limit_urban_fraction = 1.0_rp
53 
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(:,:)
58 
59  real(RP), private, parameter :: d_large = 1e20_rp
60  !-----------------------------------------------------------------------------
61 contains
62  !-----------------------------------------------------------------------------
64  subroutine cnvlanduse_setup
65  use scale_prc, only: &
66  prc_abort
67  implicit none
68 
69  character(len=H_SHORT) :: CNVLANDUSE_name = 'NONE' ! keep backward compatibility
70 
71  namelist / param_cnvlanduse / &
72  cnvlanduse_name, &
75 ! CNVLANDUSE_UseJIBIS
76  cnvlanduse_limit_urban_fraction
77 
78  integer :: ierr
79  !---------------------------------------------------------------------------
80 
81  log_newline
82  log_info("CNVLANDUSE_setup",*) 'Setup'
83  !--- read namelist
84  rewind(io_fid_conf)
85  read(io_fid_conf,nml=param_cnvlanduse,iostat=ierr)
86  if( ierr < 0 ) then !--- missing
87  log_info("CNVLANDUSE_setup",*) 'Not found namelist. Default used.'
88  elseif( ierr > 0 ) then !--- fatal error
89  log_error("CNVLANDUSE_setup",*) 'Not appropriate names in namelist PARAM_CNVLANDUSE. Check!'
90  call prc_abort
91  endif
92  log_nml(param_cnvlanduse)
93 
94  select case(cnvlanduse_name)
95  case('NONE')
96  ! do nothing
97  case('GLCCv2')
98  cnvlanduse_useglccv2 = .true.
99  cnvlanduse_uselu100m = .false.
100  cnvlanduse_usejibis = .false.
101  case('LU100M')
102  cnvlanduse_useglccv2 = .false.
103  cnvlanduse_uselu100m = .true.
104  cnvlanduse_usejibis = .false.
105  case('COMBINE')
106  cnvlanduse_useglccv2 = .true.
107  cnvlanduse_uselu100m = .true.
108  cnvlanduse_usejibis = .true.
109  case default
110  log_error("CNVLANDUSE_setup",*) 'Unsupported TYPE: ', trim(cnvlanduse_name)
111  call prc_abort
112  endselect
113 
114  cnvlanduse_donothing = .true.
115 
116  if ( cnvlanduse_useglccv2 ) then
117  cnvlanduse_donothing = .false.
118  log_info("CNVLANDUSE_setup",*) 'Use GLCC ver.2, global 30 arcsec. data'
119  if ( cnvlanduse_uselu100m ) then
120  log_info("CNVLANDUSE_setup",*) 'Use KSJ landuse 100m data for Japan region'
121  log_info("CNVLANDUSE_setup",*) 'Overwrite Japan region'
122  if ( cnvlanduse_usejibis ) then
123  log_info("CNVLANDUSE_setup",*) 'Use J-IBIS map 100m data for Japan region'
124  log_info("CNVLANDUSE_setup",*) 'Overwrite Japan region (PFT only)'
125  endif
126  endif
127  elseif ( cnvlanduse_uselu100m ) then
128  cnvlanduse_donothing = .false.
129  log_info("CNVLANDUSE_setup",*) 'Use KSJ landuse 100m data, Japan region only'
130  if ( cnvlanduse_usejibis ) then
131  log_info("CNVLANDUSE_setup",*) 'Use J-IBIS map 100m data for Japan region'
132  log_info("CNVLANDUSE_setup",*) 'Overwrite Japan region (PFT only)'
133  endif
134  endif
135 
136  if ( cnvlanduse_donothing ) then
137  log_info("CNVLANDUSE_setup",*) 'Do nothing for landuse index'
138  endif
139 
140  return
141  end subroutine cnvlanduse_setup
142 
143  !-----------------------------------------------------------------------------
145  subroutine cnvlanduse
146  use scale_const, only: &
147  eps => const_eps, &
148  d2r => const_d2r
149  use scale_prc, only: &
150  prc_abort
151  use scale_sort, only: &
152  sort_exec
153  use scale_landuse, only: &
164  use scale_atmos_grid_cartesc_real, only: &
169  implicit none
170 
171  real(RP) :: PFT_weight(-2:landuse_pft_nmax,ia,ja)
172  integer :: PFT_idx(landuse_pft_nmax)
173  real(RP) :: lake_wgt, ocean_wgt, urban_wgt, land_wgt
174  real(RP) :: allsum
175  real(RP) :: zerosw
176 
177  integer :: i, j, p
178  !---------------------------------------------------------------------------
179 
180  if ( cnvlanduse_donothing ) then
181  log_newline
182  log_progress(*) 'skip convert landuse data'
183  else
184  log_newline
185  log_progress(*) 'start convert landuse data'
186 
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(:,:) )
192 
193  allocate( domain_dxy(ia,ja) )
194  do j = 1, ja
195  do i = 1, ia
196  domain_dxy(i,j) = sqrt( area(i,j) )
197  end do
198  end do
199 
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
203 
204 
205  !$omp parallel do
206 !OCL XFILL
207  do j = 1, ja
208  do i = 1, ia
209  pft_weight(:,i,j) = 0.0_rp
210  end do
211  end do
212 
213  if ( cnvlanduse_useglccv2 ) then
214  call cnvlanduse_glccv2( pft_weight(:,:,:) ) ! [INOUT]
215  endif
216 
217  if ( cnvlanduse_uselu100m ) then
218  call cnvlanduse_lu100m( pft_weight(:,:,:) ) ! [INOUT]
219  endif
220 
221  if ( cnvlanduse_usejibis ) then
222  call cnvlanduse_jibis( pft_weight(:,:,:) ) ! [INOUT]
223  endif
224 
225  deallocate( domain_dxy )
226 
227  !$omp parallel do &
228  !$omp private(lake_wgt,ocean_wgt,urban_wgt,land_wgt,allsum,zerosw,PFT_idx)
229  do j = js, je
230  do i = is, ie
231 
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) )
236 
237  do p = 1, landuse_pft_nmax
238  pft_idx(p) = p
239  end do
240  call sort_exec( landuse_pft_nmax, pft_weight(1:,i,j), pft_idx(:) )
241 
242 
243  ! total = ocean + lake + urban + land
244 
245  ! land fraction : total - ocean / total
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 )
249 
250  ! lake fraction : lake / ( lake + urban + land )
251  allsum = lake_wgt + urban_wgt + land_wgt
252  zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
253  landuse_frac_lake(i,j) = lake_wgt * ( 1.0_rp-zerosw ) / ( allsum-zerosw )
254 
255  ! urban fraction : urban / ( urban + land )
256  allsum = urban_wgt + land_wgt
257  zerosw = 0.5_rp - sign( 0.5_rp, allsum-eps )
258  landuse_frac_urban(i,j) = urban_wgt * ( 1.0_rp-zerosw ) / ( allsum-zerosw )
259 
260  ! PFT fraction : PFT / sum( PFT(1:mosaic) )
261  allsum = sum( pft_weight(landuse_pft_nmax-landuse_pft_mosaic+1:,i,j) )
262  if ( allsum > eps ) then
263  do p = 1, landuse_pft_mosaic
264  landuse_frac_pft(i,j,p) = pft_weight(landuse_pft_nmax-p+1,i,j) / allsum
265  landuse_index_pft(i,j,p) = pft_idx(landuse_pft_nmax-p+1)
266  enddo
267  ! if no second PFT, set to same as PFT1
268  if ( abs(landuse_frac_pft(i,j,1)-1.0_rp) <= eps ) then
269  landuse_frac_pft(i,j,:) = 0.0_rp
270  landuse_frac_pft(i,j,1) = 1.0_rp
271  landuse_index_pft(i,j,:) = pft_idx(landuse_pft_nmax)
272  endif
273  else ! if no PFT, set to bare ground
274  landuse_frac_pft(i,j,:) = 0.0_rp
275  landuse_frac_pft(i,j,1) = 1.0_rp
276  landuse_index_pft(i,j,:) = 1
277  endif
278 
279  enddo
280  enddo
281 
282  if ( cnvlanduse_limit_urban_fraction < 1.0_rp ) then
283  !$omp parallel do
284  do j = js, je
285  do i = is, ie
286  if ( landuse_frac_urban(i,j) == 1.0_rp ) then ! if no PFT, set to grassland
287  landuse_frac_pft(i,j,:) = 0.0_rp
288  landuse_frac_pft(i,j,1) = 1.0_rp
289  landuse_index_pft(i,j,:) = 2 ! Grassland
290  endif
291  landuse_frac_urban(i,j) = min( landuse_frac_urban(i,j), cnvlanduse_limit_urban_fraction )
292  enddo
293  enddo
294  endif
295 
296  ! calculate landuse factors
297  call landuse_fillhalo( fill_bnd=.true. )
298  call landuse_calc_fact
299 
300  log_progress(*) 'end convert landuse data'
301 
302  ! output landuse file
303  call landuse_write
304 
305  endif
306 
307  return
308  end subroutine cnvlanduse
309 
310  !-----------------------------------------------------------------------------
312  subroutine cnvlanduse_glccv2( PFT_weight )
313  use scale_prc, only: &
314  prc_abort
315  use scale_const, only: &
316  radius => const_radius, &
317  d2r => const_d2r
318  use scale_atmos_grid_cartesc, only: &
319  fx => atmos_grid_cartesc_fx, &
320  fy => atmos_grid_cartesc_fy, &
321  cx => atmos_grid_cartesc_cx, &
323  use scale_file_tiledata, only: &
325  file_tiledata_get_data
326  use scale_mapprojection, only: &
327  mapprojection_lonlat2xy
328  use scale_landuse, only: &
330  implicit none
331 
332  real(RP), intent(inout) :: PFT_weight(-2:landuse_pft_nmax,ia,ja)
333 
334  character(len=H_LONG) :: GLCCv2_IN_DIR = '.'
335  character(len=H_LONG) :: GLCCv2_IN_CATALOGUE = ''
336 
337  namelist / param_cnvlanduse_glccv2 / &
338  glccv2_in_dir, &
339  glccv2_in_catalogue
340 
341  ! GLCCv2 data
342  integer, parameter :: categ_nmax = 25
343  real(RP), parameter :: GLCCv2_DLAT = 30.0_rp / 60.0_rp / 60.0_rp ! 30 arc sec.
344  real(RP), parameter :: GLCCv2_DLON = 30.0_rp / 60.0_rp / 60.0_rp ! 30 arc sec.
345 
346  integer :: lookuptable(1:categ_nmax)
347  data lookuptable / 0, & ! 1 Urban and Built-Up Land -> 0 urban
348  7, & ! 2 Dryland Cropland and Pasture -> 7 Dryland Cropland and Pasture
349  8, & ! 3 Irrigated Cropland and Pasture -> 8 Irrigated Cropland and Pasture
350  9, & ! 4 Mixed Cropland and Pasture -> 9 Mixed Cropland and Pasture
351  5, & ! 5 Cropland/Grassland Mosaic -> 5 Cropland/Grassland Mosaic
352  6, & ! 6 Cropland/Woodland Mosaic -> 6 Cropland/Woodland Mosaic
353  2, & ! 7 Grassland -> 2 Grassland
354  3, & ! 8 Shrubland -> 3 Shrubland
355  4, & ! 9 Mixed Shrubland/Grassland -> 4 Mixed Shrubland/Grassland
356  4, & ! 10 Savanna -> 4 Mixed Shrubland/Grassland
357  11, & ! 11 Deciduous Broadleaf Forest -> 11 Deciduous Broadleaf Forest
358  12, & ! 12 Deciduous Needleleaf Forest -> 12 Deciduous Needleleaf Forest
359  13, & ! 13 Evergreen Broadleaf Forest -> 13 Deciduous Broadleaf Forest
360  14, & ! 14 Evergreen Needleleaf Forest -> 14 Deciduous Needleleaf Forest
361  15, & ! 15 Mixed Forest -> 15 Mixed Forest
362  -2, & ! 16 Water Bodies -> -2 Lake/River
363  10, & ! 17 Herbaceous Wetland -> 10 Paddy
364  10, & ! 18 Wooded Wetland -> 10 Paddy
365  1, & ! 19 Barren or Sparsely Vegetated -> 1 Dessert
366  16, & ! 20 Herbaceous Tundra -> 16 Tundra
367  16, & ! 21 Wooded Tundra -> 16 Tundra
368  16, & ! 22 Mixed Tundra -> 16 Tundra
369  16, & ! 23 Bare Ground Tundra -> 16 Tundra
370  17, & ! 24 Snow or Ice -> 17 Gracier
371  -1 / ! 25+ Sea Surface -> -1 Sea Surface
372 
373  !---------------------------------------------------------------------------
374 
375  ! data catalogue list
376  integer, parameter :: TILE_nlim = 100
377  integer :: TILE_nmax
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
385 
386  integer, allocatable :: LANDUSE(:,:)
387  real(RP), allocatable :: LATH(:,:), LONH(:,:)
388  real(RP), allocatable :: XH(:,:), YH(:,:)
389  integer :: nLONH, nLATH
390 
391  integer :: GLOBAL_IA
392 
393  character(len=H_LONG) :: fname
394 
395  logical :: hit, no_hit_x
396  real(RP) :: dmin, d
397  integer :: min_i, min_j
398  real(RP) :: limit
399 
400  integer :: ish, ieh, jsh, jeh
401  integer :: lu
402  integer :: ierr
403  integer :: i, j, ii, jj, p
404  !---------------------------------------------------------------------------
405 
406  !--- read namelist
407  rewind(io_fid_conf)
408  read(io_fid_conf,nml=param_cnvlanduse_glccv2,iostat=ierr)
409  if( ierr < 0 ) then !--- missing
410  log_info("CNVLANDUSE_GLCCv2",*) 'Not found namelist. Default used.'
411  elseif( ierr > 0 ) then !--- fatal error
412  log_error("CNVLANDUSE_GLCCv2",*) 'Not appropriate names in namelist PARAM_CNVLANDUSE_GLCCv2. Check!'
413  call prc_abort
414  endif
415  log_nml(param_cnvlanduse_glccv2)
416 
417 
418  tile_dlat = glccv2_dlat * d2r
419  tile_dlon = glccv2_dlon * d2r
420 
421  ! catalogue file
422  fname = trim(glccv2_in_dir)//'/'//trim(glccv2_in_catalogue)
423 
424  call file_tiledata_get_info( tile_nlim, & ! [IN]
425  tile_dlat, tile_dlon, & ! [IN]
426  domain_lats, domain_late, domain_lons, domain_lone, & ! [IN]
427  fname, & ! [IN]
428  global_ia, & ! [OUT]
429  tile_nmax, & ! [OUT]
430  tile_fname(:), tile_hit(:), & ! [OUT]
431  tile_js(:), tile_je(:), tile_is(:), tile_ie(:), & ! [OUT]
432  nlath, nlonh, jsh, jeh, ish, ieh ) ! [OUT]
433 
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) )
439 
440  call file_tiledata_get_data( nlath, nlonh, & ! [IN]
441  glccv2_in_dir, & ! [IN]
442  global_ia, & ! [IN]
443  tile_nmax, & ! [IN]
444  tile_dlat, tile_dlon, & ! [IN]
445  tile_fname(:), tile_hit(:), & ! [IN]
446  tile_js(:), tile_je(:), tile_is(:), tile_ie(:), & ! [IN]
447  jsh, jeh, ish, ieh, & ! [IN]
448  "INT1", & ! [IN]
449  landuse(:,:), lath(:,:), lonh(:,:) ) ! [OUT]
450 
451  call mapprojection_lonlat2xy( nlonh, 1, nlonh, nlath, 1, nlath, &
452  lonh(:,:), lath(:,:), & ! [IN]
453  xh(:,:), yh(:,:) ) ! [OUT]
454 
455  limit = ( tile_dlat * radius * 1.5_rp )**2
456  !$omp parallel do collapse(2) &
457  !$omp private(hit,no_hit_x,lu,p,dmin,min_i,min_j,d)
458  do j = 1, ja
459  do i = 1, ia
460  hit = .false.
461  dmin = d_large
462  min_i = -1
463  min_j = -1
464  do jj = 1, nlath
465  no_hit_x = .true.
466  do ii = 1, nlonh
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
469  no_hit_x = .false.
470  lu = min( landuse(ii,jj), categ_nmax )
471  if ( 1 <= lu ) then
472  p = lookuptable(lu)
473  pft_weight(p,i,j) = pft_weight(p,i,j) + cos(lath(ii,jj)) ! area weight
474  hit = .true.
475  cycle
476  end if
477  end if
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
481  dmin = d
482  min_i = ii
483  min_j = jj
484  end if
485  end do
486  if ( hit .and. no_hit_x ) exit
487  end do
488  if ( ( .not. hit ) .and. dmin < limit ) then
489  lu = min( landuse(min_i,min_j), categ_nmax )
490  p = lookuptable(lu)
491  pft_weight(p,i,j) = 1.0_rp
492  end if
493  end do
494  end do
495 
496  deallocate( landuse, lath, lonh, yh, xh )
497 
498  return
499  end subroutine cnvlanduse_glccv2
500 
501  !-----------------------------------------------------------------------------
503  subroutine cnvlanduse_lu100m( PFT_weight )
504  use scale_prc, only: &
505  prc_abort
506  use scale_const, only: &
507  undef2 => const_undef2, &
508  radius => const_radius, &
509  d2r => const_d2r
510  use scale_atmos_grid_cartesc, only: &
511  fx => atmos_grid_cartesc_fx, &
512  fy => atmos_grid_cartesc_fy, &
513  cx => atmos_grid_cartesc_cx, &
515  use scale_file_tiledata, only: &
517  file_tiledata_get_data
518  use scale_mapprojection, only: &
519  mapprojection_lonlat2xy
520  use scale_landuse, only: &
522  implicit none
523 
524  real(RP), intent(inout) :: PFT_weight(-2:landuse_pft_nmax,ia,ja)
525 
526  character(len=H_LONG) :: LU100M_IN_DIR = '.'
527  character(len=H_LONG) :: LU100M_IN_CATALOGUE = ''
528 
529  namelist / param_cnvlanduse_lu100m / &
530  lu100m_in_dir, &
531  lu100m_in_catalogue
532 
533  ! LU100M data
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
537 
538  integer :: lookuptable(0:16)
539  data lookuptable / -1, & ! -999 missing -> -1 Sea Surface
540  10, & ! 1 paddy -> 10 Paddy
541  9, & ! 2 cropland -> 9 Mixed Cropland and Pasture
542  1, & ! 3 UNDEF -> 1 Dessert
543  1, & ! 4 UNDEF -> 1 Dessert
544  11, & ! 5 forest -> 11 Deciduous Broadleaf Forest
545  1, & ! 6 bareground -> 1 Dessert
546  0, & ! 7 urban building -> 0 Urban and Built-up Land
547  1, & ! 8 UNDEF -> 1 Dessert
548  0, & ! 9 motorway -> 0 Urban and Built-up Land
549  0, & ! 10 urban ground -> 0 Urban and Built-up Land
550  -2, & ! 11 lake,river -> -2 Lake/River
551  1, & ! 12 UNDEF -> 1 Dessert
552  1, & ! 13 UNDEF -> 1 Dessert
553  1, & ! 14 seashore -> 1 Dessert
554  -1, & ! 15 ocean -> -1 Sea Surface
555  2 / ! 16 golf course -> 2 Grassland
556 
557  !---------------------------------------------------------------------------
558 
559  ! data catalogue list
560  integer, parameter :: TILE_nlim = 1000
561  integer :: TILE_nmax
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
569 
570  integer, allocatable :: LANDUSE(:,:)
571  real(RP), allocatable :: LATH (:,:)
572  real(RP), allocatable :: LONH (:,:)
573  real(RP), allocatable :: XH(:,:), YH(:,:)
574  integer :: nLONH, nLATH
575 
576  integer :: GLOBAL_IA
577 
578  character(len=H_LONG) :: fname
579 
580  logical :: hit, no_hit_x
581  real(RP) :: dmin, d
582  integer :: min_i, min_j
583  real(RP) :: limit
584 
585  integer :: ish, ieh, jsh, jeh
586  integer :: lu
587  integer :: ierr
588  integer :: i, j, ii, jj, p
589  !---------------------------------------------------------------------------
590 
591  !--- read namelist
592  rewind(io_fid_conf)
593  read(io_fid_conf,nml=param_cnvlanduse_lu100m,iostat=ierr)
594  if( ierr < 0 ) then !--- missing
595  log_info("CNVLANDUSE_LU100M",*) 'Not found namelist. Default used.'
596  elseif( ierr > 0 ) then !--- fatal error
597  log_error("CNVLANDUSE_LU100M",*) 'Not appropriate names in namelist PARAM_CNVLANDUSE_LU100M. Check!'
598  call prc_abort
599  endif
600  log_nml(param_cnvlanduse_lu100m)
601 
602 
603  tile_dlat = lu100m_dlat * d2r
604  tile_dlon = lu100m_dlon * d2r
605 
606  ! catalogue file
607  fname = trim(lu100m_in_dir)//'/'//trim(lu100m_in_catalogue)
608 
609  call file_tiledata_get_info( tile_nlim, & ! [IN]
610  tile_dlat, tile_dlon, & ! [IN]
611  domain_lats, domain_late, domain_lons, domain_lone, & ! [IN]
612  fname, & ! [IN]
613  global_ia, & ! [OUT]
614  tile_nmax, & ! [OUT]
615  tile_fname(:), tile_hit(:), & ! [OUT]
616  tile_js(:), tile_je(:), tile_is(:), tile_ie(:), & ! [OUT]
617  nlath, nlonh, jsh, jeh, ish, ieh ) ! [OUT]
618 
619  if ( .not. any(tile_hit(1:tile_nmax) ) ) return
620 
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) )
626 
627  call file_tiledata_get_data( nlath, nlonh, & ! [IN]
628  lu100m_in_dir, & ! [IN]
629  global_ia, & ! [IN]
630  tile_nmax, & ! [IN]
631  tile_dlat, tile_dlon, & ! [IN]
632  tile_fname(:), tile_hit(:), & ! [IN]
633  tile_js(:), tile_je(:), tile_is(:), tile_ie(:), & ! [IN]
634  jsh, jeh, ish, ieh, & ! [IN]
635  "REAL4", & ! [IN]
636  landuse(:,:), lath(:,:), lonh(:,:), & ! [OUT]
637  min_value = -999 ) ! [IN]
638 
639  call mapprojection_lonlat2xy( nlonh, 1, nlonh, nlath, 1, nlath, &
640  lonh(:,:), lath(:,:), & ! [IN]
641  xh(:,:), yh(:,:) ) ! [OUT]
642 
643  limit = ( tile_dlat * radius * 1.5_rp )**2
644  !$omp parallel do collapse(2) &
645  !$omp private(hit,no_hit_x,lu,p,dmin,min_i,min_j,d)
646  do j = 1, ja
647  do i = 1, ia
648  hit = .false.
649  dmin = d_large
650  min_i = -1
651  min_j = -1
652  do jj = 1, nlath
653  no_hit_x = .true.
654  do ii = 1, nlonh
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
657  no_hit_x = .false.
658  lu = landuse(ii,jj)
659  if ( lu /= undef2 ) then
660  p = lookuptable( max(0,lu) ) ! -999 to 0
661  pft_weight(p,i,j) = pft_weight(p,i,j) + 1.0_rp
662  hit = .true.
663  cycle
664  end if
665  end if
666  d = ( xh(ii,jj)-cx(i) )**2 + ( yh(ii,jj)-cy(j) )**2
667  lu = landuse(ii,jj)
668  if ( d < dmin .and. lu /= undef2 ) then
669  dmin = d
670  min_i = ii
671  min_j = jj
672  end if
673  end do
674  if ( hit .and. no_hit_x ) exit
675  end do
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) ) ! -999 to 0
680  pft_weight(p,i,j) = 1.0_rp
681  end if
682  end if
683  end do
684  end do
685 
686  deallocate( landuse, lath, lonh, yh, xh )
687 
688  return
689  end subroutine cnvlanduse_lu100m
690 
691  !-----------------------------------------------------------------------------
693  subroutine cnvlanduse_jibis( PFT_weight )
694  use scale_landuse, only: &
696  implicit none
697 
698  real(RP), intent(inout) :: PFT_weight(-2:landuse_pft_nmax,ia,ja)
699  !---------------------------------------------------------------------------
700 
701  return
702  end subroutine cnvlanduse_jibis
703 
704 end module mod_cnvlanduse
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]
Definition: scale_const.F90:44
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.
Definition: scale_io.F90:55
real(rp), public const_d2r
degree to radian
Definition: scale_const.F90:32
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 TRACER
module LANDUSE
module atmosphere / grid / cartesC index
module file_tiledata
module PROCESS
Definition: scale_prc.F90:11
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)
Definition: scale_const.F90:38
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.
Definition: scale_prc.F90:338
module CONSTANT
Definition: scale_const.F90:11
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
module profiler
Definition: scale_prof.F90:11
subroutine, public cnvlanduse_setup
Setup.
real(rp), public const_eps
small number
Definition: scale_const.F90:33
real(rp), dimension(:,:), allocatable, public landuse_frac_lake
lake fraction
module Atmosphere GRID CartesC Real(real space)
module Map projection
real(rp), dimension(:,:), allocatable, public atmos_grid_cartesc_real_area
horizontal area ( xy, normal z) [m2]
logical, public cnvlanduse_uselu100m
module PRECISION
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]
module STDIO
Definition: scale_io.F90:10
logical, public cnvlanduse_donothing
real(rp), dimension(:,:), allocatable, public landuse_frac_land
land fraction
module SORT
Definition: scale_sort.F90:11