%% (1) Define process directory and data directory
% process_dir = directory containing epsi library
% configFile = path to config file
process_dir = '~/GitHub/MOD_fish_lib/';
addpath(genpath(process_dir))
md = fullfile(process_dir,'Meta_Data_Process','MDP_norse2023_minnow1_beforeNov19.txt');
data_dir = '/Users/ncouto/Library/CloudStorage/Dropbox/SIO/projects/norse/data/1115_epsi_minnow2_reprocess';
%% (2) Initialize epsi class
ec = epsi_class(data_dir,md);
%% (3) Convert raw to mat
ec.f_readData;
%% (4) Compute turbulence variables
ec.f_processNewProfiles;
% (5) Grid profiles
z = 0:250; %Choose depth range for gridding
ec.f_gridProfiles(z);
Update probe numbers and calibrations. Then reprocess turbulence data:
% Setup
clear; close all
%paths
deploymentdir = 'C:/Users/ankit/Documents/SIO/Academics/Research/24_ASTRAL/Processed_Data/epsi/24_0602_deployment_17';
codedir = 'C:/Users/ankit/Documents/SIO/Academics/Research/GitHub/EPSILOMETER/';
md = fullfile(codedir,'Meta_Data_Process','MDP_norse2023_minnow1_beforeNov19.txt');
%generate path to epsi library
addpath(genpath(codedir))
%global parameters
depth_array = 0:500;
deployment = '24_0602_deployment_17';
s1 = '320';
s2 = '304';
t1 = '248';
t2 = '351';
%create new directory
cd(deploymentdir)
if ~exist('profiles_new','dir'); mkdir 'profiles_new'; end
if ~exist('figs_new','dir'); mkdir 'figs_new'; end
%% Reprocess epsi data
ec = epsi_class(deploymentdir,md); %read in epsi functions and metadata
%update paths
ec.Meta_Data.paths.data = deploymentdir;
ec.Meta_Data.paths.raw_data = [deploymentdir, '/raw'];
ec.Meta_Data.paths.mat_data = [deploymentdir, '/mat'];
ec.Meta_Data.paths.profiles = [deploymentdir, '/profiles_test'];
ec.Meta_Data.paths.figures = [deploymentdir, '/figs_new'];
ec.Meta_Data.paths.process_library = codedir;
ec.Meta_Data.paths.calibration = [codedir,'CALIBRATION/ELECTRONICS'];
%update serial numbers
ec.Meta_Data.AFE.s1.SN = s1; %put in the correct serial number
ec.Meta_Data.AFE.s2.SN = s2; %put in the correct serial number
%reprocess
ec.f_readData; %Convert raw to mat
ec.f_getSNshear; %Grab the correct cal numbers based on those serial numbers
ec.f_calibrateTemperature; %Get the temperature calibration numbers
ec.f_makeNewProfiles; %Create new profiles with measured values
ec.f_computeTurbulence; %Recompute turbulence parameters for all your profiles
ec.f_gridProfiles(depth_array); %Regrid data