Changeset 3773 for palm


Ignore:
Timestamp:
Mar 1, 2019 8:56:57 AM (5 years ago)
Author:
maronga
Message:

added output of theta_2m_av and minor revisions in palm_csd

Location:
palm/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_csd

    r3726 r3773  
    2525# -----------------
    2626# $Id$
     27# Unspecificed changes
     28#
     29# 3726 2019-02-07 18:22:49Z maronga
    2730# Removed some more bugs
    2831#
     
    521524      tmp_x1 = int( domain_x1[i] * domain_px[i] / domain_px[parent_id] ) + 1
    522525      tmp_y1 = int( domain_y1[i] * domain_px[i] / domain_px[parent_id] ) + 1
    523       print(tmp_x0)
    524       print(tmp_x1)     
    525       print(tmp_y0)
    526       print(tmp_y1) 
    527526
    528527      tmp_x = nc_read_from_file_1d(input_file_x[ii_parent[i]], "x", tmp_x0, tmp_x1)
     
    539538     
    540539#     Shift the child terrain height according to the parent mean terrain height
     540      print("shifting: -" + str(np.mean(zt)) + " +" + str(np.mean(zt_ip)))
     541      #zt = zt - np.min(zt) + np.min(zt_ip)
    541542      zt = zt - np.mean(zt) + np.mean(zt_ip)
    542543 
     
    544545#     Blend over the parent and child terrain height within a radius of 50 px 
    545546      zt = blend_array_2d(zt,zt_ip,50)
     547     # zt = zt_ip
    546548   
    547549#  Final step: add zt array to the global array   
     
    714716
    715717   building_type = nc_read_from_file_2d_all(filename[i], 'building_type')
    716     
     718   
    717719   vegetation_type = nc_read_from_file_2d(input_file_vegetation_type[ii[i]], 'Band1', domain_x0[i], domain_x1[i], domain_y0[i], domain_y1[i])   
    718720   vegetation_type[vegetation_type == 255] = fillvalues["vegetation_type"]
     
    745747   pavement_type = np.where((pavement_type != fillvalues["pavement_type"]) & (building_type != fillvalues["building_type"]),fillvalues["pavement_type"],pavement_type) 
    746748
    747 #  #5 Remove pavement for pixels with water
    748    pavement_type = np.where((pavement_type != fillvalues["pavement_type"]) & (water_type != fillvalues["water_type"]),fillvalues["pavement_type"],pavement_type)  
    749 
     749#  #5 Remove pavement for pixels with water.
     750   pavement_type = np.where((pavement_type != fillvalues["pavement_type"]) & (water_type != fillvalues["water_type"]),fillvalues["pavement_type"],pavement_type)
     751   
    750752#  #6 Remove water for pixels with buildings
    751753   water_type = np.where((water_type != fillvalues["water_type"]) & (building_type != fillvalues["building_type"]),fillvalues["water_type"],water_type)
    752  
    753    
     754
    754755#  Correct vegetation_type when a vegetation height is available and is indicative of low vegeetation
    755756   vegetation_height = nc_read_from_file_2d(input_file_vegetation_height[ii[i]], 'Band1', domain_x0[i], domain_x1[i], domain_y0[i], domain_y1[i])   
     
    843844   street_type[street_type == 255] = fillvalues["street_type"]
    844845   street_type = np.where((street_type < 1) & (street_type != fillvalues["street_type"]),defaultvalues["street_type"],street_type)
    845    
     846
     847   pavement_type = nc_read_from_file_2d_all(filename[i], 'pavement_type')
     848   street_type = np.where((pavement_type == fillvalues["pavement_type"]),fillvalues["street_type"],street_type)
     849
    846850   nc_write_to_file_2d(filename[i], 'street_type', street_type, datatypes["street_type"],'y','x',fillvalues["street_type"])
    847851   nc_write_attribute(filename[i], 'street_type', 'long_name', 'street type')
  • palm/trunk/SCRIPTS/palm_csd_files/palm_csd_canopy_generator.py

    r3668 r3773  
    2525# -----------------
    2626# $Id$
     27# Bugfix: conversion to integer required for indexing
     28#
     29# 3668 2019-01-14 12:49:24Z maronga
    2730# Various improvements and bugfixes
    2831#
     
    302305
    303306#  Define center of the tree position inside the local LAD domain
    304    tree_location_x = x[nx/2]
    305    tree_location_y = y[nx/2]
     307   tree_location_x = x[int(nx/2)]
     308   tree_location_y = y[int(nx/2)]
    306309
    307310
  • palm/trunk/SCRIPTS/palm_csd_files/palm_csd_tools.py

    r3726 r3773  
    2525# -----------------
    2626# $Id$
     27# Unspecificed changes
     28#
     29# 3726 2019-02-07 18:22:49Z maronga
    2730# Index bound bugfix
    2831#
     
    9598            for k in range(1,len(k_tmp+1)):
    9699               if k_tmp[k] > array[m,l]:
    97                   array[m,l] = k_tmp[k-1]
     100                  array[m,l] = k_tmp[k-1] + dz * 0.5
    98101                  break
    99102
  • palm/trunk/SOURCE/average_3d_data.f90

    r3655 r3773  
    2525! -----------------
    2626! $Id$
     27! Added output of theta_2m*_xy_av
     28!
     29! 3655 2019-01-07 16:51:22Z knoop
    2730! Implementation of the PALM module interface
    2831!
     
    436439             ENDIF
    437440
     441         CASE ( 'theta_2m*' )
     442             IF ( ALLOCATED( tsurf_av ) ) THEN
     443                DO  i = nxlg, nxrg
     444                   DO  j = nysg, nyng
     445                      pt_2m_av(j,i) = pt_2m_av(j,i) / REAL( average_count_3d, KIND=wp )
     446                   ENDDO
     447                ENDDO
     448                CALL exchange_horiz_2d( pt_2m_av, nbgp )
     449             ENDIF
     450             
    438451          CASE ( 't*' )
    439452             IF ( ALLOCATED( ts_av ) ) THEN
  • palm/trunk/SOURCE/sum_up_3d_data.f90

    r3761 r3773  
    2525! -----------------
    2626! $Id$
     27! Added output of theta_2m*_xy_av
     28!
     29! 3761 2019-02-25 15:31:42Z raasch
    2730! unused variables removed
    2831!
     
    920923             ENDIF
    921924
     925          CASE ( 'theta_2m*' )
     926             IF ( ALLOCATED( pt_2m_av ) ) THEN   
     927                DO  i = nxl, nxr
     928                   DO  j = nys, nyn
     929                      match_def = surf_def_h(0)%start_index(j,i) <=            &
     930                                  surf_def_h(0)%end_index(j,i)
     931                      match_lsm = surf_lsm_h%start_index(j,i) <=               &
     932                                  surf_lsm_h%end_index(j,i)
     933                      match_usm = surf_usm_h%start_index(j,i) <=               &
     934                                  surf_usm_h%end_index(j,i)
     935
     936                      IF ( match_def )  THEN
     937                         m = surf_def_h(0)%end_index(j,i)
     938                         pt_2m_av(j,i) = pt_2m_av(j,i) +                       &
     939                                         surf_def_h(0)%pt_2m(m)
     940                      ELSEIF ( match_lsm  .AND.  .NOT. match_usm )  THEN
     941                         m = surf_lsm_h%end_index(j,i)
     942                        pt_2m_av(j,i) = pt_2m_av(j,i) +                       &
     943                                         surf_lsm_h%pt_2m(m)
     944                      ELSEIF ( match_usm )  THEN
     945                         m = surf_usm_h%end_index(j,i)
     946                         pt_2m_av(j,i) = pt_2m_av(j,i) +                       &
     947                                         surf_usm_h%pt_2m(m)
     948                      ENDIF
     949                   ENDDO
     950                ENDDO
     951             ENDIF
     952             
     953             
    922954          CASE ( 't*' )
    923955             IF ( ALLOCATED( ts_av ) ) THEN
Note: See TracChangeset for help on using the changeset viewer.