80 likes | 312 Views
MyOcean Ferrybox with Matlab. Requirements. Matlab ( version ?) Must have ftp and ncread. Read netCDF. ncf = '..DataGO_LATEST_TS_FB_ColorFantasy_20130607.nc '; nci = ncinfo ( ncf ); arrayfun (@(x)( x.Name ), nci (1).Variables, ' uniformoutput ', false )
E N D
MyOcean Ferrybox withMatlab Pierre Jaccard
Requirements • Matlab (version?) • Must have ftp and ncread Pierre Jaccard
Read netCDF ncf= '..\Data\GO_LATEST_TS_FB_ColorFantasy_20130607.nc'; nci = ncinfo(ncf); arrayfun(@(x)(x.Name), nci(1).Variables, 'uniformoutput', false) t = ncread(ncf, 'TIME'); T = ncread(ncf, 'TEMP'); Pierre Jaccard
Calculate Time t = ncread(ncf, 'TIME'); t0 = datenum(1950, 1, 1); t1 = t0 + t; datestr(t1(1)) datestr(t1(end)) Pierre Jaccard
Plot Temperature I T = ncread(ncf, 'TEMP'); plot(t1,T); grid on datetick Pierre Jaccard
Quality Flags qcT= ncread(ncf, 'TEMP_QC'); qct = ncread(ncf, 'TIME_QC'); qct = qct'; qcp = ncread(ncf, 'POSITION_QC'); qcp = qcp'; qcm = (qcT > 0) & (qcT < 3) & (qct > 0) & (qct < 3) & (qcp > 0) & (qcp < 3); any(qcm) all(qcm) Pierre Jaccard
Plot Temperature II figure; hold on plot(t1(qcm),T(qcm), 'g.', 'markersize', 2); plot(t1(~qcm),T(~qcm), 'r.', 'markersize', 2); grid on datetick Pierre Jaccard
FTP host = 'vftp1.ifremer.fr'; path = '/INSITU_GLO_NRT_OBSERVATIONS_013_030/'; f = ftp(host, user, pass); cd(f,path); list = dir(f); mget(ftp, remote, local) close(f); Pierre Jaccard