-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds functionality to export estimated depths of annual IRHs * Incorporates layer depths functions into HPC scripts; sets random seed for reproducibility * Updates SCRDIR assignment to nfs1 drive (lustre currently down) * Adds a default depth-density profile for when no other densities are given * Updates documentation on data download files * Adds progress bar to results upload * Adds option to output raw accum distribution data rather than summary stats Co-authored-by: Durban Keeler <[email protected]>
- Loading branch information
Showing
13 changed files
with
1,737 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
% Blah blah blah | ||
function [accum_table] = accum_raw(radar) | ||
|
||
% Preallocate cell for results | ||
accum_table = cell(1,length(radar.SMB)); | ||
|
||
for i=1:length(radar.SMB) | ||
|
||
tbl_tmp = cell2table(... | ||
{radar.collect_time(i), radar.Lon(i), radar.Lat(i), ... | ||
radar.elev(i), radar.SMB_yr{i}, num2cell(radar.SMB{i},2)}, ... | ||
'VariableNames', ... | ||
{'collect_time', 'Lon', 'Lat', 'elev', 'Year', 'accum'}); | ||
|
||
j_max = cellfun(@length, tbl_tmp.Year); | ||
k_max = max(cellfun(@(x) size(x,2), tbl_tmp.accum{:})); | ||
accum_i = zeros(j_max*k_max,1); | ||
year_i = zeros(j_max*k_max,1); | ||
|
||
for j=1:j_max | ||
|
||
year_i((j-1)*k_max+1:(j-1)*k_max+k_max) = repmat(... | ||
tbl_tmp.Year{1}(j), k_max,1); | ||
accum_i((j-1)*k_max+1:(j-1)*k_max+k_max) = (tbl_tmp.accum{1}{j})'; | ||
|
||
% for k=1:k_max | ||
% | ||
% accum_i((j-1)*k_max+1:(j-1)*k_max+k_max) = repmat(... | ||
% tbl_tmp.Year{1}(j), k_max,1); | ||
|
||
end | ||
|
||
accum_table{i} = table(... | ||
repmat(tbl_tmp.collect_time, length(accum_i),1), ... | ||
cast(repmat(tbl_tmp.Lon, length(accum_i),1), 'single'), ... | ||
cast(repmat(tbl_tmp.Lat, length(accum_i),1), 'single'), ... | ||
cast(repmat(tbl_tmp.elev, length(accum_i),1), 'single'), ... | ||
cast(year_i, 'int16'), cast(accum_i, 'single'), ... | ||
'VariableNames', tbl_tmp.Properties.VariableNames); | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
% Function to find the depth of each assigned year layer | ||
|
||
function [yr_DepthTables] = get_depths(radar, bin_size) | ||
|
||
% Determine number of elements in each bin based on distance spacing and | ||
% requested bin_size (bin_size in meters) | ||
dist_interval = mean(diff(radar.dist)); | ||
stack_step = round(bin_size / dist_interval); | ||
|
||
% Determine starting and stopping indices for different aggregated bins | ||
start_idx = 1:stack_step:length(radar.SMB); | ||
end_idx = [start_idx(2:end)-1 length(radar.SMB)]; | ||
|
||
% Preallocate cell array for annual layer depth tables | ||
yr_DepthTables = cell(1, length(start_idx)); | ||
|
||
|
||
for i=1:length(yr_DepthTables) | ||
|
||
% Extract ages with current bin and reshape to 2D | ||
ages_i = radar.ages(:,start_idx(i):end_idx(i),:); | ||
ages_i = reshape(ages_i, size(ages_i,1), []); | ||
|
||
% Get min/max ages in slice | ||
yr_first = floor(max(max(ages_i))); | ||
yr_last = ceil(min(min(ages_i))); | ||
yr_list = (yr_first:-1:yr_last)'; | ||
|
||
% Logical of integer year indices | ||
yr_logic = logical(diff(floor(ages_i))); | ||
% Preallocate array for depth of annual IRHs | ||
yr_depths = NaN(length(yr_list), size(ages_i,2)); | ||
for j=1:size(yr_logic,2) | ||
|
||
% Get depths of annual IRHs for each simulation | ||
yr_idx = find(yr_logic(:,j)); | ||
yr_depths(1:length(yr_idx),j) = radar.depth(yr_idx); | ||
end | ||
|
||
% Remove years with more than 25% NaN values | ||
nan_idx = sum(isnan(yr_depths),2)/size(yr_depths,2); | ||
yr_list = yr_list(nan_idx <= 0.25); | ||
yr_depths = yr_depths(nan_idx<=0.25,:); | ||
|
||
% Determine average bin values for remaining variables of interest | ||
yr_len = length(yr_list); | ||
time = mean(radar.collect_time(start_idx(i):end_idx(i))); | ||
lat = mean(radar.Lat(start_idx(i):end_idx(i))); | ||
lon = mean(radar.Lon(start_idx(i):end_idx(i))); | ||
elev = mean(radar.elev(start_idx(i):end_idx(i))); | ||
|
||
% Output years, median depth, and std. err for each bin | ||
yr_DepthTables{i} = table(... | ||
repmat(time, yr_len,1), repmat(lat, yr_len,1), ... | ||
repmat(lon, yr_len,1), repmat(elev, yr_len,1), ... | ||
yr_list, median(yr_depths,2, 'omitnan'), ... | ||
std(yr_depths,1,2,'omitnan'), ... | ||
sum(~isnan(yr_depths),2),... | ||
'VariableNames', {'collect_time', 'Lat', 'Lon', 'elev', ... | ||
'IHR_year', 'IHR_depth', 'IHR_std', 'IHR_cnt'}); | ||
|
||
|
||
end | ||
|
||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.