コード例 #1
0
def debug():

    filepath = sys.argv[1]
    resolution = int(sys.argv[2])
    outputpath = sys.argv[3]
    lvis = pd.read_csv(filepath)
    lat = lvis.lat
    lon = lvis.lon
    z = lvis.z
    lon, lat = reproject(lat, lon, 4326, 3857)
    point_list = np.array([lat, lon, z]).T
    minx = min(lon)
    miny = min(lat)
    maxx = max(lon)
    maxy = max(lat)
    minx = int(minx)
    miny = int(miny)
    maxx = int(maxx)
    maxy = int(maxy)

    data = []

    LON = np.arange(minx, maxx, resolution)
    LAT = np.arange(miny, maxy, resolution)
    for x in LON:
        for y in LAT:
            data.append(interpolation(x, y, point_list, resolution))
    data = np.array(data).reshape((len(LON), len(LAT)))
    tiffhandler = tiffHandle(minx, miny, maxx, maxy)
    tiffhandler.writeTiff(data, filename=outputpath, epsg=3857)

    print("finished")
コード例 #2
0
# main
if __name__ == '__main__':
    # read the command line
    cmdargs = getCmdArgs()

    #sets filename as the input from the command line parser
    inName = cmdargs.inName
    res = cmdargs.res
    outName = cmdargs.outName
    bounds = cmdargs.bounds
    subset = cmdargs.subset

    # if using bounds
    if bounds == "Yes":
        #initialise class
        b = tiffHandle(inName, onlyBounds=True)

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

        #initialise class, reading in specified bounds
        lvis = tiffHandle(inName, minX=x0, minY=y0, maxX=x1, maxY=y1)

    else:
        #initialise class, using no bounds
        lvis = tiffHandle(inName)

    # set elevation
コード例 #3
0
#     def write_geotiff(self,res):
#         tiffHandle.writeTiff(self.zG,self.x,self.y)

if __name__ == '__main__':
    filename = '/geos/netdata/avtrain/data/3d/oosa/assignment/lvis/2009/ILVIS1B_AQ2009_1020_R1408_049700.h5'
    #filename = '/geos/netdata/avtrain/data/3d/oosa/assignment/lvis/2015/ILVIS1B_AQ2015_1017_R1605_069264.h5'

    # op = Lvis_to_geoTiff(filename)
    op = lvisGround(filename, onlyBounds=True)
    x0 = op.bounds[0]
    y0 = op.bounds[1]
    x1 = (op.bounds[2] - op.bounds[0]) / 15 + op.bounds[0]
    y1 = (op.bounds[3] - op.bounds[1]) / 15 + op.bounds[1]

    # read in bounds
    w = lvisGround(filename, minX=x0, minY=y0, maxX=x1, maxY=y1)
    w.reproject(4326, 3031)
    x = w.lon
    y = w.lat
    w.setElevations()
    maxX = np.max(x)
    minX = np.min(x)
    maxY = np.max(y)
    minY = np.min(y)
    zG = w.estimateGround()
    # insert the resolution
    res = 10
    lvis = tiffHandle(filename, maxX, minX, maxY, minY, res, x, y)
    new_filename = 'task1.tiff'
    lvis.writeTiff(zG, x, y, new_filename)
コード例 #4
0
    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 = []

    LON = np.arange(minx, maxx, resolution)
    LAT = np.arange(miny, maxy, resolution)
    for x in LON:
        for y in LAT:
            data.append(interpolation(x, y, point_list, resolution))
    data = np.array(data).reshape((len(LON), len(LAT)))
    tiffhandler = tiffHandle(minx, miny, maxx, maxy)
    tiffhandler.writeTiff(data, filename=outputpath, epsg=3857)

    print("finished")
コード例 #5
0
                      maxX=np.max(x)
                      minY=np.min(y)
                      maxY=np.max(y)
                    
                      res = 100
                    
                      nx=int((maxX-minX)/res+1)
                      ny=int((maxY-minY)/res+1)
                  else:
                      x = np.concatenate([x,c.lon])
                      y = np.concatenate([y,c.lat])
                      c.setElevations()
                      data = np.concatenate([data,c.estimateGround()])
                      
                      minX=np.min(x)
                      maxX=np.max(x)
                      minY=np.min(y)
                      maxY=np.max(y)
                    
                      res = 100
                      
                      nx=int((maxX-minX)/res+1)
                      ny=int((maxY-minY)/res+1)
                
            
  tiff = tiffHandle(filename,minX,minY,maxX,maxY,nx,ny,x,y)
  new_filename = 'task2_map.tif'
  f=h5py.File(filename,'r')
  tiff.writeTiff(data,res,new_filename,epsg)