Changeset 4794 for palm


Ignore:
Timestamp:
Nov 24, 2020 10:40:20 AM (4 years ago)
Author:
maronga
Message:

use negative numbers for tree ids and tree types for vegetation patches

Location:
palm/trunk/SCRIPTS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_csd

    r4793 r4794  
    2525# -----------------
    2626# $Id$
     27# Removed debug output; assign negative ids for tree patches
     28#
     29# 4793 2020-11-24 09:48:21Z maronga
    2730# Added output of tree_type (species or classification). Added tree_id for
    2831# vegetation patches. Allow for overlapping vegetation with buildings
     
    11051108         lai = nc_read_from_file_2d(input_file_lai[ii[i]], 'Band1', domain_x0[i], domain_x1[i], domain_y0[i], domain_y1[i])   
    11061109   
    1107          nc_write_to_file_2d(filename[i], 'patch_height', patch_height, datatypes["tree_data"],'y','x',fillvalues["tree_data"])
    1108          nc_write_attribute(filename[i], 'patch_height', 'long_name', 'tree type')
    1109          nc_write_attribute(filename[i], 'patch_height', 'units', '')
    1110          nc_write_attribute(filename[i], 'patch_height', 'res_orig', domain_px[i]) 
    1111          nc_write_attribute(filename[i], 'patch_height', 'coordinates', 'E_UTM N_UTM lon lat')
    1112          nc_write_attribute(filename[i], 'patch_height', 'grid_mapping', 'E_UTM N_UTM lon lat')     
    11131110
    11141111#        Determine all pixels that do not already have an LAD but which are high vegetation to a dummy value of 1.0 and remove all other pixels
     
    11531150            lad_patch, patch_id, patch_types, patch_nz, status = process_patch(domain_dz[i],patch_height,vegetation_type,max(zlad),lai_high,settings_lai_alpha,settings_lai_beta)
    11541151
    1155 #           Increase the patch ids by the maximum id for street trees to avoid double ids
    1156             max_id = max(tree_id.flatten())
    1157             patch_id = np.where( patch_id != fillvalues["tree_id"], patch_id+max_id, patch_id)
     1152#           Set negative ids for patches
     1153            patch_id = np.where( patch_id != fillvalues["tree_id"], -patch_id, patch_id)
    11581154
    11591155#           2D loop in order to avoid memory problems with large arrays
  • palm/trunk/SCRIPTS/palm_csd_files/palm_csd_canopy_generator.py

    r4793 r4794  
    2525# -----------------
    2626# $Id: palm_csd_canopy_generator.py 3773 2019-03-01 08:56:57Z maronga $
     27# tree_type for patches is now considered by negative values accrordng to the
     28# vegetation_type classification
     29#
     30# 3773 2019-03-01 08:56:57Z maronga
    2731# Bugfix: do not allow BAD < 0, revised treatment of tree trunks
    2832#
     
    550554      vegetation_type_int = vegetation_type.astype(int)
    551555      patch_id[k,:,:]   = np.where((patch_id_2d != 0) & (lad_loc[k,:,:] != fillvalues["tree_data"]), patch_id_2d, fillvalues["tree_id"])
    552       patch_type[k,:,:] = np.where((patch_id_2d != 0) & (lad_loc[k,:,:] != fillvalues["tree_data"]), np.byte(100+vegetation_type), fillvalues["tree_type"])
     556      patch_type[k,:,:] = np.where((patch_id_2d != 0) & (lad_loc[k,:,:] != fillvalues["tree_data"]), np.byte(-vegetation_type), fillvalues["tree_type"])
    553557
    554558   return lad_loc, patch_id, patch_type, nz, 0
Note: See TracChangeset for help on using the changeset viewer.