function aviso_addinMITprof(ncfile) % function aviso_addinMITprof(ncfile) % add MADT (Maps of Absolute Dynamic Topography) interpolated on profile % positions available in a MITprof netcdf file. % Use OpenDap, through the loaddap function. % % fileIn: path (absolute or relative) to MITprof netcdf file % model is a string used to select the model to be loaded % 'OCCA' : ECCOv4 grid + OCCA atlas % 'SOSE59' : SOSE59 grid + atlas % process file name [pathstr, name, ext] = fileparts(ncfile); if isempty(pathstr) | strcmp(pathstr,'.'), pathstr=pwd; end if isempty(ext) | ~strcmp(ext,'.nc'), ext='.nc'; end ncfile=[pathstr '/' name ext]; if isempty(which('loaddap')), error('loaddap toolbox must be installed'); end % load profiles M=MITprof_load(ncfile,{'prof_date','prof_lat','prof_lon'}); % load data loc=[]; loc.lat=M.prof_lat; loc.lon=M.prof_lon; loc.time=M.prof_date; grid_aviso=aviso_get_grid; madt=aviso_get_madt(loc,grid_aviso); % add fields fillval=double(-9999); madt(isnan(madt))=fillval; MITprof_addVar(ncfile,['prof_madt_aviso'],'double',{'iPROF'},madt); % add attributes nc=ncopen(ncfile,'write'); ncaddAtt(nc,'prof_madt_aviso','long_name',['MADT AVISO']); ncaddAtt(nc,'prof_madt_aviso','units','m'); ncaddAtt(nc,'prof_madt_aviso','missing_value',fillval); ncaddAtt(nc,'prof_madt_aviso','_FillValue',fillval); ncclose(nc);