bSOSE - deepa-rao/Resources GitHub Wiki
Bio SOSE data for the Southern Ocean:
using xarray to load files and manipulate files
Data Files for BSOSE are here: BSOSE iteration 122 data stored on engaging: /nfs/cnhlab004/alir/bsose_i122/
With Ali Oct 25th
- set up miniconda python 3 on engaging in my home directory
Load the environment.yml file conda activate seasonal_cycle
When plotting use plt.show() for XQuartz viewer
import xarray as xr #learn the xarray functions for quick computing from dask.diagnostics import ProgressBar import cmocean import matplotlib.pyplot as plt
u_file = "bsose_i122_2013to2017_1day_Uvel.nc" v_file = "bsose_i122_2013to2017_1day_Vvel.nc"
u = xr.open_mfdataset(u_file, parallel=True, chunks={'time': 10}) #chunk the big dataset into pieces for parallelized computing v = xr.open_mfdataset(v_file, parallel=True, chunks={'time': 10})
inspect data and variables
u.Z u.Z.values
u.UVEL.values #etc
select a subset of the data to use
u_slice = u_.sel(time=slice('2013-01-01',' 2014-01-02'), YC=slice(-80,-60)).isel(Z=1) u_slice_1time = u_slice.isel(time=1)
u_slice_1time.UVEL.plot() plt.show()
u_slice_yr = u.sel(time=slice('2013-01-01',' 2014-01-02'), YC=slice(-80,-60)).isel(Z=1) u_slice_yr_avg = u_slice_yr.mean(dim='time')
with ProgressBar(): u_slice_yr_avg.UVEL.plot() plt.show()