Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/IPGP/webobs
Browse files Browse the repository at this point in the history
  • Loading branch information
beaudu committed Oct 3, 2024
2 parents 620565c + c188cdb commit eae8a77
Show file tree
Hide file tree
Showing 25 changed files with 249 additions and 85 deletions.
11 changes: 8 additions & 3 deletions CODE/matlab/mktides.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
%
% Author: F. Beauducel, WEBOBS/IPGP
% Created: 2015
% Updated: 2022-07-26
% Updated: 2024-08-26


g = 9.81;


if numel(opt) == 1
if isscalar(opt)
tidemode = opt;
wavemode = 'ALL';
kindmode = 'TL';
Expand Down Expand Up @@ -72,7 +72,12 @@
wosystem(sprintf('sed "s/[:\\/]/ /g" %s > %s',fdat,ftmp));
dd = load(ftmp);
T.t = datenum(dd(:,1),dd(:,2),dd(:,3),dd(:,4),dd(:,5),0);
T.d = g*dd(:,[7,6]);
switch kindmode
case 'TL'
T.d = g*dd(:,[7,6]);
otherwise
T.d = dd(:,6);
end
fprintf('done.\n');
else
fprintf('** WARNING ** tides file does not exist!\n');
Expand Down
12 changes: 8 additions & 4 deletions CODE/matlab/readfmtdata.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
%
% Authors: François Beauducel, Jean-Marie Saurel, WEBOBS/IPGP
% Created: 2013-12-29, in Guadeloupe, French West Indies
% Updated: 2022-10-26
% Updated: 2024-07-02

wofun = sprintf('WEBOBS{%s}',mfilename);

Expand All @@ -33,9 +33,13 @@
wosystem(sprintf('mkdir -p %s',F.ptmp));

if isfield(P,'FORM')

D = readfmtdata_woform(WO,P,N);

% legacy forms (datafile)
f = sprintf('%s/%s',WO.PATH_DATA_DB,P.FORM.FILE_NAME);
if exist(f,'file')
D = readfmtdata_woform(WO,P,N);
else
D = readfmtdata_genform(WO,P,N);
end
else

for n = 1:length(N)
Expand Down
6 changes: 3 additions & 3 deletions CODE/matlab/readfmtdata_quake.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
%
% Authors: François Beauducel and Jean-Marie Saurel, WEBOBS/IPGP
% Created: 2016-07-10, in Yogyakarta (Indonesia)
% Updated: 2023-08-25
% Updated: 2024-07-12

wofun = sprintf('WEBOBS{%s}',mfilename);

Expand All @@ -57,12 +57,12 @@
P.(fd) = [-Inf,Inf];
end
end
if isfield(P,'EVENTTYPE_EXCLUDED_LIST')
if isfield(P,'EVENTTYPE_EXCLUDED_LIST') && ~isempty(P.EVENTTYPE_EXCLUDED_LIST)
extypes = split(P.EVENTTYPE_EXCLUDED_LIST,',');
else
extypes = {''};
end
if isfield(P,'EVENTSTATUS_EXCLUDED_LIST')
if isfield(P,'EVENTSTATUS_EXCLUDED_LIST') && ~isempty(P.EVENTSTATUS_EXCLUDED_LIST)
exstatus = split(P.EVENTSTATUS_EXCLUDED_LIST,',');
else
exstatus = {''};
Expand Down
68 changes: 56 additions & 12 deletions CODE/matlab/readfmtdata_woform.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
% D.d (Distance Temp Wind)
% D.e (Distance Temp Wind)
%
% form 'RIVERS'
% D.t (datenum)
% D.d (18 columns)
%
% form 'RAINWATER'
% D.t (datenum)
% D.d (18 columns)
Expand All @@ -35,21 +39,21 @@
%
% **WARNING** this file must be iso-8859 (unicode) encoded and NOT utf-8
%
% Author: Fran�ois Beauducel, WEBOBS/IPGP
% Author: François Beauducel, WEBOBS/IPGP
% Created: 2016-07-10, in Yogyakarta (Indonesia)
% Updated: 2023-08-30
% Updated: 2024-10-03

