Ignore:
Timestamp:
Jan 22, 2019 10:44:20 AM (5 years ago)
Author:
maronga
Message:

bugfixes in palm_csd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_csd

    r3668 r3688  
    2525# -----------------
    2626# $Id$
     27# Some unspecified bugfixes
     28#
     29# 3668 2019-01-14 12:49:24Z maronga
    2730# Various improvements and bugfixes
    2831#
     
    4346# @todo Allow for ASCII input of terrain height and building height
    4447# @todo Modularize reading config file
     48# @todo Convert to object-oriented treatment (buidings, trees)
     49# @todo Automatically shift child domains so that their origin lies intersects
     50#       a edge note of the parent grid
    4551#------------------------------------------------------------------------------#
    4652
     
    457463
    458464
    459    x_UTM = nc_read_from_file_2d(input_file_x[ii[i]], "Band1", domain_x0[i], domain_x0[i], domain_y0[i], domain_y0[i])
    460    y_UTM = nc_read_from_file_2d(input_file_y[ii[i]], "Band1", domain_x0[i], domain_x0[i], domain_y0[i], domain_y0[i])
     465   x_UTM = nc_read_from_file_2d(input_file_x[ii[i]], "Band1", domain_x0[i], domain_x0[i], domain_y0[i], domain_y0[i]) - 0.5 * domain_px[i]
     466   y_UTM = nc_read_from_file_2d(input_file_y[ii[i]], "Band1", domain_x0[i], domain_x0[i], domain_y0[i], domain_y0[i]) - 0.5 * domain_px[i]
    461467   lat = nc_read_from_file_2d(input_file_lat[ii[i]], "Band1", domain_x0[i], domain_x0[i], domain_y0[i], domain_y0[i])
    462468   lon = nc_read_from_file_2d(input_file_lon[ii[i]], "Band1", domain_x0[i], domain_x0[i], domain_y0[i], domain_y0[i]) 
     
    466472   nc_write_global_attributes(filename[i],float(x_UTM[0,0]),float(y_UTM[0,0]),float(lat[0,0]),float(lon[0,0]),"",global_acronym,global_angle,global_author,global_campaign,global_comment,global_contact,global_data_content,global_dependencies,global_institution,global_keywords,global_location,global_palm_version,global_references,global_site,global_source,version_out)
    467473
     474   del x_UTM, y_UTM, lat, lon
    468475   
    469476# Process terrain height
     
    596603for i in range(0,ndomains): 
    597604   buildings_2d = nc_read_from_file_2d(input_file_buildings_2d[ii[i]], 'Band1', domain_x0[i], domain_x1[i], domain_y0[i], domain_y1[i])
    598    
     605
    599606   building_id = nc_read_from_file_2d(input_file_building_id[ii[i]], 'Band1', domain_x0[i], domain_x1[i], domain_y0[i], domain_y1[i]) 
    600607 
     
    615622      print("Data check #2 " + str(check_arrays_2(buildings_2d,building_type,fillvalues["buildings_2d"],fillvalues["building_type"])))
    616623 
    617  
     624
    618625   nc_write_to_file_2d(filename[i], 'buildings_2d', buildings_2d, datatypes["buildings_2d"],'y','x',fillvalues["buildings_2d"])
    619626   nc_write_attribute(filename[i], 'buildings_2d', 'long_name', 'buildings')
     
    637644   nc_write_attribute(filename[i], 'building_type', 'coordinates', 'E_UTM N_UTM lon lat')
    638645   nc_write_attribute(filename[i], 'building_type', 'grid_mapping', 'E_UTM N_UTM lon lat')   
    639  
    640    print("out_1: " + str(np.any(building_type == -2)))
    641646 
    642647del buildings_2d
     
    10131018      lai = vegetation_pars[1,:,:]
    10141019
    1015 
    10161020#     Determine all pixels that do not already have and LAD but which are high vegetation to a dummy value of 1.0 and remove all other pixels
    10171021      lai_high = np.where( (lad[0,:,:] == fillvalues["tree_data"]) & ( ( (vegetation_type == 4) | (vegetation_type == 5) | (vegetation_type == 6) |(vegetation_type == 7) | (vegetation_type == 17) | (vegetation_type == 18) ) & ( (patch_height == fillvalues["tree_data"]) | (patch_height >= domain_dz[i])) ),1.0,fillvalues["tree_data"])
     
    10431047             
    10441048#     If desired, remove all high vegetation. TODO: check if this is still necessary
    1045       if domain_high_vegetation[i]:
     1049      if not domain_high_vegetation[i]:
    10461050         vegetation_type = np.where((vegetation_type != fillvalues["vegetation_type"]) & ( (vegetation_type == 4) | (vegetation_type == 5) | (vegetation_type == 6) |(vegetation_type == 7) | (vegetation_type == 17) | (vegetation_type == 18) ),3,vegetation_type)   
    10471051
Note: See TracChangeset for help on using the changeset viewer.