Example #1
0
PHE = (PHE_ru - PHE_blank) / PHE_calib;
FLU = (FLU_ru - FLU_blank) / FLU_calib;
PYR = (PYR_ru - PYR_blank) / PYR_calib;

# Other variables SeaExplorer
CHL = sx_chlorophyll.values    
CDOM = sx_cdom.values    
BB700 = sx_backscatter_700.values

    
## ---- Projection on definited transect ---- ##
import coord_list
## 1. SeaExplorer
dist, angle = seawater.dist([origin[0], target[0]], [origin[1], target[1]]) # not used 
interval = 20.0 #meters
azimuth = coord_list.calculateBearing(origin[0], origin[1], target[0], target[1]) # this works but angle above not.
coords = np.array(coord_list.main(interval,azimuth,origin[0], origin[1], target[0], target[1]))
lats = coords[:,0]
lons = coords[:,1]

I2 = np.argmin(np.abs(latVec-target[0]) + np.abs(lonVec-target[1]))
I1 = np.argmin(np.abs(latVec-origin[0]) + np.abs(lonVec-origin[1]))
theIndex = np.arange(np.min([I1, I2]), np.max([I1, I2]))
distVec = np.full_like(theIndex, np.nan, dtype=np.double)  
new_lat = np.full_like(theIndex, np.nan, dtype=np.double)  
new_lon = np.full_like(theIndex, np.nan, dtype=np.double)  
for re_idx, idx in enumerate(theIndex):
    idx_nearest = np.argmin(np.abs(latVec[idx]-lats) + np.abs(lonVec[idx]-lons))
    new_lat[re_idx] = coords[idx_nearest,0]
    new_lon[re_idx] = coords[idx_nearest,1]
Farray = Farray[:,I]
Oarray = Oarray[:,I]
PHarray = PHarray[:,I]
     
## # for bathymetry:
## if 'bathy' in locals():
##     bathy_x = np.append(distance, [distance[-1], distance[0], distance[0] ])
##     bathy_y = np.append(bathy, [np.max(bathy), np.max(bathy), bathy[0]])
##     bathymetry = zip(bathy_x, bathy_y)

# for GEBCO bathymetry
import coord_list
import netCDF4
import get_GEBCO
interval = 10000.0 #meters
azimuth = coord_list.calculateBearing(LATarray[0], LONarray[0], LATarray[-1], LONarray[-1])
coords = coord_list.main(interval,azimuth,LATarray[0], LONarray[0], LATarray[-1], LONarray[-1])
lat_max = max(l[0] for l in coords)
lat_min = min(l[0] for l in coords)
lon_max = max(l[1] for l in coords)
lon_min = min(l[1] for l in coords)
lat, lon, Z = get_GEBCO.main('/home/cyrf0006/Data/GEBCO/GEBCO_08.nc', [-lat_max, -lat_min, lon_min, lon_max])
lat = -lat
Z = -Z
X, Y = np.meshgrid(lon, lat)  # grid X,Y
X = X.reshape(np.size(Z)) #<--- check if a fonction exists for that
Y = Y.reshape(np.size(Z))
Z = Z.reshape(np.size(Z))

bathy = []
distance_bathy = []