73 private :: landuse_read
79 character(len=H_LONG),
private :: landuse_in_basename =
'' 80 logical,
private :: landuse_in_aggregate
81 logical,
private :: landuse_in_check_coordinates = .true.
82 character(len=H_LONG),
private :: landuse_out_basename =
'' 83 logical,
private :: landuse_out_aggregate
84 character(len=H_MID),
private :: landuse_out_title =
'SCALE-RM LANDUSE' 85 character(len=H_SHORT),
private :: landuse_out_dtype =
'DEFAULT' 86 logical,
private :: landuse_allocean = .false.
87 logical,
private :: landuse_allland = .false.
88 logical,
private :: landuse_allurban = .false.
89 logical,
private :: landuse_alllake = .false.
90 logical,
private :: landuse_ignore_lake = .false.
91 logical,
private :: landuse_mosaicworld = .false.
107 logical,
intent(in) :: OCEAN_do
108 logical,
intent(in) :: URBAN_do
109 logical,
intent(in) :: LAKE_do
111 namelist / param_landuse / &
112 landuse_in_basename, &
113 landuse_in_aggregate, &
114 landuse_in_check_coordinates, &
115 landuse_out_basename, &
116 landuse_out_aggregate, &
124 landuse_ignore_lake, &
131 log_info(
"LANDUSE_setup",*)
'Setup' 140 log_info(
"LANDUSE_setup",*)
'Not found namelist. Default used.' 141 elseif( ierr > 0 )
then 142 log_error(
"LANDUSE_setup",*)
'Not appropriate names in namelist PARAM_LANDUSE. Check!' 145 log_nml(param_landuse)
180 if ( landuse_allocean )
then 182 log_info(
"LANDUSE_setup",*)
'Assume all grids are ocean' 186 elseif( landuse_allland )
then 188 log_info(
"LANDUSE_setup",*)
'Assume all grids are land' 189 log_info(
"LANDUSE_setup",*)
'Assume land PFT is 1 (bare ground)' 194 elseif( landuse_allurban )
then 196 log_info(
"LANDUSE_setup",*)
'Assume all grids are land' 197 log_info(
"LANDUSE_setup",*)
'Assume all lands are urban' 205 elseif( landuse_alllake )
then 207 log_info(
"LANDUSE_setup",*)
'Assume all grids are land' 208 log_info(
"LANDUSE_setup",*)
'Assume all lands are lake' 216 elseif( landuse_mosaicworld )
then 218 log_info(
"LANDUSE_setup",*)
'Assume all grids have ocean, land, and urban' 220 log_info(
"LANDUSE_setup",*)
'Assume land PFT is 1 (bare ground)' 229 call landuse_read( ocean_do, urban_do, lake_do )
241 real(RP) :: fact_soil
246 log_info(
"LANDUSE_calc_fact",*)
'calculate landuse factor' 276 logical,
intent(in),
optional :: FILL_BND
278 real(RP) :: temp(
ia,
ja)
285 if (
present(fill_bnd) ) fill_bnd_ = fill_bnd
304 temp(:,:) =
real(LANDUSE_index_PFT(:,:,p),kind=
rp)
307 call comm_vars8( temp(:,:) , 9+2*(p-1) )
310 call comm_wait ( temp(:,:) , 9+2*(p-1), fill_bnd_ )
320 subroutine landuse_read( &
328 file_cartesc_check_coordinates, &
334 logical,
intent(in) :: OCEAN_do
335 logical,
intent(in) :: URBAN_do
336 logical,
intent(in) :: LAKE_do
338 real(RP) :: temp(
ia,
ja)
340 character(len=H_SHORT) :: varname
347 log_info(
"LANDUSE_read",*)
'Input landuse file ' 349 if ( landuse_in_basename /=
'' )
then 351 call file_cartesc_open( landuse_in_basename, fid, aggregate=landuse_in_aggregate )
360 write(varname,
'(A8,I1.1)')
'FRAC_PFT', p
364 write(varname,
'(A9,I1.1)')
'INDEX_PFT', p
366 call file_cartesc_read( fid, varname,
'XY', temp(:,:) )
376 if ( landuse_in_check_coordinates )
then 377 call file_cartesc_check_coordinates( fid )
389 log_error(
"LANDUSE_read",*)
'LANDUSE_frac_land is invalid: ', i,j,
landuse_frac_land(i,j)
393 log_error(
"LANDUSE_read",*)
'LANDUSE_frac_lake is invalid: ', i,j,
landuse_frac_lake(i,j)
397 log_error(
"LANDUSE_read",*)
'LANDUSE_frac_urban is invalid: ', i,j,
landuse_frac_urban(i,j)
426 if ( .not. urban_do )
then 446 if ( .not. lake_do )
then 447 if ( landuse_ignore_lake .or. (.not. ocean_do) )
then 473 log_error(
"LANDUSE_read",*)
'Not appropriate original landuse (w/ Lake). Bug!',i,j
480 log_error(
"LANDUSE_read",*)
'Not appropriate replaced landuse (w/o Lake). Bug!',i,j
491 log_info_cont(*)
'landuse file is not specified.' 492 log_info_cont(*)
'Assume all grids are ocean' 496 end subroutine landuse_read
505 file_cartesc_write_var, &
509 real(RP) :: temp(
ia,
ja)
512 character(len=H_SHORT) :: varname
518 if ( landuse_out_basename /=
'' .and. landuse_out_basename /= landuse_in_basename )
then 521 log_info(
"LANDUSE_write",*)
'Output landuse file ' 527 haszcoord=.false., aggregate=landuse_out_aggregate )
529 call file_cartesc_def_var( fid,
'FRAC_LAND' ,
'LAND fraction' ,
'1',
'XY', landuse_out_dtype, vid(1), standard_name=
"land_area_fraction" )
530 call file_cartesc_def_var( fid,
'FRAC_LAKE' ,
'LAKE fraction' ,
'1',
'XY', landuse_out_dtype, vid(2) )
531 call file_cartesc_def_var( fid,
'FRAC_URBAN' ,
'URBAN fraction' ,
'1',
'XY', landuse_out_dtype, vid(3) )
532 call file_cartesc_def_var( fid,
'FRAC_OCEAN_abs',
'absolute OCEAN fraction',
'1',
'XY', landuse_out_dtype, vid(4) )
533 call file_cartesc_def_var( fid,
'FRAC_LAND_abs' ,
'absolute LAND fraction' ,
'1',
'XY', landuse_out_dtype, vid(5) )
534 call file_cartesc_def_var( fid,
'FRAC_URBAN_abs',
'absolute URBAN fraction',
'1',
'XY', landuse_out_dtype, vid(6) )
535 call file_cartesc_def_var( fid,
'FRAC_LAKE_abs' ,
'absolute LAKE fraction' ,
'1',
'XY', landuse_out_dtype, vid(7) )
538 write(varname,
'(A8,I1.1)')
'FRAC_PFT', p
539 call file_cartesc_def_var( fid, varname,
'PFT fraction',
'1',
'XY', landuse_out_dtype, vid(8+2*(p-1)) )
540 write(varname,
'(A9,I1.1)')
'INDEX_PFT', p
541 call file_cartesc_def_var( fid, varname,
'PFT index',
'1',
'XY', landuse_out_dtype, vid(9+2*(p-1)) )
546 call file_cartesc_write_var( fid, vid(1),
landuse_frac_land(:,:),
'FRAC_LAND' ,
'XY' )
547 call file_cartesc_write_var( fid, vid(2),
landuse_frac_lake(:,:),
'FRAC_LAKE' ,
'XY' )
548 call file_cartesc_write_var( fid, vid(3),
landuse_frac_urban(:,:),
'FRAC_URBAN' ,
'XY' )
549 call file_cartesc_write_var( fid, vid(4),
landuse_fact_ocean(:,:),
'FRAC_OCEAN_abs',
'XY' )
550 call file_cartesc_write_var( fid, vid(5),
landuse_fact_land(:,:),
'FRAC_LAND_abs' ,
'XY' )
551 call file_cartesc_write_var( fid, vid(6),
landuse_fact_urban(:,:),
'FRAC_URBAN_abs',
'XY' )
552 call file_cartesc_write_var( fid, vid(7),
landuse_fact_lake(:,:),
'FRAC_LAKE_abs' ,
'XY' )
555 write(varname,
'(A8,I1.1)')
'FRAC_PFT', p
556 call file_cartesc_write_var( fid, vid(8+2*(p-1)),
landuse_frac_pft(:,:,p), varname,
'XY' )
557 write(varname,
'(A9,I1.1)')
'INDEX_PFT', p
558 temp(:,:) =
real(LANDUSE_index_PFT(:,:,p),kind=
rp)
559 call file_cartesc_write_var( fid, vid(9+2*(p-1)), temp(:,:), varname,
'XY' )
real(rp), dimension(:,:,:), allocatable, public landuse_frac_pft
fraction of PFT for each mosaic
real(rp), dimension(:,:), allocatable, public landuse_fact_urban
urban factor
subroutine, public landuse_setup(OCEAN_do, URBAN_do, LAKE_do)
Setup.
integer, parameter, public landuse_index_ocean
ocean index
integer, public ia
of whole cells: x, local, with HALO
subroutine, public landuse_fillhalo(FILL_BND)
HALO Communication.
integer, parameter, public landuse_index_urban
urban index
logical, public file_aggregate
subroutine, public landuse_calc_fact
integer, public ja
of whole cells: y, local, with HALO
integer, public io_fid_conf
Config file ID.
real(rp), dimension(:,:), allocatable, public landuse_frac_urban
urban fraction
logical, dimension(:,:), allocatable, public landuse_exists_lake
lake calculation flag
logical, dimension(:,:), allocatable, public landuse_exists_land
land calculation flag
integer, parameter, public landuse_pft_nmin
minimum number of PFT type
integer, public is
start point of inner domain: x, local
integer, public ie
end point of inner domain: x, local
subroutine, public file_cartesc_create(basename, title, datatype, fid, date, subsec, haszcoord, append, aggregate, single)
Create/open a netCDF file.
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 landuse_fact_ocean
ocean factor
subroutine, public file_cartesc_enddef(fid)
Exit netCDF file define mode.
integer, public landuse_pft_mosaic
number of PFT mosaic
real(rp), dimension(:,:), allocatable, public landuse_fact_lake
lake factor
integer, dimension(:,:,:), allocatable, public landuse_index_pft
index of PFT for each mosaic
subroutine, public prc_abort
Abort Process.
integer, public js
start point of inner domain: y, local
subroutine, public file_cartesc_def_var(fid, varname, desc, unit, dim_type, datatype, vid, standard_name, timeintv, nsteps, cell_measures)
Define a variable to file.
logical, dimension(:,:), allocatable, public landuse_exists_ocean
ocean calculation flag
real(rp), dimension(:,:), allocatable, public landuse_frac_lake
lake fraction
integer, public landuse_pft_nmax
number of plant functional type(PFT)
real(rp), dimension(:,:), allocatable, public landuse_fact_land
land factor
subroutine, public file_cartesc_flush(fid)
Flush all pending requests to a netCDF file (PnetCDF only)
logical, dimension(:,:), allocatable, public landuse_exists_urban
urban calculation flag
integer, parameter, public rp
subroutine, public file_cartesc_open(basename, fid, aggregate)
open a netCDF file for read
integer, parameter, public landuse_index_lake
lake index
real(rp), dimension(:,:), allocatable, public landuse_frac_land
land fraction
subroutine, public file_cartesc_close(fid)
Close a netCDF file.