wofun = sprintf('WEBOBS{%s}',mfilename);

GMOL = readcfg(WO,sprintf('%s/etc/gmol.conf',WO.ROOT_CODE));

f = sprintf('%s/%s',WO.PATH_DATA_DB,P.FORM.FILE_NAME);
if ~exist(f,'file')
error('%s: %s not found [%s].',wofun,f,P.FORM.SELFREF);
if ~ismember(P.FORM.SELFREF,{'EAUX','GAZ','EXTENSO','RAINWATER','SOILSOLUTION','RIVERS'})
error('%s: unknown woform [%s].',wofun,P.FORM.SELFREF);
end

fprintf('%s: importing FORM data [%s] ...\n',wofun,P.FORM.SELFREF);

f = sprintf('%s/%s',WO.PATH_DATA_DB,P.FORM.FILE_NAME);
data = readdatafile(f,[],'HeaderLines',1);

% replaces missing hours by default time, converts to datenum
Expand Down Expand Up @@ -86,8 +90,8 @@
e = zeros(size(d));
nm = {'type','TA','TS','pH','Flux','Cond','Level','Li+','Na+','K+','Mg++','Ca++','F-','Cl-','Br-','NO3-','SO4--','HCO3-','I-', ...
'\delta^{13}C','\delta^{18}O','{\delta}D','Cl-/SO4-- ','HCO3-/SO4--','Mg++/Cl-','Cond_{25}','NICB'};
un = { '','C','C', '','l/mn', '�S', 'm','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l', ...
'', '', '', '', '', '', '�S', '%'};
un = { '','°C','°C', '','l/mn', 'µS', 'm','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l', ...
'', '', '', '', '', '', 'µS', '%'};

D = share2nodes(t,d,e,data(:,4),P,N,nm,un);

Expand All @@ -107,7 +111,7 @@

e = zeros(size(d));
nm = {'Temperature','pH','Flux', 'Rn','type','H_2','He','CO','CH_4','N_2','H_2S','Ar','CO_2','SO_2','O_2','\delta^{13}C','\delta^{18}O','S/C'};
un = { 'C', '', '-','#/mn', '', '%', '%', '%', '%', '%', '%', '%', '%', '%', '%', '', '', ''};
un = { '°C', '', '-','#/mn', '', '%', '%', '%', '%', '%', '%', '%', '%', '%', '%', '', '', ''};

D = share2nodes(t,d,e,data(:,4),P,N,nm,un);

Expand All @@ -125,7 +129,7 @@
e(e==0) = 1; % forces error = 1

nm = {'Distance','TempAir','Wind'};
un = { 'mm', 'C', '-'};
un = { 'mm', '°C', '-'};

D = share2nodes(t,d,e,data(:,4),P,N,nm,un);

Expand All @@ -141,7 +145,7 @@
e(e==0) = 1; % forces error = 1

nm = {'Perp.','Para.','Vert.','TempAir'};
un = { 'mm', 'mm', 'mm', 'C'};
un = { 'mm', 'mm', 'mm', '°C'};

D = share2nodes(t,d,e,data(:,4),P,N,nm,un);

