Esempio n. 1
0
def to_lon_lat_boundary_coordinates(coordinates, params):
    for i in range(len(coordinates)):
        coordinates[i] = su.convert_index_to_lonlat(coordinates[i][0],
                                                    coordinates[i][1],
                                                    params.pixelRes,
                                                    lon0=params.originLon,
                                                    lat0=params.originLat)
    return coordinates
Esempio n. 2
0
def to_lon_lat_normals(xCoords, yCoords, lineCentrePoints, ontoShelfDirection,
                       params):
    for i in range(len(xCoords)):
        xCoord = xCoords[i]
        yCoord = yCoords[i]
        lon1, lat1 = su.convert_index_to_lonlat(xCoord[0],
                                                yCoord[0],
                                                params.pixelRes,
                                                lon0=params.originLon,
                                                lat0=params.originLat)
        lon2, lat2 = su.convert_index_to_lonlat(xCoord[1],
                                                yCoord[1],
                                                params.pixelRes,
                                                lon0=params.originLon,
                                                lat0=params.originLat)
        xCoords[i] = (lon1, lon2)
        yCoords[i] = (lat1, lat2)

        #c, d = su.convert_index_to_lonlat(lineCentrePoints[i][0]+ontoShelfDirection[i][0], lineCentrePoints[i][1]+ontoShelfDirection[i][1], params.pixelRes, lon0=lineCentrePoints[i][0], lat0=lineCentrePoints[i][1]);

        lineCentrePoints[i] = su.convert_index_to_lonlat(
            lineCentrePoints[i][0],
            lineCentrePoints[i][1],
            params.pixelRes,
            lon0=params.originLon,
            lat0=params.originLat)
        ontoShelfDirection[i] = ontoShelfDirection[i] / np.linalg.norm(
            ontoShelfDirection[i])
        ontoShelfDirection[i] = su.convert_index_to_lonlat(
            ontoShelfDirection[i][0],
            ontoShelfDirection[i][1],
            params.pixelRes,
            lon0=0,
            lat0=0)

        #a, b = lineCentrePoints[i];

        #ontoShelfDirection[i] = (c-a, d-b);

    return xCoords, yCoords, lineCentrePoints, ontoShelfDirection
Esempio n. 3
0
                  unp.isnan(skimOntoShelfLong)
                  == False) | (unp.isnan(truthOntoShelfLong) == False)
    xcoords = xcoords[toKeep]
    ycoords = ycoords[toKeep]
    eksOntoShelfLong = eksOntoShelfLong[toKeep]
    altiOntoShelfLong = altiOntoShelfLong[toKeep]
    skimOntoShelfLong = skimOntoShelfLong[toKeep]
    truthOntoShelfLong = truthOntoShelfLong[toKeep]

    #Converts coordinates into lon/lat.
    lats = []
    lons = []
    for i in range(len(xcoords)):
        lon, lat = su.convert_index_to_lonlat(xcoords[i],
                                              ycoords[i],
                                              params.pixelRes,
                                              lon0=params.originLon,
                                              lat0=params.originLat)
        lats.append(lat)
        lons.append(lon)

    ###############n#############################
    # Plot Jan, Feb, Mar nekman vs ngeostrophic #
    ##################n##########################
    if totalMap:
        climMax = 0.4
        climMin = -0.15
        plt.figure(figsize=figsize)
        mapFig = Basemap(llcrnrlon=llcrnrlon,
                         llcrnrlat=llcrnrlat,
                         urcrnrlon=urcrnrlon,
Esempio n. 4
0
                         color=(0.3, 0.3, 0.3),
                         fontsize=ticksize)

    #Bathometry
    lon = np.arange(params.originLon, params.maxLon, 0.25)
    lat = np.arange(params.originLat, params.maxLat, -0.25)
    x, y = np.meshgrid(lon, lat)
    xi, yi = mapFig(x, y)
    cs = mapFig.pcolormesh(xi, yi, depth)
    #, cmap=cmap);

    #Plot intersected grids
    for gridIntercept in gridIntercepts:
        lon1, lat1 = su.convert_index_to_lonlat(gridIntercept.bx1,
                                                gridIntercept.by1,
                                                params.pixelRes,
                                                lon0=params.originLon,
                                                lat0=params.originLat)
        lon2, lat2 = su.convert_index_to_lonlat(gridIntercept.bx2,
                                                gridIntercept.by2,
                                                params.pixelRes,
                                                lon0=params.originLon,
                                                lat0=params.originLat)
        draw_box(mapFig, lon1, lat1, lon2, lat2, color='r')
    #Plot line segments:
    colour = 'y'
    for gridIntercept in gridIntercepts:
        xs = (gridIntercept.i1lon, gridIntercept.i2lon)
        ys = (gridIntercept.i1lat, gridIntercept.i2lat)
        x, y = mapFig(xs, ys)
        mapFig.plot(x, y, color=colour)
Esempio n. 5
0
    data.ycoords = data.ycoords[toKeep]


####################################
# Process data for Jan, Feb, March #
####################################
if plot123:
    data = get_processed_data([0, 1, 2], allData)
    if resampleFraction > 1:
        resample_data(data, resampleFraction)

    #Converts coordinates into lon/lat.
    lats = []
    lons = []
    for i in range(len(data.xcoords)):
        lon, lat = su.convert_index_to_lonlat(data.xcoords[i], data.ycoords[i],
                                              params.pixelRes)
        lats.append(lat)
        lons.append(lon)

    ###############n#############################
    # Plot Jan, Feb, Mar nekman vs ngeostrophic #
    ##################n##########################
    if plotEkmanVsGeostrophic:
        plt.figure(figsize=figsize)
        mapFig = Basemap(llcrnrlon=-180.0,
                         llcrnrlat=-90,
                         urcrnrlon=180.0,
                         urcrnrlat=90.0,
                         resolution='l',
                         projection='cyl',
                         lat_0=39.5,