Skip to content
Snippets Groups Projects
Commit 0562aff5 authored by pierre.rousselot_ird.fr's avatar pierre.rousselot_ird.fr
Browse files

Possibility to play with filtering without all the processing + change offset algo

parent fb4d0911
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
*.docx
FR*/
IDMX*/
AMAZOMIX/
old_data/
doc/*.pdf
*.jnl
......
......@@ -75,7 +75,7 @@ function [zbins,zadcp1,offset,x_null]=adcp_surface_fit(zadcp,ea,surface_bins,ble
plot(-((x_null-1)*blen+blen/2+fbind),'r');
legend('Original','Reconstructed from surface reflection');
if abs(offset)>15
if any(abs(offset)>15)
reply = input('Do you want to overwrite offset? 1/0 [0]:');
if isempty(reply)
reply = 0;
......@@ -83,6 +83,7 @@ function [zbins,zadcp1,offset,x_null]=adcp_surface_fit(zadcp,ea,surface_bins,ble
if reply==1
offset=input('->Enter new offset:');
offset=offset*ones(1,length(zadcp));
else
disp(['->Cleaned median filter offset is applied']);
end
......
......@@ -5,11 +5,11 @@
clear all; close all;
%% Variables
FileToMerge1 = '/home/proussel/Documents/OUTILS/ADCP/ADCP_mooring_data_processing/ADCP_0W0N_2016_2020_1d.nc'; %.nc file to merge with
FileToMerge2 = '/media/irdcampagnes/PIRATA/PIRATA-DATA/MOORING-PIRATA/0-0/ADCP_0W0N_2020_2021_1d.nc'; %.nc file to merge
FileToMerge1 = '/media/irdcampagnes/PIRATA-DATA/MOORING-PIRATA/10W/merged_data/ADCP_10W0N_2001_2019.nc'; %.nc file to merge with
FileToMerge2 = '/media/irdcampagnes/PIRATA-DATA/MOORING-PIRATA/10W/ADCP_10W0N_2021_2023_1d.nc'; %.nc file to merge
step_subsampling = 1; % 1=daily
plot_data = 1;
mooring.name = '0W0N';
mooring.name = '10W0N';
mooring.lat = 0;
mooring.lon = 0;
freq = '150 khz Quartermaster';
......@@ -35,14 +35,14 @@ ncfile2.v = ncread(FileToMerge2,'VCUR');
%% Create depth matrix
%depth = max(vertcat(ncfile1.depth,ncfile2.depth)):ncfile1.depth(2)-ncfile1.depth(1):min(vertcat(ncfile1.depth,ncfile2.depth));
%depth = fliplr(depth);
max(vertcat(ncfile1.depth,ncfile2.depth))
min(vertcat(ncfile1.depth,ncfile2.depth))
max(vertcat(ncfile1.depth,ncfile2.depth));
min(vertcat(ncfile1.depth,ncfile2.depth));
depth = 0:5:320;
%% Create time matrix
time = vertcat(ncfile1.time,ncfile2.time);
[YY,MM,DD,hh,mm,ss] = datevec(time+datenum(1950,01,01));
time = julian(YY,MM,DD,hh,mm,ss);
%time = julian(YY,MM,DD,hh,mm,ss);
%% Create u/v matrix
for ii = 1:length(ncfile1.time)
......@@ -57,10 +57,11 @@ end
u = vertcat(u1,u2);
v = vertcat(v1,v2);
time = julian(YY,MM,DD,hh,mm,ss);
time = time*ones(1,length(depth));
% create a continuous series of daily data, ranging from min(d) to max(d)
final_time = ceil(min(min(time))):0.25:floor(max(max(time)));
final_time = ceil(min(min(time))):1:floor(max(max(time)));
ADCP_final.u = NaN(length(final_time),length(depth));
ADCP_final.v = NaN(length(final_time),length(depth));
......
This diff is collapsed.
function extract_to_netcdf(fpath_output, mooring, data, statut,d_fillvalue)
%% Write netcdf file
disp('****')
disp('Creating .nc file')
% Input parameters for NETCDF Global Attributes
tc_globAttFilename = fullfile('tools/input_GlobalAttrParameters.xls'); % JLL 2020/12 Il serait judicieux de remonter cette valeur en début du script template_get_adcp_data.m
%% Prepare informations and variables required to create NETCDF file %%
[yr_start , ~, ~] = gregorian(data.inttim(1));
[yr_end, ~, ~] = gregorian(data.inttim(length(data.inttim)));
% Read inputs metadata required for NETCDF Global Attributes
[~,~,cell_ncAttributes] = xlsread(tc_globAttFilename);
% Complete output path and filename
tc_ncFilenam_out = fullfile(fpath_output,['ADCP_',mooring.name,'_',num2str(yr_start),'_',num2str(yr_end),'_' statut '.nc']);
% Assign a "4D-size" (TIME,DEPTH,LATITUDE,LONGITUDE) to the ADCP current variables : UINTFILT, VINTFILT
td_uADCP = ones(numel(data.inttim),numel(data.Z),numel(data.lat),numel(data.lon)) * d_fillvalue;
td_uADCP(:,:,1,1) = data.uintfilt';
td_vADCP = ones(numel(data.inttim),numel(data.Z),numel(data.lat),numel(data.lon)) * d_fillvalue;
td_vADCP(:,:,1,1) = data.vintfilt';
% Flip for convention
data.Z = fliplr(data.Z);
td_uADCP = fliplr(td_uADCP);
td_vADCP = fliplr(td_vADCP);
% Group general ADCP mooring informations and ADCP data to be written in NETCDF file format
struct_dataADCP = struct('mooringName', mooring.name, 'mooringLat', mooring.lat,...
'mooringLon', mooring.lon, 'time', data.inttim, 'depth', data.Z,...
'u', td_uADCP, 'v', td_vADCP);
%% Write netcdf file %%
f_w_ADCP_ncOS(tc_ncFilenam_out,cell_ncAttributes,struct_dataADCP,d_fillvalue);
disp('****')
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment