Changeset 3955 for palm/trunk/SCRIPTS


Ignore:
Timestamp:
May 7, 2019 9:55:25 AM (6 years ago)
Author:
maronga
Message:

bugfixes in palm_csd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_csd

    r3859 r3955  
    2525# -----------------
    2626# $Id$
     27# Bugfix in preparaing of green roofs
     28# Bugfix: remove LAI for bare soils
     29#
     30# 3859 2019-04-03 20:30:31Z maronga
    2731# Bugfix: wrong variable naming for 'y'
    2832#
     
    100104   global settings_lai_alpha
    101105   global settings_lai_beta
     106   global settings_veg_type_below_trees
    102107   global ndomains
    103108
     
    180185
    181186   settings_bridge_width = 3.0
    182    settings_lai_roof_intensive = 0.5
    183    settings_lai_roof_extensive = 1.0
     187   settings_lai_roof_intensive = 2.5
     188   settings_lai_roof_extensive = 0.8
    184189   settings_season = "summer"
    185190   settings_lai_high_default = 6.0
     
    188193   settings_lai_alpha = 5.0
    189194   settings_lai_beta = 3.0
     195   settings_veg_type_below_trees = 3
    190196   ndomains = 0
    191197
     
    295301         settings_lai_alpha = float(config.get(read_tmp, 'lai_alpha'))
    296302         settings_lai_beta = float(config.get(read_tmp, 'lai_beta'))
     303         settings_veg_type_below_trees = config.get(read_tmp, 'vegetation_type_below_trees') 
    297304
    298305      if ( read_tmp == 'output' ):
     
    886893
    887894#     assign green fraction on roofs
    888       building_pars[3,:,:] = np.where( (buildings_2d != fillvalues["buildings_2d"] ) & ( green_roofs != fillvalues["building_pars"] ),1.0,fillvalues["building_pars"])
     895      building_pars[3,:,:] = np.where( ( buildings_2d != fillvalues["buildings_2d"] ) & ( green_roofs != fillvalues["building_pars"] ) & ( green_roofs != 0.0 ),1,fillvalues["building_pars"] )
    889896
    890897#     assign leaf area index for vegetation on roofs
    891       building_pars[4,:,:] = np.where( ( buildings_2d != fillvalues["buildings_2d"] ) & ( green_roofs == 1.0 ),settings_lai_roof_intensive,fillvalues["building_pars"])
    892       building_pars[4,:,:] = np.where( ( buildings_2d != fillvalues["buildings_2d"] ) & ( green_roofs == 2.0 ),settings_lai_roof_extensive,building_pars[4,:,:])
     898      building_pars[4,:,:] = np.where( ( buildings_2d != fillvalues["buildings_2d"] ) & ( green_roofs >= 0.5 ),settings_lai_roof_intensive,fillvalues["building_pars"])
     899      building_pars[4,:,:] = np.where( ( buildings_2d != fillvalues["buildings_2d"] ) & ( green_roofs < 0.5 ),settings_lai_roof_extensive,building_pars[4,:,:])
    893900   
    894901   
     
    10741081
    10751082#     Remove high vegetation wherever it is replaced by a leaf area density. This should effectively remove all high vegetation pixels
    1076       vegetation_type = np.where((lad[0,:,:] != fillvalues["tree_data"]) & (vegetation_type != fillvalues["vegetation_type"]),3,vegetation_type)
     1083      vegetation_type = np.where((lad[0,:,:] != fillvalues["tree_data"]) & (vegetation_type != fillvalues["vegetation_type"]),settings_veg_type_below_trees,vegetation_type)
    10771084             
    10781085#     If desired, remove all high vegetation. TODO: check if this is still necessary
     
    10881095
    10891096#     Remove lai for pixels that have no vegetation_type
    1090       lai_low = np.where( vegetation_type != fillvalues["vegetation_type"], lai_low, fillvalues["tree_data"])
     1097      lai_low = np.where( ( (vegetation_type != fillvalues["vegetation_type"]) & (vegetation_type != 1) ), lai_low, fillvalues["tree_data"])
    10911098       
    10921099#     Overwrite lai in vegetation_parameters 
     
    11011108     
    11021109      del vegetation_type, lad, lai, patch_height, vegetation_pars, zlad
     1110
     1111
     1112# Final adjustment of vegetation parameters: remove LAI where a bare soil was set
     1113for i in range(0,ndomains):
     1114   
     1115      vegetation_type = nc_read_from_file_2d_all(filename[i], 'vegetation_type')
     1116      vegetation_pars = nc_read_from_file_3d_all(filename[i], 'vegetation_pars')
     1117      lai = vegetation_pars[1,:,:]   
     1118     
     1119     
     1120#     Remove lai for pixels that have no vegetation_type
     1121      lai = np.where( ( (vegetation_type != fillvalues["vegetation_type"]) & (vegetation_type != 1) ), lai, fillvalues["tree_data"])
     1122       
     1123#     Overwrite lai in vegetation_parameters 
     1124      vegetation_pars[1,:,:] = np.copy(lai)
     1125      nc_overwrite_to_file_3d(filename[i], 'vegetation_pars', vegetation_pars)
     1126     
     1127      del vegetation_type, lai, vegetation_pars
     1128
    11031129
    11041130# Final consistency check
Note: See TracChangeset for help on using the changeset viewer.