Skip to content

Commit

Permalink
Commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
levisweetbreu committed Jul 14, 2022
1 parent d023b51 commit b91b6c8
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 144 deletions.
10 changes: 5 additions & 5 deletions NATURF/Binary.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from sys import exit
from math import ceil
from numpy import array, zeros, uint8, uint16, indices,empty, float64, \
isnan, ones, save, float32, double
isnan, ones, save, float32, double, amax
from skimage.draw import polygon
import osr
import pickle
Expand Down Expand Up @@ -344,7 +344,7 @@ def make_binary(name, path, tifDir, cenlat, cenlon, outputDir, id_field, height_
for i in range(len(fad_out2)):
for j in range(len(bldgsh)):
dbh[j][bldgsh[j] == double(names2[i])] += float(1) / float(len(fad_out2))

print(amax(dbh))
master = zeros((132, IMAGE_SIZE_X, IMAGE_SIZE_Y), dtype=float64)

master[0:15] = fadn[0:15]
Expand Down Expand Up @@ -453,11 +453,11 @@ def make_binary(name, path, tifDir, cenlat, cenlon, outputDir, id_field, height_
index.write(' dx=100.0\n')
index.write(' known_x=1\n')
index.write(' known_y=1\n')
index.write(' known_lat=38.794034\n')
index.write(' known_lon=-77.129474\n')
index.write(' known_lat=35.6936372\n')
index.write(' known_lon=-115.4739874\n')
index.write(' truelat1=45.5\n')
index.write(' truelat2=29.5\n')
index.write(' stdlon=-77.0\n')
index.write(' stdlon=-114.75\n')
index.write(' wordsize=4\n')
index.write(' endian=big\n')
index.write(' signed=no\n')
Expand Down
15 changes: 10 additions & 5 deletions NATURF/Parameter_Calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from Parameter_Definitions import *
from sys import exit
import math
from numpy import array, zeros, uint8, mean
from numpy import array, zeros, uint8, mean, set_printoptions, inf
from PIL import Image
import csv
import warnings
Expand Down Expand Up @@ -84,8 +84,10 @@ def calculate_parameters(path, tifDir, outputDir, name, height_field, id_field):

buils_ids = tifDir +'/Building_IDs.tif'
ids = Image.open(buils_ids)

#print(ids)
ids = array(ids)
#set_printoptions(threshold=inf)
#print(ids)


filename = "%s.csv" % name
Expand Down Expand Up @@ -143,13 +145,15 @@ def calculate_parameters(path, tifDir, outputDir, name, height_field, id_field):
bs21 = mean(bs2par_out[i]) # 1

for qw in range(15):

#print("Before", fad_out[i]['n'][qw])
fad_out[i]['n'][qw] = mean(fad_out[i]['n'][qw])
#print("After", fad_out[i]['n'][qw])
fad_out[i]['w'][qw] = mean(fad_out[i]['w'][qw])
fad_out[i]['s'][qw] = mean(fad_out[i]['s'][qw])
fad_out[i]['e'][qw] = mean(fad_out[i]['e'][qw])

fad1 = fad_out[i] # 15 * 4
#print(fad1)

fai_out[i]['n'] = mean(fai_out[i]['n'])
fai_out[i]['w'] = mean(fai_out[i]['w'])
Expand All @@ -175,8 +179,9 @@ def calculate_parameters(path, tifDir, outputDir, name, height_field, id_field):
rrl1 = rrl_out[i] # 4
rdh1 = rdh_out[i] # 4
mrl1 = mrl_out[i] # 4

paf = mean(builfrac_out[i])
#print(builfrac_out[i])
paf = mean(builfrac_out[i]) # Averages the building fraction over all vertical heights
#print(paf)

mdh1 = mean(mdh_out[i]) # 1?

Expand Down
Loading

0 comments on commit b91b6c8

Please sign in to comment.