Expand Down Expand Up @@ -170,7 +174,7 @@
e = zeros(size(d));
nm = {'Rainmeter','pH','Cond','Na+','K+','Mg++','Ca++','HCO3-','Cl-','SO4--', ...
'{\delta}D','\delta^{18}O','Cl-/Na+ ','SO4--/Na+','Mg++/Na+','NICB'};
un = { 'mm/day', '', '�S', 'mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l', ...
un = { 'mm/day', '', 'µS', 'mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l', ...
'%{\fontsize{5}o}', '%{\fontsize{5}o}', '', '', '', '%'};

D = share2nodes(t,d,e,data(:,4),P,N,nm,un);
Expand Down Expand Up @@ -198,11 +202,51 @@
e = zeros(size(d));
nm = {'Duration','Depth','Level','pH','Cond','Na+', 'K+', 'Mg++', 'Ca++', 'HCO3-', 'Cl-', 'NO3-', 'SO4--', ...
'SiO2','DOC','Cl-/Na+ ','SO4--/Na+','Mg++/Na+','NICB'};
un = { 'day', 'cm' , '' ,'', '�S', 'mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l', ...
un = { 'day', 'cm' , '' ,'', 'µS', 'mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l', ...
'ppm', 'ppm','', '', '', '%'};

D = share2nodes(t,d,e,data(:,4),P,N,nm,un);

case 'RIVERS'
% type of sampling
FT = readcfg(WO,sprintf('%s/%s',P.FORM.ROOT,P.FORM.FILE_TYPE));
tcod = fieldnames(FT);
% replaces type of sampling by a number
for i = 1:length(tcod)
data(strcmp(data(:,6),tcod(i)),6) = {num2str(i)};
end
% type of flacon (bottle)
FB = readcfg(WO,sprintf('%s/%s',P.FORM.ROOT,P.FORM.FILE_FLACONS));
tcod = fieldnames(FB);
% replaces type of bottle by a number
for i = 1:length(tcod)
data(strcmp(data(:,7),tcod(i)),7) = {num2str(i)};
end
% converts all fields to numbers (after replacing french decimal points)
d = str2double(regexprep(data(:,5:end),',','.'));
% converts concentrations to mmol/l
elm = {'Na','K','Mg','Ca','HCO3','Cl','SO4'};
for i = 1:length(elm)
d(:,i+7) = d(:,i+7)/str2double(GMOL.(elm{i}));
end
% adds 5 new columns with chemical ratios an NICB
d(:,19) = d(:,14)./d(:,8); % SO4/Na
d(:,20) = d(:,13)./d(:,8); % Cl/Na
d(:,21) = d(:,11)./d(:,8); % Ca/Na
d(:,22) = d(:,10)./d(:,8); % Mg/Na
% computes NICB (Mg++, Ca++ and SO4-- are double counted)
cations = rsum(d(:,[8,9,10,10,11,11])');
anions = rsum(d(:,[12,13,14,14])');
d(:,23) = 100*((cations - anions)./(cations + anions))';

e = zeros(size(d));
nm = {'level','type','flacon','TR','Sload','pH','Cond25','Cond','Na+','K+','Mg++','Ca++','HCO3-','Cl-','SO4--','SiO2','DOC','POC', ...
'SO4/Na','Cl/Na','Ca/Na','Mg/Na','NICB'};
un = { 'm','','','°C','mg/L', '','µS', 'µS','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','mmol/l','ppm','ppm','ppm', ...
'', '', '', '', '%'};

D = share2nodes(t,d,e,data(:,4),P,N,nm,un);

end


Expand Down
4 changes: 2 additions & 2 deletions CODE/matlab/readproc.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
%
% Authors: F. Beauducel, D. Lafon, WEBOBS/IPGP
% Created: 2013-04-05
% Updated: 2022-10-26
% Updated: 2024-08-06


proc = varargin{1};
Expand All @@ -32,7 +32,7 @@
if strncmp(proc,'/',1) % if argument contains a path filename, will read it as is...
f = proc;
else
proc = regexprep(proc,'PROC.','');
proc = regexprep(proc,'PROC\.','');
f = sprintf('%s/%s/%s.conf',WO.PATH_PROCS,proc,proc);
end

Expand Down
34 changes: 3 additions & 31 deletions CODE/matlab/superprocs/gnss.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@
modelling_cmap = field2num(P,'MODELLING_COLORMAP',ryb(256));
modelling_colorshading = field2num(P,'MODELLING_COLOR_SHADING',0.3);
modelling_topo_rgb = field2num(P,'MODELLING_TOPO_RGB',.5*[1,1,1]);
% color reference for model space: 'pdf' or 'volpdf' (source volume sign x pdf, new default)
modelling_coloref = lower(field2str(P,'MODELLING_COLORREF','volpdf'));
% colors for displacement arrows
datarrcol = field2num(P,'MODELLING_DATA_COLOR',[0,0,0]); % color of model arrows
modarrcol = field2num(P,'MODELLING_MODEL_COLOR',[.7,0,0]); % color of model arrows
resarrcol = field2num(P,'MODELLING_RESIDUAL_COLOR',[0,.5,0]); % color of residual arrows
Expand All @@ -220,6 +218,8 @@

modelling_source_type = field2str(P,'MODELLING_SOURCE_TYPE','isotropic','notempty');

tickfactorlim = 5e3; % above 5 km width/depth axis will be in km

% some modelling parameters are structure fields to pass them to other functions
modelopt.horizonly = isok(P,'MODELLING_HORIZONTAL_ONLY');
modelopt.minerror = field2num(P,'MODELLING_MINERROR_MM',5); % minimum error on data (in mm)
Expand All @@ -228,58 +228,30 @@
if numel(modelopt.enuerror) < 3
modelopt.enuerror = ones(1,3);
end
% a priori source depth (value, gaussian STD in m)
modelopt.apriori_depth = field2num(P,'MODELLING_APRIORI_DEPTH_M');
% a priori horizontal error around the target (in STD, km), 0 or NaN = no a priori
modelopt.apriori_horizontal = field2num(P,'MODELLING_APRIORI_HSTD_KM');
modelopt.msig = field2num(P,'MODELLING_SIGMAS',1);
modelopt.misfitnorm = field2str(P,'MODELLING_MISFITNORM','L1');
modelopt.multi = field2num(P,'MODELLING_MULTIPLE_SOURCES',1,'notempty');

% MODELLING pCDM parameters (see invpcdm.m)
% number of iterations (adjusting the parameter's limits)
% MODELLING pCDM parameters (see invpcdm.m and PROC.GNSS template)
PCDM.iterations = field2num(P,'MODELLING_PCDM_ITERATIONS',5);
% number of random samples: scalar or list for each iteration
PCDM.random_sampling = field2num(P,'MODELLING_PCDM_RANDOM_SAMPLING',200000);
% elastic parameter (Poisson's ratio) nu
PCDM.nu = field2num(P,'MODELLING_PCDM_NU',0.25);
% dV parameter limits: total volume variation (in m3)
PCDM.dvlim = field2num(P,'MODELLING_PCDM_DVLIM',[-1e7,1e7]);
% A parameter limits: horizontal over total volume variation ratio
% A = dVZ/(dVX+dVY+dVZ)
% 0 = vertical (dyke or pipe following B value)
% 1 = horizontal (sill)
% 1/3 = isotrop if B = 0.5
PCDM.alim = field2num(P,'MODELLING_PCDM_ALIM',[0,1]);
% B parameter limits: vertical volume variation ratio
% B = dVY/(dVX+dVY)
% 0 = dyke if A = 0, dyke+sill otherwise
% 1 = dyke if A = 0, dyke+sill otherwise
% 0.5 = isotrop if A = 1/3, pipe if A = 0
PCDM.blim = field2num(P,'MODELLING_PCDM_BLIM',[0,1]);
% OmegaX parameter limits: rotation angle around X axis (West-East)
PCDM.oxlim = field2num(P,'MODELLING_PCDM_OXLIM',[-45,45]);
% OmegaY parameter limits: rotation angle around Y axis (South-North)
PCDM.oylim = field2num(P,'MODELLING_PCDM_OYLIM',[-45,45]);
% OmegaZ parameter limits: rotation angle around Z axis (Bottom-Up)
PCDM.ozlim = field2num(P,'MODELLING_PCDM_OZLIM',[-45,45]);
% number of bins for probability vs parameter map (heatmap)
PCDM.heatmap_grid = field2num(P,'MODELLING_PCDM_HEATMAP_GRID',50);
% graphical parameter for heatmaps
PCDM.heatmap_saturation = field2num(P,'MODELLING_PCDM_HEATMAP_SATURATION',0.4);
% number of bins used to smooth the maximum probability curve
PCDM.heatmap_smooth_span = field2num(P,'MODELLING_PCDM_HEATMAP_SMOOTH_SPAN',5);
% polynomial degree to smooth the maximum probability curve
PCDM.heatmap_smooth_degree = field2num(P,'MODELLING_PCDM_HEATMAP_SMOOTH_DEGREE',1);
% minimum number of models to compute maximum probability curve
PCDM.newlimit_threshold = field2num(P,'MODELLING_PCDM_NEW_THRESHOLD',2);
% tolerance ratio to extend the edge limits
PCDM.newlimit_edge_ratio = field2num(P,'MODELLING_PCDM_NEW_LIMIT_EDGE_RATIO',20);
% factor of extension (from the previous interval) when reaching an edge
PCDM.newlimit_extend = field2num(P,'MODELLING_PCDM_NEW_LIMIT_EXTEND',1);
% option to export supplementary graphs (intermediate results per iteration)
PCDM.supplementary_graphs = isok(P,'MODELLING_PCDM_SUPPLEMENTARY_GRAPHS');
tickfactorlim = 5e3; % above 5 km width/depth axis will be in km

% MODELTIME parameters
modeltime_source_type = field2str(P,'MODELTIME_SOURCE_TYPE','isotropic','notempty');
Expand Down
4 changes: 2 additions & 2 deletions CODE/python/AAA/requirements.txt
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ obspy==1.2.2
pandas==0.25.3
pathlib2==2.3.5
python-speech-features==0.4
scikit-learn==0.22.2.post1
scipy==1.4.1
scikit-learn==1.5.0
scipy==1.10.0
sympy==1.0
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
#
if [ $# -lt 2 ]; then
echo " Syntax: download_orbit DAYS DEST [options]"
echo "Description: downloads best avalaible orbit for chosen dates from the"
echo "Description: downloads best available orbit for chosen dates from the"
echo " JPL secured web server (see "
echo " https://sideshow.jpl.nasa.gov/pub/JPL_GNSS_Products)"
echo " Arguments:"
echo " DAYS = number of days to process (from start day)"
echo " DEST = root directory where orbits shall be saved"
echo " Options:"
echo " -o ORBIT = type of orbit (Ultra, Rapid or Final)"
echo " -o ORBIT = type of orbit (Ultra, Rapid, Final, or Rapid_GE)"
echo " -d STARTDAY = days to start retrieving (YYYY/mm/dd)"
echo " -r DAYS = remove orbit files older than DAYS days"
echo " -v = verbose mode"
Expand Down Expand Up @@ -64,7 +64,7 @@ for (( i=1; i<=$#; i++)); do
if [ "$ORBIT" != "Rapid" ]; then
if [ "$ORBIT" != "Final" ]; then
if [ "$ORBIT" != "Rapid_GE" ]; then
echo "Error : Please enter orbit as Ultra, Rapid or Final"
echo "Error : Please enter orbit as Ultra, Rapid, Final, or Rapid_GE"
exit 0
fi
fi
Expand Down Expand Up @@ -126,7 +126,7 @@ for day in $DAYLIST; do
echo " OK."
break
else
echo " not yet avalaible!"
echo " not yet available!"
fi

else
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ for station in $NODES; do
echo " file $gipsyres [$orbit] already exists..."
break
else
NFORBLOOP=0 ### we force the standard case here (fiducial orbits)
if [ "$ORBITSDIR" != "" ]; then #running Gipsy from local orbit
case $orbit in
flinn)
Expand All @@ -369,7 +370,6 @@ for station in $NODES; do

else #running Gipsy from direct download
ORBITOPT=$orbit
NFORBLOOP=0 ### we force the standard case here (fiducial orbits)
fi

# if we use NF orbits, add the necessary options -prodTypeGNSS nf -gdCov
Expand Down Expand Up @@ -437,7 +437,7 @@ for station in $NODES; do
fi
fi
done
if [ -z $ERROR ]; then
if [[ -z $ERROR && -e $LOG ]]; then
mv -f $LOG $gipsylog
gzip -f $gipsylog
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# main temporary directory (/tmp per default, change is recommended)
TMPDIRMAIN=/tmp

# prepares GIPSYX processing
# prepares GIPSYX processing (this is GipsyX's rc file, in the GipsyX folder)
source /home/wo/GipsyX-1.2/rc_GipsyX.sh

# grid of a local WebObs that contains the station list (nodes)
Expand Down
Loading

0 comments on commit eae8a77

Please sign in to comment.