-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor launch file [WIP] #34
base: ustar_cp_refactor_main
Are you sure you want to change the base?
Conversation
Passes all current tests
All tests passed
All tests passed
All tests pass
…ving PPFD columns All tests pass
All tests passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(sorry only time for partial comments)
function [input_folder, output_folder] = check_path(input_folder, output_folder) | ||
|
||
% check input path | ||
if 0 == exist('input_folder') | ||
input_folder = [pwd '/']; | ||
elseif length(input_folder) < 2 | ||
if input_folder(2) ~= ':' | ||
input_folder = [pwd '/' input_folder]; | ||
end | ||
end | ||
if input_folder(length(input_folder)) ~= '\' && input_folder(length(input_folder)) ~= '/' | ||
input_folder = [input_folder '/']; | ||
end | ||
end | ||
if output_folder(length(output_folder)) ~= '\' && output_folder(length(output_folder)) ~= '/' | ||
output_folder = [output_folder '/']; | ||
end | ||
mkdir(output_folder); | ||
|
||
%by alessio | ||
USTAR_INDEX = 1; | ||
NEE_INDEX = 2; | ||
TA_INDEX = 3; | ||
PPFD_INDEX = 4; | ||
RG_INDEX = 5; | ||
input_columns_names = {'USTAR' 'NEE' 'TA' 'PPFD_IN' 'SW_IN' }; | ||
% check output path | ||
if 0 == exist('output_folder') | ||
output_folder = [pwd '/']; | ||
elseif length(output_folder) < 2 | ||
if output_folder(2) ~= ':' | ||
output_folder = [pwd '/' output_folder]; | ||
end | ||
end | ||
if output_folder(length(output_folder)) ~= '\' && output_folder(length(output_folder)) ~= '/' | ||
output_folder = [output_folder '/']; | ||
end | ||
mkdir(output_folder); | ||
|
||
%by alessio | ||
fprintf('\n\nUstar Threshold Computation by Alan Barr\n\ninput in %s\noutput in %s\n\n', input_folder, output_folder); | ||
d = dir([input_folder,'*_qca_ustar_*.csv']); | ||
error_str = {}; | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that there is a single function for checking a path which could be extracted from this and reused (the code looks the same between checking input and output paths)
dataset = textscan(fid,'%[^\n]');dataset = dataset{1}; | ||
|
||
function [exitcode, site, year, lat, lon, timezone, htower, timeres, sc_negl, notes] ... | ||
= not_valid_header(dataset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice - definitely makes sense to split this out and then I think we can abstract this and replace a lot of repetition
We decided to build on this PR with the rest of the refactoring and testing. @isaacaka to add a checklist of the items in the PR first post. |
First pass on refactoring launch.m. Split the single big main function into multiple sub-functions which are then called by the main function.
Closes #26