In [ ]:
from easy_coloc import lib_easy_coloc
import xarray as xr
import pandas as pd
import cartopy as cart
import matplotlib.pylab as plt
from matplotlib import cm
In [ ]:
%matplotlib inline
In [ ]:
# load stations information from csv file
ar07w = pd.read_csv('../easy_coloc/test/test_files/AR07W_stations.txt',skipinitialspace=True)
In [ ]:
# load gridded dataset
ds = xr.open_dataset('../easy_coloc/test/test_files/woa_labrador.nc',decode_times=False)
In [ ]:
# create source grid and target section objects
# this requires lon,lat from stations and the source grid dataset containing lon,lat
proj = lib_easy_coloc.projection(ar07w['lon'].values,ar07w['lat'].values,grid=ds,
from_global=False)
In [ ]:
# run the projection on the WOA analyzed temperature (t_an)
fld = proj.run(ds['t_an'][:])
In [ ]:
# plot surface data
plt.figure(figsize=[10,10])
m = plt.axes(projection=cart.crs.PlateCarree())
C = m.scatter(ar07w['lon'].values,ar07w['lat'].values,c=fld[0,0,:],cmap=cm.gist_ncar)
plt.colorbar(C,shrink=0.5)
m.coastlines()
m.add_feature(cart.feature.LAND, facecolor='0.75')
m.set_extent([-75, -35, 35, 65], crs=cart.crs.PlateCarree())
gl = m.gridlines(draw_labels=True)
In [ ]:
plt.figure(figsize=[10,10])
plt.contourf(ar07w['lat'].values,-ds['depth'],fld[0,:,:],30,cmap=cm.gist_ncar)
plt.colorbar()
plt.title('WOA temperature at AR07W section')
In [ ]: