示例#1
0
def Get_apriori_bathymetry(parameters, points):

    # transform input data
    Coordinates = PointsList2Coordinates(points)

    # Find Collocated bathymetry
    coord, bathy = FindCollocatedBathymetry(parameters.BathymetryParameters,
                                            Coordinates)
    bathydata = CL.BathymetryData(coord, bathy)

    # interpolate bathymetry on the grid points
    Bathymetry_Data = InterpolateBathymetry(parameters.MiscellaneousParameters,
                                            Coordinates, bathydata)

    return Bathymetry_Data
示例#2
0
def InterpolateBathymetry(parameters, Coordinates, bathydata):

    #------------------------------------------------------------------------
    # Find Collocated bathymetry corresponding to the input data coordinates
    #------------------------------------------------------------------------
    #initialization
    # grid points
    easting = Coordinates.easting
    northing = Coordinates.northing
    npt = easting.shape[0]
    bathymetry = np.zeros(npt)

    # current bathymetry
    coord = bathydata.Coordinates
    bathy = bathydata.Bathymetry
    e, n = np.meshgrid(coord.easting, coord.northing)

    #interpolate on the grid points

    if parameters.InterpolationMethod == 'multiquadric':
        rbfi = Rbf(e, n, bathy)
        bathymetry = rbfi(easting, northing)
    else:
        bathymetry = griddata((e.ravel(), n.ravel()),
                              bathy.ravel(), (easting, northing),
                              method=parameters.InterpolationMethod)

    BathymetryData = CL.BathymetryData(Coordinates, bathymetry)
    """
	fig, ax = plt.subplots(1)
	cl=np.array([-200,-20])
	ea = coord.easting; no = coord.northing;
	ax.imshow(bathy, cmap=plt.cm.jet, interpolation=None, aspect='auto', origin='upper', extent=[np.min(ea), np.max(ea), np.min(no), np.max(no)], vmin=cl[0], vmax=cl[1])	
	
	cm = plt.get_cmap("jet")
	for i in range(easting.shape[0]):
		convcol = 255*(bathymetry[i]-cl[0])/(cl[1]-cl[0]); col = cm(convcol.astype(int))
		ax.plot(easting[i], northing[i], color=col, marker='o',markeredgecolor='k');
	plt.show()
	"""
    return BathymetryData
示例#3
0
def RemoveBathymetryException(parameters, Points, Bathymetry):
    #-------------------------------------------------------------------------------------------------------------------
    #
    #	Remove Grid points impacted with bathymetry exception
    #
    #--------------------------------------------------------------------------------------------------------------------

    #  remove NaN bathymetry values
    point, bathymetry, northing, easting = RemoveNanBathymetry(
        Points, Bathymetry)

    # remove land-sea interpolation artefacts
    #point, bathymetry, northing, easting = RemoveBathymetryAnomalies(parameters, point, bathymetry, northing, easting)

    coordinates = CL.Coordinates(northing, easting)
    BathymetryData = CL.BathymetryData(coordinates, bathymetry)
    """
	fig, ax = plt.subplots(1)
	for i in range(bathymetry.shape[0]):
		ax.plot(i, bathymetry[i],'or')
	"""
    return point, BathymetryData