xi, yi = np.arange(x.min(), x.max()+res/2, res), np.arange(y.min(), y.max()+res/2, res) extent = [xi.min(), xi.max(), yi.min(), yi.max()] # only used to set extent to plots grid = np.zeros((len(yi),len(xi)))*np.NaN # retreive gridcell border coordinates bx, by = gridcellborders(xi,yi,res) # georeferencing info geotransform = (x.min(), res, 0, y.max(), 0, -res) # used for georeference metadata in geotiff proj = '' # mandatory setting used to store projection information in metadata geotiff (not assigned as metadata is not stored in lidar txt) # dtm if os.path.isfile(fn_dtm) == True: # load dtm from generic_tools import openimg dtm, _,_,_,_,_ = openimg(fn_dtm) dtm = np.flipud(dtm) else: # create dtm from dtm import createDTM g = c == 2 dtm = createDTM(x[g],y[g],z[g],xi,yi,res,geotransform, proj, method='idw') saveimg(np.flipud(dtm), fn_dtm , len(xi), len(yi), geotransform, proj) # dsm if os.path.isfile(fn_dsm) == True: # load dsm from generic_tools import openimg dsm, _,_,_,_,_ = openimg(fn_dsm) dsm = np.flipud(dsm) else: # create dsm
xi, yi = np.arange(x.min(), x.max() + res / 2, res), np.arange(y.min(), y.max() + res / 2, res) extent = [xi.min(), xi.max(), yi.min(), yi.max()] # only used to set extent to plots grid = np.zeros((len(yi), len(xi))) * np.NaN # retreive gridcell border coordinates bx, by = gridcellborders(xi, yi, res) # georeferencing info geotransform = (x.min(), res, 0, y.max(), 0, -res) # used for georeference metadata in geotiff proj = ( "" ) # mandatory setting used to store projection information in metadata geotiff (not assigned as metadata is not stored in lidar txt) # create dtm try: dtm, _, _, _, _, _ = openimg(basename + "_dtm.tif") except: from dtm import createDTM g = c == 2 dtm = createDTM(x[g], y[g], z[g], xi, yi, res, geotransform, proj, method="idw") # create dsm try: dtm, _, _, _, _, _ = openimg(basename + "_dsm.tif") except: from dsm import createDSM dsm = createDSM(x, y, z, xi, yi, bx, by, res, geotransform, proj) # create chm