-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInterpTB.m
70 lines (62 loc) · 2.56 KB
/
InterpTB.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
%% first crack at interp
% created By Mike Durand
% Last edited by Steve Coss 11/30/2015
clear all; close all; clc
%%user input section
doplot=true% true to create plots
CDZ=false % just use version 3!!
sat=3%1=J2 2=Envi 3=both
seperate=true %true to interpolate altimiters seperatly then merge
%% list of rivers available
NorthAmerica={'Columbia','Mackenzie','StLawrence','Susquehanna', 'Yukon','Mississippi'};
SouthAmerica={'Amazon','Orinoco','Tocantins','SaoFrancisco','Uruguay','Magdalena','Parana','Oiapoque','Essequibo','Courantyne'};
Africa={'Congo','Nile','Niger','Zambezi'};
Eurasia={'Amur','Anabar','Ayeyarwada','Kuloy','Ob','Mezen','Lena','Yenisei','Pechora','Pyasina','Khatanga','Olenyok' ...
,'Kolyma','Anadyr','Yangtze','Mekong','Ganges','Brahmaputra','Indus','Volga'};
WORLD = [NorthAmerica SouthAmerica Africa Eurasia];
CurrRiv={'SaoFrancisco'}; %put selected river here in string form
RunRiv=CurrRiv;%you can switch this to CurrRiv if you only want to run one river.
%% is there a gage for this tiver
NoGage=true
%% enter gage file info for ploting
FnAmE='Amazon15040000'%the gague file for comparison
gaguefile=fullfile('C:\Users\coss.31\Documents\Work\Rivers\Validation data\VALIDMAT\V2flowd',FnAmE)%gague directory
%% switches
loadswitch.offsetswitch=false %address altimiter offset
loadswitch.MSswitch=true%remove individual TS means then add baseline back
loadswitch.Steveterp=false
loadswitch.scatteredinterpolant=true;%use scattered interpolant instead of griddata
loadswitch.version=3 %uses different VS verson
loadswitch.Qfilter=false;
loadswitch.Qfilterthreshold =.6;
loadswitch.Smooth=true;
loadswitch.ChooseS=false
loadswitch.SmoothS=1000;
loadswitch.GRRATSONY=true;
loadswitch.fdh=true %FORCE FINAL PRODUCT TO GO DOWNHILL
%% loads up correct VS and gague data
GF=load(gaguefile);%gague data
[VSe,VSj,VS,CL]=VSloader(RunRiv,sat,loadswitch);%enviVS, JasonVS or merged VS
%% extracts relevant data for processing
[RivAlt]=allriverextractor(VS, loadswitch);
%% condense and remove
if CDZ
[RivAlt]= NormalizeData(RivAlt);
figure;
scatter(RivAlt.RivAlt.Y,RivAlt.RivAlt.Hnorm,'.');
[RivAlt]= FlagBad(RivAlt);
Good=RivAlt.RivAlt.Hnorm>-9998;
hold on
scatter(RivAlt.RivAlt.Y(Good),RivAlt.RivAlt.Hnorm(Good),'.');
RivAlt.RivAlt.H=RivAlt.RivAlt.H(Good);
RivAlt.RivAlt.X=RivAlt.RivAlt.X(Good);
RivAlt.RivAlt.Y=RivAlt.RivAlt.Y(Good);
end
%% interpolate extracted data
[TERP,x,y,s]=riverinterpolater(RivAlt,VSe,VSj,seperate,sat,loadswitch,CL);
%% save the interpolation for later use
TERPsaver(TERP,RunRiv,sat,x,y,s);
%% plot data
if doplot
TERPdataPLOTTER(TERP, x,y,GF,s,RunRiv,NoGage);
end