def getData(self):
        for filepath in self.filenames:
            filename = os.path.basename(filepath)
            lvis = lvisGround(filepath)
            # set elevation
            lvis.setElevations()
            # find the ground (repeating some of the last three lines)
            lvis.estimateGround()
            lvis.reproject(4326, 3857)

            pd.DataFrame({
                'lat': np.array(lvis.lat),
                'lon': np.array(lvis.lon),
                'z': np.array(lvis.zG)
            }).to_csv(os.path.join('../data/2009/',
                                   ''.join(filename.split('.')[:-1]) + '.csv'),
                      index=False)
示例#2
0
'''
An example of how to use the 
LVIS python scripts
'''

from processLVIS import lvisGround

if __name__ == "__main__":
    '''Main block'''

    #filename='/geos/netdata/avtrain/data/3d/oosa/week4/lvis_antarctica/ILVIS1B_AQ2015_1014_R1605_070717.h5'
    filename = '/Users/dill/data/teaching/oosa/week4/lvis/ILVIS1B_AQ2015_1014_R1605_071915.h5'

    # find bounds
    b = lvisGround(filename, onlyBounds=True)

    # set some bounds
    x0 = b.bounds[0]
    y0 = b.bounds[1]
    x1 = (b.bounds[2] - b.bounds[0]) / 15 + b.bounds[0]
    y1 = (b.bounds[3] - b.bounds[1]) / 15 + b.bounds[1]

    # read in bounds
    lvis = lvisGround(filename, minX=x0, minY=y0, maxX=x1, maxY=y1)

    # set elevation
    lvis.setElevations()

    # denoise test
    lvis.findStats()
    threshold = lvis.meanNoise + 5 * lvis.stdevNoise
    tiffhandler = tiffHandle(minx, miny, maxx, maxy)
    tiffhandler.writeTiff(data, filename=outputpath, epsg=3857)

    print("finished")


if __name__ == "__main__":
    if len(sys.argv) != 4:
        print(instructions)
        exit(1)

    filepath = sys.argv[1]
    resolution = int(sys.argv[2])
    outputpath = sys.argv[3]

    lvisData = lvisGround(filepath)
    lvisData.setElevations()
    lvisData.estimateGround()
    lvisData.reproject(4326, 3857)
    lat = np.array(lvisData.lat)
    lon = np.array(lvisData.lon)
    z = np.array(lvisData.zG)
    point_list = np.array([lat, lon, z]).T
    minx, miny, maxx, maxy = lvisData.dumpBounds()

    minx = int(minx)
    miny = int(miny)
    maxx = int(maxx)
    maxy = int(maxy)

    data = []