├── .DS_Store ├── .gitignore ├── ARV ├── .DS_Store ├── ImportGPSfromSD.m ├── PixHawk │ ├── ParseATTlines.m │ ├── ParseMAGline.m │ ├── ParseMAGlogs.m │ ├── ParsePixhawkLogs.m │ ├── PlotPixhawkAtt.m │ ├── PlotPixhawkMag.m │ ├── ReadPixhawkAttLog.m │ ├── ReadPixhawkMag2Log.m │ ├── ReadPixhawkMagLog.m │ └── importIMUgps.m ├── PlotGpsSummary.m ├── README.txt └── RTI_ADCP │ ├── PlotBeamAmpsRTI.m │ ├── PlotBeamCorrsRTI.m │ ├── PlotBeamVelsRTI.m │ ├── PlotEarthVelsRTI.m │ ├── RTI_Array2Struct.m │ ├── ReadRTI.m │ ├── ReadRTI_ENSfiles.m │ └── ReadRTImatfiles.m ├── CTD_Chipod ├── .DS_Store ├── ChipodProcessingGuide │ ├── .DS_Store │ ├── CtdChipodProcessingGuide.pdf │ ├── CtdChipodProcessingGuide.tex │ ├── README.md │ ├── SN1013_08402_Fig0_RawCTD.png │ ├── SN1013_08402_Fig1_RawChipodTS.png │ ├── SN1013_08402_Fig2_w_TimeOffset.png │ ├── SN1013_08402_Fig3_w_TimeOffset_Zoom.png │ ├── SN1013_08402_Fig4_dTdtSpectraCheck.png │ ├── SN1013_08402_Fig5_T_P_dTdz_fspd.png │ ├── SN1013_08402_Fig6_downcast_chi_T1_avgPhist.png │ ├── SN1013_08402_Fig6_upcast_chi_T1_avgPhist.png │ ├── SN1013_08402_Fig7_downcast_chi_T1_avg_chi_KT_dTdz.png │ └── SN1013_08402_Fig7_upcast_chi_T1_avg_chi_KT_dTdz.png ├── Old │ ├── AlignAndCalibrateChipodCTD.m │ ├── CombineTowYoChi.m │ ├── ComputeChi_for_CTDprofile.m │ ├── Compute_CTDchipod_profile.m │ ├── MakeResultsTextFile_ChiCalc.m │ ├── PrepareCTDbinnedChipod.m │ ├── Prepare_Avg_for_ChiCalc.m │ ├── fix_fig2.m │ ├── get_profile_inds.m │ ├── misc24Mar.m │ ├── misc_31Mar.m │ ├── misc_plotting.m │ ├── process_chipod_script.m │ ├── process_chipod_script_june_ttide_V2.m │ └── tests31Mar.m ├── README.md ├── Templates │ ├── .DS_Store │ ├── Chipod_Deploy_Info_template.m │ ├── Chipod_Notes_Template_AP.tex │ ├── DoChiCalc_Template.m │ ├── Load_chipod_paths_Template.m │ ├── MakeCasts_CTDchipod_Template.m │ ├── Make_Combined_Chi_Struct_Template.m │ ├── Make_kml_Template.m │ ├── PlotChipodDataRaw_Template.m │ ├── PlotChipodSpectra_Template.m │ ├── PlotFinalComb_Template.m │ ├── PlotScatterPlots_Template.m │ ├── PlotXCsummaries_Template.m │ ├── Plot_TP_profiles_EachCast_Template.m │ ├── Readme.md │ ├── SummarizeProc_Template.m │ ├── VisCheck_TP_profiles_EachCast_Template.m │ ├── add_plot_ctd_Template.m │ ├── bad_file_list_Template.m │ └── old │ │ └── Plot_XC_Template.m └── mfiles │ ├── .DS_Store │ ├── AddBathyToChipod.m │ ├── Add_CTD_to_XC.m │ ├── AlignChipodCTD.m │ ├── CTD_chipod_profile_summary.m │ ├── CTD_chipod_profile_summary_v2.m │ ├── CalibrateChipodCTD.m │ ├── CheckFileStatusChipod.m │ ├── ChiPodTimeseriesPlot.m │ ├── ChkMkDir.m │ ├── Compute_N2_dTdz_forChi.m │ ├── Compute_N2_dTdz_forChi_2.m │ ├── Compute_N2_dTdz_forChi_line.m │ ├── Compute_N2_dTdz_forChi_raw_line.m │ ├── FindChipodGlitches2.m │ ├── FindContigSeq.m │ ├── MakeCasts_CTDchipod_function.m │ ├── MakeChiPathStr.m │ ├── MakeChiPlotsXC_General.m │ ├── MakeCtdChiWindows.m │ ├── MakeCtdChiWindows_simple.m │ ├── MakeResultsTextFile.m │ ├── MakeResultsTextFile_ChiCalc_DoChiCalc.m │ ├── MakeTableChiDeploy.m │ ├── MySubplot.m │ ├── NANinterp.m │ ├── PlotChipodDataRaw_General.m │ ├── PlotChipodXC_OneVarAllSN.m │ ├── PlotChipodXC_allVars.m │ ├── PlotRawCTD.m │ ├── PlotSavedChiSpectra.m │ ├── PlotTimeOffsetsCTDchipod_General.m │ ├── Plot_TP_profiles_EachCast_CTDchipod.m │ ├── PrintChiPathsGeneral.m │ ├── SetDefaultChiParams.m │ ├── SubplotLetterMW.m │ ├── SummarizeChiProc.m │ ├── TimeOffset.m │ ├── Write_Latex_Notes.m │ ├── agutwocolumn.m │ ├── binprofile.m │ ├── calibrate_chipod_dtdt.m │ ├── check_data_struct_ctd_chipod.m │ ├── ctd_rmdepthloops.m │ ├── diffs.m │ ├── do_chi_calc_ctd_chipod.m │ ├── ezpc.m │ ├── findsegments.m │ ├── freqline.m │ ├── get_T_calibration.m │ ├── gridxy.m │ ├── killcolorbar.m │ ├── load_chipod_data.m │ ├── load_mini_chipod.m │ ├── make_combined_chi_struct.m │ ├── make_ctd_chipod_folders.m │ ├── plot_XC_summaries.m │ ├── plot_ctd_from_proc_info.m │ ├── sw_tcond_ctdchi.m │ ├── sw_tdif_ctdchi.m │ ├── sw_visc_ctdchi.m │ ├── vline.m │ ├── wsink.m │ ├── wysiwyg.m │ ├── xtloff.m │ └── ytloff.m ├── Chameleon2 └── Version2015 │ ├── Cham2LoadTemplate.m │ ├── ChamFile.m │ ├── ReadCham2Header.m │ ├── ReadGarmin.m │ ├── WriteCham2Header.m │ ├── chamview_p.fig │ ├── chamview_p.m │ ├── fast_psd.m │ ├── gain_offset.fig │ ├── gain_offset.m │ ├── header.m │ ├── headerpanel_1.fig │ ├── headerpanel_1.m │ ├── headers │ ├── cham2_0401.cht │ ├── cham2_0401.hdr │ ├── cham2_0402.cht │ ├── cham2_0402.hdr │ ├── cham2_0403.cht │ ├── cham2_0403.hdr │ ├── cham2_0404.cht │ └── cham2_0404.hdr │ ├── hs_err_pid192.log │ ├── plot_chameleon_test.m │ ├── raw_load_cham2.m │ ├── raw_load_cham2_eq14_ch17.m │ ├── space.m │ └── wf_init.m ├── DAQ ├── DAQTempDiff.mat ├── Instructions for Noise Cals for T.docx └── NoiseDAQ.m ├── New_PPOD ├── PPOD Processing Software Update.docx ├── convert_ppod6.m ├── ldconvHSP.m ├── ldconvpp6.m ├── ldconvpp6_v2.m ├── ldhsp.m ├── ldpp6.m ├── ldtilt.m ├── loadppod6.m ├── longloadppod.m ├── longloadtilt.m ├── longplottilt.m ├── pp6header.m ├── readppod5.m └── readppod6.m ├── README.txt ├── a_realtime_oceanus ├── adcp │ ├── backup_currents_timer_oceanus.m │ ├── make_and_backup_currents_timer_oceanus.m │ ├── make_currents_timer_oceanus.m │ ├── set_currents_oceanus.m │ ├── show_currents_oceanus.m │ └── utilities │ │ ├── add_uhpaths.m │ │ ├── adduicontrols_oceanus.m │ │ ├── copyalladcp.m │ │ ├── copyalladcp_dir.m │ │ ├── get_xfraw_sjw.m │ │ ├── process_currents_oceanus.m │ │ ├── read_metstation_bow.m │ │ ├── restruct_ap.m │ │ ├── rm_uhpaths.m │ │ └── uhdastosci.m ├── chameleon │ ├── README_nofiltgen.rtf │ ├── backup_chameleon_timer_oceanus.m │ ├── calibrate_chameleon_sjw.m │ ├── make_chameleon_timer_oceanus.m │ ├── set_chameleon_oceanus.m │ ├── show_chameleon_timer_oceanus.m │ └── utilities │ │ ├── add_to_sum_oceanus.m │ │ ├── cali_realtime_oceanus.m │ │ ├── cali_realtime_oceanus_v2.m │ │ ├── cali_realtime_oceanus_v3.m │ │ ├── initialize_summary_file_oceanus.m │ │ ├── initialize_summary_file_oceanus_old.m │ │ ├── modify_header.m │ │ ├── plot_cham_summary.m │ │ ├── plot_cham_summary_timer.m │ │ ├── process_file_oceanus.m │ │ ├── process_file_oceanus_v2.m │ │ ├── process_file_oceanus_v3.m │ │ └── run_chambackup_oceanus.m ├── ctd │ ├── make_ctd_oceanus.m │ └── read_ctd_oceanus.m └── das │ ├── average_das_data.m │ ├── combine_das_oceanus.m │ ├── copy_proc_das.m │ ├── copy_raw_das.m │ ├── das_timer.m │ ├── make_das_oceanus.m │ ├── run_das.m │ ├── run_das_timer.m │ └── utilities │ ├── read_echosounder_well.m │ ├── read_fluorometer_flowthrough.m │ ├── read_gnss_adu5_bow.m │ ├── read_gnss_bow_gps.m │ ├── read_gyrocompass.m │ ├── read_metstation_03stb.m │ ├── read_metstation_bow.m │ ├── read_oxygen_mll_flowthrough.m │ ├── read_radiometer_03port.m │ ├── read_radiometer_metmast.m │ ├── read_radiometer_metmast_par.m │ ├── read_raingauge.m │ ├── read_raingauge_metmast_1.m │ ├── read_thermometer_bow.m │ ├── read_thermometer_fwdintake.m │ ├── read_thermometer_hull.m │ ├── read_transmissometer_flowthrough.m │ ├── read_truewind_bow_adu5.m │ ├── read_truewind_bow_gyro_bowgps.m │ ├── read_truewind_metmast_adu5.m │ ├── read_truewind_metmast_gyro_gps.m │ └── read_tsg_flowthrough.m ├── adcp ├── Contents.m ├── PlotRDI_BmCorrs.m ├── PlotRDI_BmVels.m ├── PlotRDI_Intens.m ├── beam2earth.m ├── beam2earth_workhorse.m ├── carter.m ├── despike.m ├── get_adcp_gps_fname.m ├── make_workhorse_mat.m ├── mergefields.m ├── mergefields_jn.m ├── rdADCP │ ├── adcpdemo.m │ ├── ctd_rd.m │ ├── ctd_rd_jn.m │ ├── rdpadcp.m │ ├── rdradcp.m │ └── read_sbe.m ├── read_workhorse.m ├── read_workhorse_ap.m ├── trimbad.m ├── updatedplot2.m ├── updatedsave.m └── workhorsetosci.m ├── adp ├── ADPheader.inf ├── GetUnitVectors.m ├── beam2earth_ADP.m ├── read_adp.m ├── readme_ADPheader.txt ├── splitADP.m ├── split_ADP.c ├── split_ADP.dll.old └── split_ADP.mexw32 ├── adv ├── ADV_mooring.m ├── calc_I.m ├── calc_adv_epsilon.m ├── get_princ_axis.m ├── read_adv.m ├── splitADV.m ├── split_ADV.c └── split_ADV.dll ├── biosonics ├── Contents.m ├── fastreadbio.m ├── get_long_bio.m ├── make_decimatedfiles.m ├── plot_bio_decimated.m ├── plot_bio_distance.m ├── plot_bio_times.m ├── readbio.m ├── readbiodrv.c ├── readbiodrv.c.old ├── readbiodrv.mexw32 ├── readbiodrv_ted2.c ├── readbiodrv_ted2.mexw64 ├── run_biobackup.m └── run_biosonics_backup.m ├── calibrate ├── 3pitot_xfr_fcn_from_noise.m ├── ChipodTcalibration.m ├── ChipodTcalibrationV2.m ├── TNoiseCal2.fig ├── TNoiseCal2.m ├── calibrate_3pitot.m ├── calibrate_Tnode.m ├── calibrate_chipod_T.m ├── calibrate_chipod_T_old.m ├── calibrate_chipod_compass.m ├── calibrate_compass.m ├── calibrate_polynomial.m ├── calibrate_pressure.m ├── calibrate_pressure_old_July2013.m ├── compute_compass_calibration_coefficients.m ├── conductivity_coeff ├── drop_point_2019.m ├── get_plot_TCcalibrations.m ├── gust_calibrate.m ├── labTCcalibration.m ├── labTCcalibrationGUI.m ├── make_Tnode_calibration_file.m ├── make_chiT_calibration_file.m ├── make_chiT_calibration_file_old.m ├── read_seabird_for_chiTcalibration.m ├── recalibrate_TC.m ├── runTcalibration.m ├── runTcalibrationV2.m ├── run_compute_cali_compass.m ├── shear_xfr_fcn_from_noise.m └── t_xfr_fcn_from_noise.m ├── chamview_p ├── ReadCham2Header.m ├── ReadGarmin.m ├── WriteCham2Header.m └── wf_init.m ├── chipod ├── Chitcal.fig ├── Chitcal.m ├── chipod_checkout.m ├── chipod_summary │ ├── make_avg_chipod.m │ ├── multiple_chipod_summary.m │ ├── plot_quick_summary.m │ ├── plot_quick_summary_vLTT.m │ ├── quick_avg_noadcp.m │ ├── replace_header.m │ └── subaxis.m ├── chitcalibrate.m ├── chitcalibrate1.m ├── chivert.m ├── compute_chi │ ├── calibrate_tp_forchi.m │ ├── get_chipod_cals.m │ ├── get_chipod_cals_old.m │ ├── get_chipod_cals_old160112.m │ ├── get_chipod_cals_old2.m │ ├── get_chipod_cals_old_April2014.m │ ├── get_chipod_cals_old_Oct13.m │ ├── get_chipod_chi.m │ ├── get_chipod_chi_old_Oct13.m │ ├── get_chipod_raw.m │ ├── get_chipod_raw1.m │ ├── get_chipod_raw_old.m │ ├── get_chipod_raw_old160112.m │ ├── get_chipod_raw_old_Oct13.m │ ├── get_current_spd.m │ ├── get_dTdz_byslope.m │ ├── get_mooring.m │ ├── get_mooring_old160112.m │ ├── get_mooring_old_Oct13.m │ ├── get_tao_spd.m │ ├── make_noise_spectra.m │ ├── readme.txt │ ├── run_calc_chipod_chi.m │ ├── run_calc_chipod_chi1.m │ ├── run_calc_chipod_chi2.m │ ├── run_calc_chipod_chi_old.m │ ├── run_calc_chipod_chi_old160112.m │ ├── run_calc_chipod_chi_old_20140410.m │ ├── run_calc_chipod_chi_old_Oct13.m │ └── run_calc_chipod_chi_rama13.m ├── inertial_subrange │ ├── binavg.m │ ├── calc_chi_inertial_subrange.m │ ├── calc_chi_inertial_subrange_old.m │ ├── e_ic.m │ └── run_calc_chi_inertial_subrange.m ├── integrate_acc.m ├── integrate_acc_old.m ├── integrate_spectrum.m ├── mergedata.m ├── plot_avg_file.m ├── quickplot_chipod.m ├── raw_load_chipod.m ├── raw_load_chipod_old160113.m ├── raw_load_chipod_old160621.m ├── raw_load_chipod_old_Oct13.m ├── raw_load_chipod_test.m ├── raw_load_chipodhead.m ├── replace_header.m └── transfer_function │ ├── cali_transfer.m │ ├── compute_spectrum.m │ ├── compute_transfer_functions_filters.m │ ├── compute_transfer_functions_filters_eq08.asv │ ├── compute_transfer_functions_filters_eq08.m │ ├── load_data.m │ ├── my_filter.m │ ├── plot_data_select_patch.m │ ├── plot_profiles.m │ ├── probnames.m │ ├── readme.txt │ ├── save_data.m │ └── spctm_avg.m ├── chipod_checkout.m ├── colormaps ├── anglemap.m ├── autumn.m ├── autumn_dark.m ├── bluegreen.m ├── bluered.m ├── bluered2.m ├── bluered3.m ├── bone2.m ├── cbrewer.m ├── cbrewer_preview.jpg ├── coldhot.m ├── colorbrewer.mat ├── cooldark.m ├── coolhot.m ├── coolwhite.m ├── greybrown.m ├── intensemap.m ├── interpolate_cbrewer.m ├── invgray.m ├── invhot.m ├── land.m ├── land2.m ├── land3.m ├── n2.m ├── ocean.m ├── ocean2.m ├── plot_brewer_cmap.m ├── pmelcmap.m ├── rbmag.m ├── redblue.m ├── redblue2.m ├── redblue3.m ├── redblue4.m ├── redblue5.m ├── reliefland.m ├── reliefsea.m ├── reliefsea2.m ├── reliefsealand.m ├── sea.m ├── turbo.m └── yellowred.m ├── cruises └── .DS_Store ├── ctd_processing ├── .DS_Store ├── MakeCtdConfigFromXMLCON.m ├── PlotBinnedCTDprofiles.m ├── PlotBinnedCTDprofiles_vstime.m ├── PlotRawCTDprofiles.m ├── README.txt ├── Templates │ └── Process_CTD_hex_Template.m ├── binavg.m ├── cfgload.m ├── cfgload000 ├── cfgload000.m ├── clip.m ├── compute_overturns2.m ├── ctd_bincast.m ├── ctd_binning.m ├── ctd_bins.m ├── ctd_cleanup.m ├── ctd_cleanup2.m ├── ctd_cleanup_1hz.m ├── ctd_correction.m ├── ctd_correction2.m ├── ctd_correction_updn.m ├── ctd_oxygen_lag.m ├── ctd_rmdepthloops.m ├── ctd_rmloops.m ├── ctd_rmloops2.m ├── ctd_switch.m ├── ctdpreen.m ├── dirs.m ├── fillstruct.m ├── findsegments.m ├── freq2cond.m ├── freq2pressure.m ├── freq2temp.m ├── freq2temperature.m ├── freqconvert.m ├── hex_parse.m ├── hex_parse_v2.m ├── hex_read.m ├── hexword2freq.m ├── hexword2lonlat.m ├── hexword2pststat.m ├── hexword2spar.m ├── hexword2volt.m ├── inearby.m ├── interpbadsegments.m ├── load_cnv.m ├── midpoints.m ├── nanfilt.m ├── parseXML.m ├── physicalunits.m ├── preen.m ├── structcat.m ├── swcalcs-1.m ├── swcalcs.m ├── tms_tc_glitchcorrect.m ├── volt2ox.m └── wsink.m ├── droppoint ├── do_droppoint.m └── drop_point.m ├── fcs ├── comp_load_solo.m ├── fcs_comp_checkout.m ├── fcs_raw_checkout.m ├── fcs_raw_checkout_bdr.m ├── findDiveFCS.m ├── plot_fcs_profiles.m └── raw_load_solo.m ├── general ├── .DS_Store ├── FetDurHTUxt.m ├── PlotBootProfile.m ├── aclear.m ├── bindata.m ├── bindata1d.m ├── boot_v5.m ├── bootstrap_profile.m ├── butter2d.m ├── cakima.m ├── calc_stratification.m ├── chi2conf.m ├── cropdata.m ├── crossing.m ├── databin.m ├── databin_slop.m ├── datetickzoom.m ├── ddz.m ├── ddz2.m ├── ddz4.m ├── decimatefields.m ├── deglitch.m ├── dirdiff.m ├── dn2yd.m ├── extrapolate_data.m ├── fast_cohere.m ├── fast_fillgap.m ├── fast_psd.m ├── fillgap.m ├── fillgap2d.m ├── filter_series.m ├── gappy_bispectra.m ├── gappy_detrend.m ├── gappy_fast_cohere.m ├── gappy_fast_cohere_old.m ├── gappy_filt.m ├── gappy_filt_old160113.m ├── gappy_filter.m ├── gappy_max.m ├── gappy_mean.m ├── gappy_min.m ├── gappy_psd.m ├── gappy_rotary.m ├── gappy_std.m ├── gappy_var.m ├── gappy_wave.m ├── getprefix.m ├── hist2d.m ├── hist2d_withCI ├── interp8.m ├── interp_missing_data.m ├── invert_filt.m ├── kraichnan.m ├── make_newtimebase.m ├── makelen.m ├── makelen2.m ├── matrix_cohere.m ├── matrix_psd.m ├── nanboot_median.m ├── nanboot_v5.m ├── nanconf.m ├── nandemean.m ├── nanrms.m ├── nasmyth.m ├── nasmyth2.m ├── neutral_regress.m ├── nonmoninterp1.m ├── psd2d_rotary.m ├── read_levitus_binary.m ├── rms.m ├── rms_n.m ├── sign_corr.m ├── smooth.m ├── smooth2.m ├── space.m ├── spice.m ├── srfbuoyancyflux.m ├── surfaceflux.m ├── text_sc.m ├── unv_spec.m ├── unv_spec_matrix.m ├── yearday2date.m └── zeroxing.m ├── graphics ├── Contents_cm_cb_utilities.m ├── MakeQTMovie.m ├── PlotBootProfile.m ├── ReadQTMovie.m ├── add_second_axis.m ├── addcmap.m ├── addcol.m ├── aguonecolumn.m ├── agutwocolumn.m ├── arrow3.m ├── arrow6.m ├── arrow_old.m ├── boundedline.m ├── cbfit.m ├── cbfreeze.m ├── cbhandle.m ├── cblabel.m ├── cbunits.m ├── closeplot.m ├── cm_and_cb_utilities.png ├── cmapping.m ├── cmfit.m ├── cmjoin.m ├── cmlines.m ├── colordot.m ├── colorline.m ├── digitize_plot.m ├── errorbar2.m ├── errorbar3.m ├── errorbar_x.m ├── errorbarxy.m ├── export_fig │ ├── .gitignore │ ├── .ignore │ │ ├── ghostscript.txt │ │ └── gs_font_path.txt │ ├── ImageSelection.class │ ├── ImageSelection.java │ ├── LICENSE │ ├── README.md │ ├── append_pdfs.m │ ├── copyfig.m │ ├── crop_borders.m │ ├── eps2pdf.m │ ├── export_fig.m │ ├── fix_lines.m │ ├── ghostscript.m │ ├── im2gif.m │ ├── isolate_axes.m │ ├── pdf2eps.m │ ├── pdftops.m │ ├── print2array.m │ ├── print2eps.m │ ├── read_write_entire_textfile.m │ ├── user_string.m │ └── using_hg2.m ├── exportfig.m ├── facetsurface.m ├── freezeColors.m ├── freezeColors_demo.m ├── jtext.m ├── kdatetick.m ├── kdatetick2.m ├── m_colordot.m ├── m_map │ ├── Contents.m │ ├── doc │ │ ├── SouthChinaSea.png │ │ ├── VanHarb.png │ │ ├── exColmaps.png │ │ ├── exMAG.png │ │ ├── exSAR.png │ │ ├── ex_ssmi2.png │ │ ├── exargo.png │ │ ├── exbathym.png │ │ ├── exblueT.png │ │ ├── exblueocean.png │ │ ├── exgoog.png │ │ ├── exgshhs.png │ │ ├── exlamber.png │ │ ├── exmiller.png │ │ ├── exmodis.png │ │ ├── exncread.png │ │ ├── exobl2.png │ │ ├── exquiv.png │ │ ├── exrring.png │ │ ├── exsinus.png │ │ ├── exspeckle.png │ │ ├── exsst.png │ │ ├── exstepjet.png │ │ ├── exstepjetT.png │ │ ├── exster.png │ │ ├── extbase.png │ │ ├── exterra.png │ │ ├── extrack1.png │ │ ├── exvec.png │ │ ├── map.css │ │ ├── mlogo.png │ │ ├── new.gif │ │ ├── shaded1.png │ │ ├── stepjet.png │ │ └── usermap.gif │ ├── m_annotation.m │ ├── m_coast.m │ ├── m_colmap.m │ ├── m_contfbar.m │ ├── m_contour.m │ ├── m_contourf.m │ ├── m_coord.m │ ├── m_demo.m │ ├── m_elev.m │ ├── m_ellipse.m │ ├── m_etopo2.m │ ├── m_etopo2.m.OLD │ ├── m_fdist.m │ ├── m_geo2mag.m │ ├── m_geodesic.m │ ├── m_grid.m │ ├── m_grid_old.m │ ├── m_gshhs.m │ ├── m_gshhs_c.m │ ├── m_gshhs_f.m │ ├── m_gshhs_h.m │ ├── m_gshhs_i.m │ ├── m_gshhs_l.m │ ├── m_hatch.m │ ├── m_idist.m │ ├── m_jet.m │ ├── m_legend.m │ ├── m_line.m │ ├── m_ll2xy.m │ ├── m_lldist.m │ ├── m_mag2geo.m │ ├── m_patch.m │ ├── m_pcolor.m │ ├── m_plot.m │ ├── m_plotbndry.m │ ├── m_proj.m │ ├── m_quiver.m │ ├── m_range_ring.m │ ├── m_rectangle.m │ ├── m_ruler.m │ ├── m_scale.m │ ├── m_scatter.m │ ├── m_shadedrelief.m │ ├── m_shaperead.m │ ├── m_streamline.m │ ├── m_tba2b.m │ ├── m_tbase.m │ ├── m_text.m │ ├── m_track.m │ ├── m_ungrid.m │ ├── m_usercoast.m │ ├── m_utmgrid.m │ ├── m_vec.m │ ├── m_windbarb.m │ ├── m_xy2ll.m │ ├── m_xydist.m │ ├── map.html │ ├── mapug.html │ ├── mygrid_sand2.m │ ├── private │ │ ├── clabel.m.OLD │ │ ├── m_coasts.mat │ │ ├── mc_coords.m │ │ ├── mc_ellips.m │ │ ├── mp_azim.m │ │ ├── mp_conic.m │ │ ├── mp_cyl.m │ │ ├── mp_omerc.m │ │ ├── mp_tmerc.m │ │ ├── mp_utm.m │ │ ├── mu_coast.m │ │ └── mu_util.m │ └── wysiwyg.m ├── multcol.m ├── multi_print.m ├── multicmap.m ├── my_colorbar.m ├── ncquiverref.m ├── nicecolor.m ├── pointcolor.m ├── polar_hist2d.m ├── putonleft.m ├── resize_gca.m ├── saveppt.m ├── setpaper.m ├── smallbar.m ├── smallbar2.m ├── stickpl.m ├── sublabel.m ├── subplot2.m ├── text_sc.m ├── unfreezeColors.m └── wysiwyg.m ├── gust ├── GusT_summary.m └── raw_load_gust.m ├── marlcham ├── Contents.m ├── README ├── average_data.m ├── average_data_gen.m ├── average_data_gen1.m ├── average_data_gen1_smallbins_for_T_S.m ├── average_data_gen1_test1.m ├── average_data_gen1_test2.m ├── average_data_new.m ├── batch.m ├── calc_chi.m ├── calc_density.m ├── calc_dynamic_z.m ├── calc_epsilon.m ├── calc_epsilon1.m ├── calc_epsilon_filt1.m ├── calc_epsilon_filt_gen.m ├── calc_epsilon_matrix.m ├── calc_order.m ├── calc_salt.m ├── calc_salt_oceanus.m ├── calc_shearspec.m ├── calc_sigma.m ├── calc_theta.m ├── cali_script.m ├── calibrate.m ├── calibrate │ ├── calibrate_fallspd.m │ ├── calibrate_p.m │ ├── calibrate_poly.m │ ├── calibrate_s.m │ ├── calibrate_tc.m │ ├── calibrate_tcp.m │ ├── calibrate_tilt.m │ ├── calibrate_tp.m │ ├── calibrate_tp_cpd.m │ ├── calibrate_uc.m │ ├── calibrate_w.m │ ├── calibrate_w_old.m │ └── calibrate_w_stat.m ├── combine_ttc.m ├── convertHead.m ├── copy_files.m ├── copy_series.m ├── correct_w.m ├── density_contours.m ├── determine_depth_range.m ├── determine_depth_range2.m ├── determine_depth_range3.m ├── extrapolate_depth_range.m ├── find_bot.m ├── find_top.m ├── fit_epsilon.m ├── get_isopycnal.m ├── get_sensors.m ├── integrate.m ├── integrate_multi.m ├── integrate_new.m ├── issync.m ├── lag_sensor.m ├── lonlattox.m ├── make_time_series.m ├── marlin_summary_control.m ├── master_cal.m ├── mg_average_data_gen.m ├── mg_calc_order.m ├── mg_calc_salt.m ├── mg_calc_sigma.m ├── mg_calc_theta.m ├── mg_calibrate.m ├── mg_make_time_series.m ├── mg_raw_load.m ├── move_series.m ├── nondim_chi.m ├── plot_avg_profile.m ├── plot_avg_profile2.m ├── plot_marlin_sum.m ├── plot_series.m ├── raw_load.m ├── raw_load_cham2_old_Apr14.m ├── raw_load_cham2_old_Jun16_use_version_in_chameleon.m ├── raw_load_old.m ├── remove_sonar_spikes.m ├── save_matfile.m ├── save_matview_file.m ├── select_depth_range.m ├── select_epsilon.m ├── spa_cor.m ├── spice_contours.m ├── tdif.m ├── therm_resp.m ├── thorpeSort.m └── update_series.m ├── mp_chipod ├── concatenate_mp.m └── raw_load_mp.m ├── ndbc_buoy ├── make_ndbc_buoy.m ├── read_NDBCbuoy_meteo.m ├── read_NDBCbuoy_spwvdens.m ├── read_NDBCbuoy_spwvdir.m ├── read_NDBCbuoy_wind.m └── readme.txt ├── netcdf └── loadnc.m ├── pitot ├── PTCal8_rex.m ├── PTempCal4.fig ├── PTempCal4.m ├── pitot_cal_plot.m ├── press_cal.m ├── test_GUI.fig └── test_GUI.m ├── ppod ├── HSP_Host.exe ├── convert_paro2.m ├── fastldhsp1hz.m ├── fastldtilt.m ├── headerfile.m ├── matlabtime2ux.m ├── pp6header.m ├── raw_load_ppod.m ├── raw_load_ppod_old.m ├── raw_load_ppod_old1.m ├── raw_load_ppod_z.m ├── read_micrologger.m ├── read_micrologger_old.m └── uxtime2matlab.m ├── pwp ├── README.txt ├── example_Output.mat ├── example_s ├── example_t ├── example_u ├── example_v ├── plot_pwp_example.m ├── private │ ├── deriv1.m │ ├── gmax.m │ ├── gmin.m │ ├── mmv2struct.m │ └── run_avg2.m ├── pwp_AddMomentum.m ├── pwp_AdvDif.m ├── pwp_BulkRichardson.m ├── pwp_GradRichardson.m ├── pwp_InspectOutput.m ├── pwp_InspectOutput2.m ├── pwp_MixMixedLayer.m ├── pwp_MixedLayerDepth.m ├── pwp_PlotOutput.m ├── pwp_PrepareData.m ├── pwp_ReadOutput.m ├── pwp_Run.m ├── pwp_StaticAdj.m ├── pwp_Stir.m ├── pwp_WriteOutput.m ├── pwp_example.mat └── znorth_sub.mat ├── qv ├── ch.m ├── interp8.m ├── ma.m ├── qv.m ├── qv_cal.m ├── qv_cal2.m ├── qv_calp.m ├── qv_cals1.m ├── qv_caltc.m ├── qv_caltc2.m ├── qv_caltcp.m ├── qv_caltp.m ├── qv_caluc.m ├── qv_calw.m ├── qv_deselectall.m ├── qv_disp.m ├── qv_docal.m ├── qv_fft.m ├── qv_file.m ├── qv_file2.m ├── qv_filt.m ├── qv_head.m ├── qv_lag.m ├── qv_load.m ├── qv_load_orig.m ├── qv_new.m ├── qv_now.m ├── qv_plot.m ├── qv_save.m ├── qv_sel.m ├── qv_sel2.m ├── qv_selectall.m ├── qv_space.m ├── qv_togs.m ├── qv_updat.m ├── qv_z.m ├── qv_zoom.m └── type_e.cal ├── rotation ├── DCM.m ├── DCM2RPY.m ├── DCM2YPR.m ├── DCM_body_updat.m ├── Rx.m ├── Ry.m ├── Rz.m ├── angleupdat.m ├── calc_filtered_rotations.m ├── calc_filtered_rotations_old.m ├── calc_lp_rotations.m ├── calc_lp_rotations_old.m ├── remove_gravitation.m └── translatevectorrpy.m ├── seabird ├── get_sbd.m ├── make_m99b_sbd_timeseries.m ├── make_sbd_timeseries.m ├── plot_ser.m ├── plot_series.m ├── rd_sbd.m ├── rd_sbd_longs.m ├── read_seabird_HOME2000.m └── read_seabird_longs.m ├── seawater ├── README ├── sw_adtg.m ├── sw_airden.m ├── sw_alpha.m ├── sw_alphap.m ├── sw_aonb.m ├── sw_beta.m ├── sw_betap.m ├── sw_bfrq.m ├── sw_buoflx.m ├── sw_c3515.m ├── sw_cndr.m ├── sw_contents.m ├── sw_copy.m ├── sw_cp.m ├── sw_cpair.m ├── sw_data.mat ├── sw_dens.m ├── sw_dens0.m ├── sw_dist.m ├── sw_dpth.m ├── sw_drag.m ├── sw_evapor.m ├── sw_f.m ├── sw_fp.m ├── sw_g.m ├── sw_gpan.m ├── sw_gvel.m ├── sw_info.m ├── sw_new.m ├── sw_pden.m ├── sw_pres.m ├── sw_ptmp.m ├── sw_rlatfl.m ├── sw_rlngwv.m ├── sw_rmixrt.m ├── sw_salds.m ├── sw_salrp.m ├── sw_salrt.m ├── sw_sals.m ├── sw_salt.m ├── sw_satAr.m ├── sw_satN2.m ├── sw_satO2.m ├── sw_sathum.m ├── sw_satmix.m ├── sw_satprs.m ├── sw_sdif.m ├── sw_seck.m ├── sw_smow.m ├── sw_snhtfl.m ├── sw_spchum.m ├── sw_svan.m ├── sw_svel.m ├── sw_swvel.m ├── sw_tcond.m ├── sw_tdif.m ├── sw_temp.m ├── sw_test.m ├── sw_u10.m ├── sw_vapprs.m ├── sw_ver.m ├── sw_virtmp.m ├── sw_visc.m └── sw_wetbulbtemp.m ├── sensorconfig ├── Contents.m ├── sc_make_eprom_ins.m └── sc_readexcel.m ├── smith_sandwell ├── GetSSbathy.m ├── README.MD └── extract_1m.m ├── tao ├── combine_tao_data.m ├── make_one_array_adcp.m ├── make_one_array_cur.m ├── make_one_array_cur_old_June2014.m ├── make_one_array_d.m ├── make_one_array_met.m ├── make_one_array_met_old_June2014.m ├── make_one_array_rad.m ├── make_one_array_sst.m ├── make_one_array_t.m ├── make_one_array_t_old_June2014.m ├── nc2mat.m ├── process_tao_data.m ├── read_tao_adcp.m ├── read_tao_bp.m ├── read_tao_cur.m ├── read_tao_cur_old_June2014.m ├── read_tao_d.m ├── read_tao_lw.m ├── read_tao_met.m ├── read_tao_met_old_June2014.m ├── read_tao_rad.m ├── read_tao_rain.m ├── read_tao_s.m ├── read_tao_sst.m ├── read_tao_t.m └── read_tao_t_old_June2014.m ├── tpod ├── kdatetick2.m ├── loadmini8.m ├── raw_load_tpod.m └── tpod_checkout.m └── wtc ├── Readme.txt ├── anglemean.m ├── ar1.m ├── ar1noise.m ├── ar1spectrum.m ├── arrow.m ├── boxpdf.m ├── chisquare_inv.m ├── chisquare_solve.m ├── colorbarf.m ├── formatts.m ├── gammest.m ├── jao.txt ├── jbaltic.txt ├── loadbnm.m ├── parseArgs.m ├── phaseplot.m ├── savebnm.m ├── smoothwavelet.m ├── sst_nino3.dat ├── wave_bases.m ├── wave_signif.m ├── wavelet.m ├── wavetest.m ├── wt.m ├── wtc.m ├── wtcdemo.m ├── wtcsignif.m └── xwt.m /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.m~ 3 | 4 | *.mat 5 | 6 | *.aux 7 | 8 | *.log 9 | 10 | *.out 11 | 12 | *.gz 13 | 14 | *.toc 15 | -------------------------------------------------------------------------------- /ARV/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/ARV/.DS_Store -------------------------------------------------------------------------------- /ARV/PixHawk/ParseATTlines.m: -------------------------------------------------------------------------------- 1 | function [dnum,pitch,roll,yaw]=ParseATTlines(a) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % function [dnum,pitch,roll,yaw]=ParseATTlines=(a) 5 | % 6 | % Parse 'ATT' lines from Pixhawk log files 7 | % 8 | % a is line from txt file that contains 'ATT' 9 | % 10 | %------------------ 11 | % 11/30/15 - A. Pickering 12 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 13 | %% 14 | 15 | clear dnum idR idP idY 16 | idR=strfind(a,' Roll'); 17 | idR2=strfind(a,', DesPitch'); 18 | idP=strfind(a,' Pitch :'); 19 | idP2=strfind(a,', DesYaw'); 20 | 21 | idY=strfind(a,' Yaw'); 22 | idY2=strfind(a,', ErrRP'); 23 | 24 | if ~isempty(idR) && ~isempty(idP) && ~isempty(idY) 25 | 26 | dnum=datenum(a(1:22)); 27 | 28 | roll=str2double(a(idR+8 : idR2-1) ); 29 | 30 | pitch= str2double(a(idP+8 : idP2-1) ); 31 | 32 | yaw= str2double(a(idY+6 : idY2-1) ); 33 | 34 | else 35 | return 36 | end 37 | 38 | %% -------------------------------------------------------------------------------- /ARV/PixHawk/ParseMAGline.m: -------------------------------------------------------------------------------- 1 | function [dnum , magX , magY, offX , offY]=ParseMAGline(a) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % function [dnum , magX , magY, offX , offY]=ParseMAGline(a) 5 | % 6 | % Parse 'MAG' lines from Pixhawk log files 7 | % 8 | % a is line from txt file that contains 'MAG' 9 | % 10 | % 11 | % 12 | %------------------ 13 | % 11/30/15 - A. Pickering 14 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | %% 16 | 17 | clear dnum idMX idMY idMZ magX magY idox idoy idoz 18 | dnum=datenum(a(1:22)); 19 | idMX=strfind(a,'MagX :'); 20 | idMY=strfind(a,', MagY :'); 21 | idMZ=strfind(a,', MagZ :'); 22 | 23 | idox=strfind(a,', OfsX :'); 24 | idoy=strfind(a,', OfsY :'); 25 | idoz=strfind(a,', OfsZ :'); 26 | 27 | magX=str2double(a(idMX+6:idMY-1)); 28 | magY=str2double(a(idMY+8:idMZ-1)); 29 | 30 | offX=str2double(a(idox+8 : idoy-1)); 31 | offY=str2double(a(idoy+8 : idoz-1)); 32 | 33 | 34 | % 35 | %% -------------------------------------------------------------------------------- /ARV/PixHawk/PlotPixhawkAtt.m: -------------------------------------------------------------------------------- 1 | function ax=PlotPixhawkAtt(A) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % function ax=PlotPixhawkAtt(A) 5 | % 6 | % Plot pitch,roll,yaw from Pixhawk ATT logs. 7 | % 8 | % INPUT 9 | % A : structure made with ReadPixhawkAttLog.m 10 | % 11 | %------------ 12 | % 05/05/16 - A.Pickering 13 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 14 | %% 15 | 16 | figure(1);clf 17 | agutwocolumn(1) 18 | wysiwyg 19 | 20 | ax1=subplot(311); 21 | plot(A.dnum,A.pitch) 22 | datetick('x') 23 | grid on 24 | ylabel('Pitch') 25 | title(A.source) 26 | 27 | ax2=subplot(312); 28 | plot(A.dnum,A.roll) 29 | datetick('x') 30 | grid on 31 | ylabel('Roll') 32 | 33 | ax3=subplot(313); 34 | plot(A.dnum,A.yaw) 35 | datetick('x') 36 | grid on 37 | ylabel('Yaw') 38 | xlabel(['Time on ' datestr(floor(nanmin(A.dnum)))]) 39 | 40 | ax=[ax1 ax2 ax3]; 41 | 42 | linkaxes(ax,'x') 43 | 44 | %% -------------------------------------------------------------------------------- /ARV/PixHawk/PlotPixhawkMag.m: -------------------------------------------------------------------------------- 1 | function ax=PlotPixhawkMag(M) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % function ax=PlotPixhawkMag(M) 5 | % 6 | % Plot pitch,roll,yaw from Pixhawk Mag logs. 7 | % 8 | % INPUT 9 | % M : structure made with ReadPixhawkMagLog.m 10 | % 11 | %------------ 12 | % 05/05/16 - A.Pickering 13 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 14 | %% 15 | 16 | figure(1);clf 17 | agutwocolumn(1) 18 | wysiwyg 19 | 20 | figure(1);clf 21 | agutwocolumn(1) 22 | wysiwyg 23 | 24 | ax1=subplot(311); 25 | plot(M.dnum,M.magX) 26 | datetick('x') 27 | grid on 28 | ylabel('Magx') 29 | title(M.source) 30 | 31 | ax2=subplot(312); 32 | plot(M.dnum,M.magY) 33 | datetick('x') 34 | grid on 35 | ylabel('MagY') 36 | 37 | ax3=subplot(313); 38 | plot(M.dnum,atan2d(M.magY,M.magX)) 39 | datetick('x') 40 | grid on 41 | ylabel('atan2d(magY,magX)') 42 | xlabel(['Time on ' datestr(floor(nanmin(M.dnum)))]) 43 | 44 | ax=[ax1 ax2 ax3]; 45 | 46 | linkaxes(ax,'x') 47 | 48 | %% -------------------------------------------------------------------------------- /ARV/PlotGpsSummary.m: -------------------------------------------------------------------------------- 1 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | % 3 | % PlotGpsSummary.m 4 | % 5 | % 6 | %---------------------- 7 | % 04/29/16 - A.Pickering - apickering@coas.oregonstate.edu 8 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 | %% 10 | 11 | figure(1);clf 12 | agutwocolumn(1) 13 | wysiwyg 14 | 15 | ax1=subplot(411); 16 | plot(gps.dnum,gps.lat);datetick('x') 17 | ylabel('Latitude','fontsize',15) 18 | grid on 19 | title(gps.DataSource) 20 | 21 | ax2=subplot(412); 22 | plot(gps.dnum,gps.lon);datetick('x') 23 | ylabel('Longitude','fontsize',15) 24 | grid on 25 | 26 | ax3=subplot(413); 27 | plot(gps.dnum,gps.Speed);datetick('x') 28 | ylabel('Speed [m/s]','fontsize',15) 29 | grid on 30 | 31 | ax4=subplot(414); 32 | plot(gps.dnum,gps.Heading,'.');datetick('x') 33 | ylabel('Heading [^o]','fontsize',15) 34 | xlabel(['Time on ' datestr(floor(nanmean(gps.dnum)))],'fontsize',15) 35 | grid on 36 | % 37 | linkaxes([ax1 ax2 ax3 ax4],'x') 38 | 39 | %% -------------------------------------------------------------------------------- /ARV/README.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | README.txt 4 | 5 | mixingsoftware/ARV 6 | 7 | Folder for codes related to ARV (autonomous research vehicle?), i.e. remote controlled boat(s) by Nash et al. -------------------------------------------------------------------------------- /CTD_Chipod/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/.DS_Store -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/.DS_Store -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/CtdChipodProcessingGuide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/CtdChipodProcessingGuide.pdf -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/CtdChipodProcessingGuide.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/CtdChipodProcessingGuide.tex -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/README.md: -------------------------------------------------------------------------------- 1 | Detailed processing guide. In progress. 2 | -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig0_RawCTD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig0_RawCTD.png -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig1_RawChipodTS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig1_RawChipodTS.png -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig2_w_TimeOffset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig2_w_TimeOffset.png -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig3_w_TimeOffset_Zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig3_w_TimeOffset_Zoom.png -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig4_dTdtSpectraCheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig4_dTdtSpectraCheck.png -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig5_T_P_dTdz_fspd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig5_T_P_dTdz_fspd.png -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig6_downcast_chi_T1_avgPhist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig6_downcast_chi_T1_avgPhist.png -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig6_upcast_chi_T1_avgPhist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig6_upcast_chi_T1_avgPhist.png -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig7_downcast_chi_T1_avg_chi_KT_dTdz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig7_downcast_chi_T1_avg_chi_KT_dTdz.png -------------------------------------------------------------------------------- /CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig7_upcast_chi_T1_avg_chi_KT_dTdz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/CTD_Chipod/ChipodProcessingGuide/SN1013_08402_Fig7_upcast_chi_T1_avg_chi_KT_dTdz.png -------------------------------------------------------------------------------- /CTD_Chipod/Old/fix_fig2.m: -------------------------------------------------------------------------------- 1 | function fix_fig2() 2 | set(gca,'linewidth',1,'xticklabel','','fontsize',14,'box','on','layer','top') 3 | resize_gca([0 -.02 -.03 .03]) 4 | hh=get(gca,'children'),set(hh,'linewidth',1) -------------------------------------------------------------------------------- /CTD_Chipod/Old/get_profile_inds.m: -------------------------------------------------------------------------------- 1 | function [inds]=get_profile_inds(p,min_p); 2 | % june and jonathan don't know why this needs to be so complicated. fix 3 | % this later. 4 | 5 | inds=find(p>min_p); 6 | inds=inds(1):inds(end); 7 | 8 | return 9 | 10 | [dummy,maxi]=max(p); 11 | 12 | first_ind=max(find(p(1:maxi)1 12 | var=var(:); 13 | end 14 | 15 | [m,n]=size(var); 16 | out=zeros(m,n); 17 | 18 | out(1:m-1,:)=diff(var); 19 | -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/ezpc.m: -------------------------------------------------------------------------------- 1 | function h=ezpc(varargin) 2 | %function h=ezpc(varargin) 3 | %SYNTAX 1: first argument is a structure with fields yday and z; pcolor the 4 | %specified variable. 5 | %EXAMPLE: ezpc(SWIMSgrid,'s') 6 | %SYNTAX 2: pass in x, y vectors and a variable to be pcolored. 7 | %EXAMPLE: ezpc(ADCP.yday,ADCP.z,ADCP.u) 8 | % 9 | %plot a flat-shaded pcolor, y axis increasing downward. Return handle. 10 | % 11 | %7/07 MHA 12 | 13 | if nargin ==2 14 | s=varargin{1};x=s.yday;y=s.z;var=s.(varargin{2}); 15 | elseif nargin ==3 16 | x=varargin{1};y=varargin{2};var=varargin{3}; 17 | end 18 | 19 | h=pcolor(x,y,var);shading flat;axis ij 20 | -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/freqline.m: -------------------------------------------------------------------------------- 1 | function h=freqline(fl,sty) 2 | %function freqline(fi,sty) 3 | %Place a vertical line at the location specified by fl. 4 | % 5 | %MHA 03/04 6 | %01/05: return the handle. 7 | % 8 | if nargin < 2 9 | sty='k--'; 10 | end 11 | 12 | xv=[fl fl]'; 13 | yl=ones(size(xv))*ylim; 14 | hold on 15 | h=loglog(xv,yl',sty); 16 | hold off 17 | %% 18 | -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/gridxy.m: -------------------------------------------------------------------------------- 1 | function gridxy 2 | %%%%%%%%%%%% 3 | % 4 | % Draw x-y axes on current figure 5 | % 6 | % AP 25 May 2011 7 | % 8 | %% 9 | lims=axis(gca); 10 | hold on 11 | hy=line([lims(1) lims(2)],[0 0]);set(hy,'color','k'); 12 | hx=line([0 0],[lims(3) lims(4)]);set(hx,'color','k'); 13 | axis(lims); 14 | hold off 15 | return 16 | %% 17 | -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/killcolorbar.m: -------------------------------------------------------------------------------- 1 | function killcolorbar(ahcbu) 2 | %function killcolorbar(ahcbu) 3 | %Hide the specified color bar. This works by hiding the specified axis and all of its children. 4 | set(ahcbu,'visible','off'); 5 | ahc=get(ahcbu,'children'); 6 | set(ahc,'visible','off'); 7 | -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/make_ctd_chipod_folders.m: -------------------------------------------------------------------------------- 1 | function make_ctd_chipod_folders(basedir,project) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % Make empty directory for a CTD-chipod project. If folders already exist, 5 | % will not overwrite. 6 | % 7 | % INPUT 8 | % - basedir (ex: '/Users/Andy/Cruises_Research/ChiPod/') 9 | % - project (ex: '26N') 10 | % 11 | % OUTPUT 12 | % -Makes standard folder structure for CTD-chipod project 13 | % 14 | % Dependencies: 15 | % ChkMkDir.m 16 | % 17 | %----------- 18 | % 09/12/16 - A.Pickering - apickering@coas.oregonstate.edu 19 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 20 | %% 21 | 22 | fullbase=fullfile( basedir, project) 23 | 24 | ChkMkDir( fullfile(fullbase,'Data','proc','chipod') ) 25 | ChkMkDir( fullfile(fullbase,'Data','proc','ctd') ) 26 | 27 | ChkMkDir( fullfile(fullbase,'Data','raw','chipod') ) 28 | ChkMkDir( fullfile(fullbase,'Data','raw','ctd') ) 29 | 30 | ChkMkDir( fullfile(fullbase,'Notes') ) 31 | ChkMkDir( fullfile(fullbase,'Figures') ) 32 | ChkMkDir( fullfile(fullbase,'mfiles') ) 33 | 34 | %% -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/sw_tcond_ctdchi.m: -------------------------------------------------------------------------------- 1 | function tcond=sw_tcond_chipod(s,t,p) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % function tcond=sw_tcond(s,t,p) gives the thermal conductivity 4 | % 5 | % Slightly modified version of sw_tcond to work with CTD_Chipod software. 6 | % Just added .* and ./ notation to work with vectors of t,s,p. 7 | % A. Pickering - Mar 25 2015. 8 | % 9 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 | % 11 | % based on caldwell dsr 21:131-137 (1974) eqn. 6,7,8 12 | % 13 | % s salinity 14 | % t temperature (deg. c) 15 | % p pressure (dbars) 16 | % 17 | % tcond thermal conductivity (j m-1 k-1 s-1) 18 | % 19 | % tcond(40.,40.,1000.)=0.6623783057965 20 | % 21 | % dave hebert 11/04/86 22 | % 23 | % ak0=0.565403020+t*(1.6999346e-3-t*5.910632e-6); 24 | % f=0.0690-8e-5*t-2.0e-7*p-1.0e-4*s; 25 | % tcond=ak0*(1+f); 26 | 27 | ak0=0.565403020+t.*(1.6999346e-3-t.*5.910632e-6); 28 | f=0.0690-8e-5.*t-2.0e-7.*p-1.0e-4.*s; 29 | tcond=ak0.*(1+f); 30 | 31 | %% -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/sw_tdif_ctdchi.m: -------------------------------------------------------------------------------- 1 | function tdif=sw_tdif_ctdchi(s,t,p) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % function tdif=sw_tdif_ctdchi(s,t,p) 4 | % 5 | % Slightly modified version of sw_tdif to work with CTD_Chipod software. 6 | % Just added .* and ./ notation to work with vectors of t,s,p. 7 | % A. Pickering - Mar 25 2015. 8 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 | % 10 | % temperature diffusivity (m2 s-1) 11 | % 12 | % uses functions sw_cp, sw_dens, sw_tcond 13 | % 14 | % dave hebert 15/04/86 15 | % tdif=sw_tcond(s,t,p)/sw_cp(s,t,p)/sw_dens(s,t,p); 16 | 17 | tdif=sw_tcond_ctdchi(s,t,p)./sw_cp(s,t,p)./sw_dens(s,t,p); 18 | 19 | %% -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/sw_visc_ctdchi.m: -------------------------------------------------------------------------------- 1 | function visc=sw_visc_ctdchi(s,t,p) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % function visc=sw_visc_ctdchi(s,t,p) 5 | % 6 | % Slightly modified version of sw_visc to work with CTD_Chipod software. 7 | % Just added .* and ./ notation to work with vectors of t,s,p. 8 | % A. Pickering - Mar 25 2015. 9 | % 10 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 | % 12 | % kinematic viscosity (nu) (no pressure dependence examined) 13 | % 14 | % based on dan kelley's fit to knauss's table ii-8 15 | % 16 | % s salinity (ppt) 17 | % t temperature (deg. c) 18 | % p pressure (dbars) 19 | % 20 | % visc kinematic viscosity (m**2 s-1) 21 | % 22 | % visc(40.,40.,1000.)=8.200167608e-7 23 | % 24 | % dave hebert 11/04/86 25 | % 26 | % renamed sw_visc and added to seawater routines 9/9/98 27 | 28 | %visc=1e-4*(17.91-0.5381*t+0.00694*t*t+0.02305*s)/sw_dens(s,t,p); 29 | 30 | visc=1e-4*(17.91-0.5381.*t+0.00694.*t.*t+0.02305.*s)./sw_dens(s,t,p); 31 | 32 | %% -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/wysiwyg.m: -------------------------------------------------------------------------------- 1 | function wysiwyg 2 | %WYSIWYG -- this function is called with no args and merely 3 | % changes the size of the figure on the screen to equal 4 | % the size of the figure that would be printed, 5 | % according to the papersize attribute. Use this function 6 | % to give a more accurate picture of what will be 7 | % printed. 8 | % Dan(K) Braithwaite, Dept. of Hydrology U.of.A 11/93 9 | 10 | % $Author: jklymak $ $Revision: 1.2 $ $Date: 2002/08/28 15:51:10 $ 11 | unis = get(gcf,'units'); 12 | ppos = get(gcf,'paperposition'); 13 | set(gcf,'units',get(gcf,'paperunits')); 14 | pos = get(gcf,'position'); 15 | pos(3:4) = ppos(3:4); 16 | pos(1:2) = [0.2 0.5]; 17 | set(gcf,'position',pos); 18 | set(gcf,'units',unis); 19 | 20 | -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/xtloff.m: -------------------------------------------------------------------------------- 1 | set(gca,'xticklabel',[]) -------------------------------------------------------------------------------- /CTD_Chipod/mfiles/ytloff.m: -------------------------------------------------------------------------------- 1 | set(gca,'YTickLabel',[]) -------------------------------------------------------------------------------- /Chameleon2/Version2015/ChamFile.m: -------------------------------------------------------------------------------- 1 | % Chamname = ['0';'0';'0';'0';]; 2 | function [out1,out2] = ChamFile(handles) 3 | load ('C:\work\mixingsoftware\Chameleon2\Chamname.mat'); 4 | ch_sz = size(Chamname,1); 5 | a = zeros(4,1); 6 | for ii = 1:ch_sz 7 | a(ii) = str2num(Chamname(ii,1)); 8 | end 9 | if (a(1)==9) && (a(2)==9) && (a(3)==9) && (a(4)==9) 10 | print('threshold reached'); 11 | 12 | elseif (a(1)==9) && (a(2)==9) && (a(3)==9) && (a(4) < 9) 13 | a(1) = 0; 14 | a(2) = 0; 15 | a(3) = 0; 16 | a(4) = a(4)+1; 17 | 18 | 19 | elseif (a(1)==9) && (a(2)==9) && (a(3)< 9) 20 | a(3) = a(3)+1; 21 | a(1) = 0; 22 | a(2) = 0; 23 | 24 | 25 | elseif (a(1)==9) && (a(2) < 9) 26 | a(2) = a(2)+1; 27 | a(1) = 0; 28 | elseif (a(1)<9) 29 | a(1) = a(1)+1; 30 | end 31 | Chamname = num2str(a); 32 | out1 = sprintf('%s',Chamname(4)); 33 | out2 = sprintf('%s%s%s',Chamname(3),Chamname(2),Chamname(1)); 34 | save('C:\work\mixingsoftware\Chameleon2\Chamname.mat'); 35 | end 36 | 37 | -------------------------------------------------------------------------------- /Chameleon2/Version2015/chamview_p.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/chamview_p.fig -------------------------------------------------------------------------------- /Chameleon2/Version2015/gain_offset.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/gain_offset.fig -------------------------------------------------------------------------------- /Chameleon2/Version2015/headerpanel_1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/headerpanel_1.fig -------------------------------------------------------------------------------- /Chameleon2/Version2015/headers/cham2_0401.cht: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/headers/cham2_0401.cht -------------------------------------------------------------------------------- /Chameleon2/Version2015/headers/cham2_0401.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/headers/cham2_0401.hdr -------------------------------------------------------------------------------- /Chameleon2/Version2015/headers/cham2_0402.cht: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/headers/cham2_0402.cht -------------------------------------------------------------------------------- /Chameleon2/Version2015/headers/cham2_0402.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/headers/cham2_0402.hdr -------------------------------------------------------------------------------- /Chameleon2/Version2015/headers/cham2_0403.cht: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/headers/cham2_0403.cht -------------------------------------------------------------------------------- /Chameleon2/Version2015/headers/cham2_0403.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/headers/cham2_0403.hdr -------------------------------------------------------------------------------- /Chameleon2/Version2015/headers/cham2_0404.cht: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/headers/cham2_0404.cht -------------------------------------------------------------------------------- /Chameleon2/Version2015/headers/cham2_0404.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/Chameleon2/Version2015/headers/cham2_0404.hdr -------------------------------------------------------------------------------- /Chameleon2/Version2015/plot_chameleon_test.m: -------------------------------------------------------------------------------- 1 | hax(1)=subplot(811) 2 | plot(data.P(1:head.irep.P:end)) 3 | ylabel('P') 4 | 5 | hax(2)=subplot(812) 6 | plot(data.AX(1:head.irep.AX:end),'k');hold on 7 | plot(data.AY(1:head.irep.AY:end),'b') 8 | plot(data.AZ(1:head.irep.AZ:end),'r') 9 | ylabel('A') 10 | 11 | hax(3)=subplot(813) 12 | plot(data.TJ(1:head.irep.TJ:end),'k');hold on 13 | plot(data.T2(1:head.irep.T2:end),'b') 14 | ylabel('T') 15 | 16 | hax(4)=subplot(814) 17 | plot(data.TP(1:head.irep.TP:end),'k');hold on 18 | ylabel('TP') 19 | 20 | hax(5)=subplot(815) 21 | plot(data.W(1:head.irep.W:end));hold on 22 | plot(data.WP(1:head.irep.WP:end),'b') 23 | ylabel('W WP') 24 | 25 | hax(6)=subplot(816) 26 | plot(data.SJ(1:head.irep.SJ:end),'g');hold on 27 | plot(data.S2(1:head.irep.S2:end),'c') 28 | ylabel('S') 29 | 30 | hax(7)=subplot(817) 31 | plot(data.COND(1:head.irep.COND:end)) 32 | ylabel('C') 33 | 34 | hax(8)=subplot(818) 35 | plot(data.SCAT(1:head.irep.SCAT:end)) 36 | ylabel('SCAT') 37 | 38 | linkaxes(hax,'x') -------------------------------------------------------------------------------- /Chameleon2/Version2015/space.m: -------------------------------------------------------------------------------- 1 | function in=space(in); 2 | % function in=space(in) changes zeros to 32 so that character strings 3 | % defined in raw files as 0 will become ' ' 4 | 5 | [i,j]=find(~in); 6 | in(i,j)=in(i,j)+32; -------------------------------------------------------------------------------- /DAQ/DAQTempDiff.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/DAQ/DAQTempDiff.mat -------------------------------------------------------------------------------- /DAQ/Instructions for Noise Cals for T.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/DAQ/Instructions for Noise Cals for T.docx -------------------------------------------------------------------------------- /New_PPOD/PPOD Processing Software Update.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/New_PPOD/PPOD Processing Software Update.docx -------------------------------------------------------------------------------- /New_PPOD/convert_ppod6.m: -------------------------------------------------------------------------------- 1 | function [pressure temperature]= convert_ppod6( hdr, pp, tp ) 2 | % use calibration coefficients from header structure 3 | % paroscientific model 2200A 4 | % pp is pressure period in uS 5 | % tp is temperature period in uS 6 | % extract paroscientific coefficients from header 7 | u0 = hdr.parocoefs.U0; 8 | y = hdr.parocoefs.Y; 9 | c = hdr.parocoefs.C; 10 | d = hdr.parocoefs.D; 11 | t = hdr.parocoefs.T; 12 | 13 | u= tp -u0 ; % tp is temperature period 14 | 15 | temperature =(y(1).*u) + (y(2).*u.^2) +( y(3).*u.^3 ) ; 16 | 17 | cee=c(1)+ (c(2).*u) + (c(3).*u.^2) ; 18 | dee=d(1)+ (d(2).*u); 19 | t0 =t(1)+ (t(2).*u) + (t(3).*u.^2) + (t(4).*u.^3)+ (t(5).*u.^4) ; 20 | aa=1-(t0.^2./double(pp) .^2); 21 | pressure =cee.*aa.*(1-dee.*aa); 22 | 23 | end 24 | -------------------------------------------------------------------------------- /a_realtime_oceanus/chameleon/README_nofiltgen.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf470 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \margl1440\margr1440\vieww10800\viewh8400\viewkind0 5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 6 | 7 | \f0\fs24 \cf0 NOTE about realtime chameleon processing. In the past, Sasha used this code to do realtime processing of the chameleon data while at sea. However, it does NOT use the correct methods to calculate epsilon. Use to see data in realtime, but reprocess with same code used for EQ14.} -------------------------------------------------------------------------------- /a_realtime_oceanus/chameleon/utilities/modify_header.m: -------------------------------------------------------------------------------- 1 | % First one might want to modify the header coefficients 2 | head.coef.S1(1)=1e-4*head.coef.S1(1); 3 | head.coef.S2(1)=1e-4*head.coef.S2(1); 4 | 5 | -------------------------------------------------------------------------------- /a_realtime_oceanus/chameleon/utilities/plot_cham_summary_timer.m: -------------------------------------------------------------------------------- 1 | % plot_cham_summary_timer.m 2 | % 3 | % notes added by sjw, January 2014 4 | % 5 | % This code is called by show_chameleon_timer. It's added simply because 6 | % sometimes errors occur in plot_cham_summary and putting them in a 7 | % try/catch block prevents the code from crashing in an unfortunate way. 8 | 9 | try 10 | % clear the variable cham and reload the latest version of the summary 11 | % file, writing the name of the file to the screen. 12 | clear cham 13 | load([path_b file_b]); 14 | disp(cham.filemax); 15 | 16 | % plot the newest version of the processed data. 17 | plot_cham_summary; 18 | fclose('all'); 19 | catch 20 | pause(1); 21 | clear cham 22 | load([path_b file_b]); 23 | disp(cham.filemax); 24 | plot_cham_summary; 25 | end 26 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/copy_proc_das.m: -------------------------------------------------------------------------------- 1 | % copy_proc_das.m 2 | 3 | ddfromdates = dir([localdir 'processed' filesep '20*']); 4 | ddfrommat = dir([localdir 'processed' filesep '*.mat']); 5 | 6 | ddtodates = dir([wdmycloud 'processed' filesep '20*']); 7 | ddtomat = dir([wdmycloud 'processed' filesep '*.mat']); 8 | 9 | 10 | for ii = 1:length(ddfromdates) 11 | disp(['checking that ' ddfromdates(ii).name ' is up to date in ' [wdmycloud 'processed' filesep]]) 12 | warning off 13 | mkdir([wdmycloud 'processed' filesep ddfromdates(ii).name]) 14 | warning on 15 | copynewer([localdir 'processed' filesep ddfromdates(ii).name filesep],... 16 | [wdmycloud 'processed' filesep ddfromdates(ii).name],2,'mat') 17 | end 18 | 19 | 20 | disp(['checking that mat-files are up to date in ' [wdmycloud 'processed' filesep]]) 21 | copynewer([localdir 'processed' filesep],[wdmycloud 'processed' filesep],2,'mat') 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/copy_raw_das.m: -------------------------------------------------------------------------------- 1 | % copy das data from ark1 2 | 3 | % want to copy the raw data from ark01 to my computer 4 | 5 | 6 | ddfromdates = dir([arkdir '20*']); 7 | 8 | ddtodates = dir([localdir 'raw' filesep '20*']); 9 | 10 | for ii = 1:length(ddfromdates) 11 | disp(['checking that ' ddfromdates(ii).name ' is up to date in ' [localdir 'raw' filesep]]) 12 | warning off 13 | mkdir([localdir 'raw' filesep ddfromdates(ii).name]) 14 | warning on 15 | copynewer([arkdir ddfromdates(ii).name filesep 'csv' filesep],... 16 | [localdir 'raw' filesep ddfromdates(ii).name],2,'csv') 17 | end 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/das_timer.m: -------------------------------------------------------------------------------- 1 | % das_timer 2 | 3 | waittime = 5*60; 4 | dastm = timer('TimerFcn','real_time_das',... 5 | 'Period',waittime,'executionmode','fixedrate','busymode','queue'); 6 | starttimeprocess=now+1/86400; 7 | startat(dastm,starttimeprocess); 8 | 9 | 10 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/run_das_timer.m: -------------------------------------------------------------------------------- 1 | % run_das_timer.m 2 | 3 | 4 | dastimer=timer('TimerFcn','run_das',... 5 | 'Period',60*60,'executionmode','fixedrate','busymode','queue'); 6 | STARTTIME=now+1/86400; 7 | startat(dastimer,STARTTIME); -------------------------------------------------------------------------------- /a_realtime_oceanus/das/utilities/read_fluorometer_flowthrough.m: -------------------------------------------------------------------------------- 1 | function out=read_fluorometer_flowthrough(fname) 2 | fid=fopen(fname); 3 | data=textscan(fid,'%s',1e6,'delimiter','\r'); 4 | fclose(fid); 5 | data=char(data{:}); 6 | ik=strmatch('META_DATA_PRECISION',data); 7 | out.readme=data(1:ik,:); 8 | data=data(ik+1:end,:); 9 | data(:,end+1)=','; 10 | frm=['%s %s %s']; 11 | data=textscan(data',frm,size(data,1),'delimiter',',','bufsize',1e6); 12 | tm=char(data{2}); 13 | if strcmp(tm(1,1),'"') == 1 14 | tm = tm(:,2:end-1); 15 | end 16 | out.time=datenum(tm(:,1:10))+datenum(tm(:,12:23))-fix(datenum(tm(:,12:23))); 17 | vv=char(data{3}); 18 | out.Volt=str2num(vv(:,2:7)); 19 | end % function out=read_fluorometer_flowthrough(fname) 20 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/utilities/read_gyrocompass.m: -------------------------------------------------------------------------------- 1 | function out=read_gyrocompass(fname) 2 | fid=fopen(fname); 3 | data=textscan(fid,'%s',1e6,'delimiter','\r'); 4 | fclose(fid); 5 | data=char(data{:}); 6 | ik=strmatch('META_DATA_PRECISION',data); 7 | out.readme=data(1:ik,:); 8 | data=data(ik+1:end,:); 9 | data(:,end+1)=','; 10 | frm=['%s %s %s %f %s']; 11 | data=textscan(data',frm,size(data,1),'delimiter',',','bufsize',1e6); 12 | tm=char(data{2}); 13 | if strcmp(tm(1,1),'"') == 1 14 | tm = tm(:,2:end-1); 15 | end 16 | out.time=datenum(tm(:,1:10))+datenum(tm(:,12:23))-fix(datenum(tm(:,12:23))); 17 | out.heading=data{4}; 18 | end % function out=read_gyrocompass(fname) 19 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/utilities/read_oxygen_mll_flowthrough.m: -------------------------------------------------------------------------------- 1 | function out=read_oxygen_mll_flowthrough(fname) 2 | 3 | fid=fopen(fname); 4 | data=textscan(fid,'%s',1e6,'delimiter','\r'); 5 | fclose(fid); 6 | data=char(data{:}); 7 | ik=strmatch('META_DATA_PRECISION',data); 8 | out.readme=data(1:ik,:); 9 | out.readme=char('oxygen [ml/ml]','',out.readme); 10 | 11 | tt=data(ik+1:end,:); 12 | tt(:,end+1)=','; 13 | frm=['%s %s %s %s %s %s']; 14 | ttt=textscan(tt',frm,size(tt,1),'delimiter',',','bufsize',1e6); 15 | 16 | tm=char(ttt{2}); 17 | if strcmp(tm(1,1),'"') == 1 18 | tm = tm(:,2:end-1); 19 | end 20 | 21 | out.time=datenum(tm(:,1:10))+datenum(tm(:,12:23))-fix(datenum(tm(:,12:23))); 22 | 23 | dummy=char(ttt{6}); 24 | out.oxygen = str2num(dummy(:,1:15)); 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/utilities/read_radiometer_metmast_par.m: -------------------------------------------------------------------------------- 1 | function out=read_radiometer_metmast_par(fname) 2 | fid=fopen(fname); 3 | data=textscan(fid,'%s',1e6,'delimiter','\r'); 4 | fclose(fid); 5 | data=char(data{:}); 6 | ik=strmatch('META_DATA_PRECISION',data); 7 | out.readme=data(1:ik,:); 8 | data=data(ik+1:end,:); 9 | data(:,end+1)=','; 10 | frm=['%s %s %s']; 11 | tt=textscan(data',frm,size(data,1),'delimiter',',','bufsize',1e6); 12 | tm=char(tt{2}); 13 | if strcmp(tm(1,1),'"') == 1 14 | tm = tm(:,2:end-1); 15 | end 16 | out.time=datenum(tm(:,1:10))+datenum(tm(:,12:23))-fix(datenum(tm(:,12:23))); 17 | 18 | out.parVolts=char(tt{3}); 19 | out.parVolts=str2num(out.parVolts(:,2:7)); 20 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/utilities/read_raingauge.m: -------------------------------------------------------------------------------- 1 | function out=read_raingauge(fname) 2 | fid=fopen(fname); 3 | data=textscan(fid,'%s',1e6,'delimiter','\r'); 4 | fclose(fid); 5 | data=char(data{:}); 6 | ik=strmatch('META_DATA_PRECISION',data); 7 | out.readme=data(1:ik,:); 8 | data=data(ik+1:end,:); 9 | data(:,end+1)=','; 10 | frm=['%s %s %s']; 11 | data=textscan(data',frm,size(data,1),'delimiter',',','bufsize',1e6); 12 | tm=char(data{2}); 13 | if strcmp(tm(1,1),'"') == 1 14 | tm = tm(:,2:end-1); 15 | end 16 | out.time=datenum(tm(:,1:10))+datenum(tm(:,12:23))-fix(datenum(tm(:,12:23))); 17 | vv=char(data{3}); 18 | out.Volt=str2num(vv(:,2:7)); 19 | end % function out=read_raingauge(fname) 20 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/utilities/read_raingauge_metmast_1.m: -------------------------------------------------------------------------------- 1 | function out=read_raingauge_metmast_1(fname) 2 | fid=fopen(fname); 3 | data=textscan(fid,'%s',1e6,'delimiter','\r'); 4 | fclose(fid); 5 | data=char(data{:}); 6 | ik=strmatch('META_DATA_PRECISION',data); 7 | out.readme=data(1:ik,:); 8 | data=data(ik+1:end,:); 9 | data(:,end+1)=','; 10 | frm=['%s %s %s']; 11 | data=textscan(data',frm,size(data,1),'delimiter',',','bufsize',1e6); 12 | tm=char(data{2}); 13 | if strcmp(tm(1,1),'"') == 1 14 | tm = tm(:,2:end-1); 15 | end 16 | out.time=datenum(tm(:,1:10))+datenum(tm(:,12:23))-fix(datenum(tm(:,12:23))); 17 | vv=char(data{3}); 18 | out.Volt=str2num(vv(:,2:7)); 19 | end % function out=read_raingauge(fname) 20 | -------------------------------------------------------------------------------- /a_realtime_oceanus/das/utilities/read_tsg_flowthrough.m: -------------------------------------------------------------------------------- 1 | function out=read_tsg_flowthrough(fname) 2 | fid=fopen(fname); 3 | data=textscan(fid,'%s',1e6,'delimiter','\r'); 4 | fclose(fid); 5 | data=char(data{:}); 6 | ik=strmatch('META_DATA_PRECISION',data); 7 | out.readme=data(1:ik,:); 8 | tt=data(ik+1:end,:); 9 | 10 | out.time=datenum(tt(:,7:16))+datenum(tt(:,18:29))-fix(datenum(tt(:,18:29))); 11 | out.T=str2num(tt(:,33:38)); 12 | out.C=str2num(tt(:,41:47)); 13 | out.S=str2num(tt(:,50:56)); 14 | out.T(out.T<-2 | out.T>40)=NaN; 15 | out.C(out.C<1 | out.C>6)=NaN; 16 | out.S(out.S<10 | out.S>43)=NaN; 17 | 18 | % tt(:,end+1)=','; 19 | % frm='%s %s %f %f %f'; 20 | % data=textscan(tt',frm,size(tt,1),'delimiter',',','bufsize',1e6); 21 | % tm=char(data{2}); 22 | % out.time=datenum(tm(:,1:10))+datenum(tm(:,12:23))-fix(datenum(tm(:,12:23))); 23 | % out.T=data{3}; 24 | % out.C=data{4}; 25 | % out.S=data{5}; 26 | end % function out=read_tsg_bow(fname) 27 | 28 | -------------------------------------------------------------------------------- /adcp/despike.m: -------------------------------------------------------------------------------- 1 | function [outy]=despike(iny,despikelen,limit,doplot); 2 | % function [outy]=despike(iny,despikelen,limit,doplot); 3 | 4 | if nargin<4 5 | doplot=0; 6 | end; 7 | 8 | outy=iny; 9 | good = find(~isnan(iny)); 10 | if length(good)>3*despikelen 11 | b=ones(1,despikelen)./despikelen;a=1; 12 | lowy = filtfilt(b,a,iny(good)); 13 | dif = abs(lowy-iny(good)); 14 | else 15 | % this is too short to despike.... 16 | % warning('Time-series too short to despike'); 17 | outy=iny; 18 | return; 19 | end; 20 | 21 | 22 | if doplot 23 | hist(dif,100) 24 | else 25 | bad = find(dif>limit); 26 | outy(good(bad))=NaN; 27 | end; 28 | %keyboard -------------------------------------------------------------------------------- /adcp/trimbad.m: -------------------------------------------------------------------------------- 1 | function adp=trimbad(adp,bad,refname); 2 | % function adp=trimbad(adp,bad,refname); 3 | % trims all the data in adp with the indices given by bad. This is 4 | % done columnwise. The idea is that certain data in a time-series 5 | % will be bad and that each column is an entry in the 6 | % time-series. The optional argument, refname, specifies a 7 | % variable in which has the length of the time-series. 8 | 9 | % J. Klymak 10 | 11 | if nargin<3 12 | refname='time'; 13 | end; 14 | 15 | % trims all the bad data 16 | tt = getfield(adp,refname); 17 | len = size(tt,2); 18 | good = setdiff([1:len],bad); 19 | varnames = fieldnames(adp); 20 | for i=1:length(varnames) 21 | var = getfield(adp,varnames{i}); 22 | if size(var,2)==len 23 | % trim 24 | var = var(:,good,:); 25 | adp=setfield(adp,varnames{i},var); 26 | end; 27 | end; 28 | return; 29 | 30 | -------------------------------------------------------------------------------- /adp/ADPheader.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/adp/ADPheader.inf -------------------------------------------------------------------------------- /adp/readme_ADPheader.txt: -------------------------------------------------------------------------------- 1 | split_ADP needs a header to work!!! -------------------------------------------------------------------------------- /adp/split_ADP.dll.old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/adp/split_ADP.dll.old -------------------------------------------------------------------------------- /adp/split_ADP.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/adp/split_ADP.mexw32 -------------------------------------------------------------------------------- /adv/calc_I.m: -------------------------------------------------------------------------------- 1 | function I_fact = calc_I(U_mean,U_std,theta); 2 | % function I_fact = calc_I(U_mean,U_std,theta); 3 | 4 | x_step = 0.01; 5 | x = -5:x_step:5; 6 | A = (U_std/U_mean)^(2/3) /sqrt(2*pi); 7 | B = 2*(U_mean/U_std)*cos(theta); 8 | C = (U_mean/U_std)^2; 9 | 10 | P = A * ((x.^2 - B*x + C).^(1/3)) .* exp(-(x.^2)/2); 11 | I_fact = x_step * sum(P); 12 | 13 | 14 | Q_plot = 0; 15 | if Q_plot==1 16 | figure(1) 17 | clf 18 | plot(x,P,'b') 19 | hold on 20 | plot(x,x_step*cumsum(P),'r') 21 | xlabel('x') 22 | legend('P','cumsum(P) / x_step',2) 23 | title(['I\_fact = ' num2str(I_fact) ' P = [x^2 -Bx + C]^{1/3} * e^{-x^2/2}']) 24 | end 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /adv/split_ADV.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/adv/split_ADV.dll -------------------------------------------------------------------------------- /biosonics/Contents.m: -------------------------------------------------------------------------------- 1 | % 2 | % Routines for reading and plotting BioSonics echosounder data. 3 | % 4 | % fastreadbio.m - quick way to read biosonics data; uses mex 5 | % routine readbiodrv.dll to make things much faster. 6 | % 7 | % readbiodrv.dll - w32 dll for reading in biosonics data/ 8 | % 9 | % src/ - directory with source code for biosonics reading routine 10 | % in it. To compile run >> mex readbiodrv.c 11 | % 12 | % readbio.m - the all MatLab way to read biosonics files. 13 | % 14 | % plot_bio_decimated - A specialized routine that assumes files of 15 | % the form yyyymmddhhmm.mat have been made. 16 | % realtime/biosonics/run_backup.m makes mat files of this format. 17 | % See also make_decimatedfiles.m 18 | % 19 | % make_decimatedfiles.m - makes decimated matlab files (not very 20 | % general yet). 21 | 22 | % $Author: aperlin $ $Date: 2008/01/31 20:22:42 $ $Revision: 1.1.1.1 $ -------------------------------------------------------------------------------- /biosonics/make_decimatedfiles.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | transducerdepth=5; 4 | dx=4; 5 | dz=8; 6 | for day =[1]; 7 | inpath = ... 8 | sprintf('\\\\ladoga\\datad\\cruises\\tx01\\biosonics\\DT2001\\OCT\\day%d',day) 9 | 10 | d=dir([inpath '\*.dt4']) 11 | for j=1:length(d) 12 | fin = sprintf('%s\\%s',inpath,d(j).name) 13 | fout = sprintf('\\\\ladoga\\datad\\cruises\\tx01\\biosonics\\mat\\200110%02d%s.mat',day,d(j).name(1:4)) 14 | pings=fastreadbio(fin,transducerdepth,dx,dz); 15 | save(fout,'pings'); 16 | end; 17 | 18 | end; 19 | -------------------------------------------------------------------------------- /biosonics/readbiodrv.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/biosonics/readbiodrv.mexw32 -------------------------------------------------------------------------------- /biosonics/readbiodrv_ted2.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/biosonics/readbiodrv_ted2.mexw64 -------------------------------------------------------------------------------- /calibrate/TNoiseCal2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/calibrate/TNoiseCal2.fig -------------------------------------------------------------------------------- /calibrate/calibrate_chipod_compass.m: -------------------------------------------------------------------------------- 1 | function cal=calibrate_chipod_compass(ser,data,head,cal) 2 | % function cal=calibrate_chipod_compass(ser,data,head,cal) 3 | % Calibrates compass assuming you have already computed the calibration 4 | % coefficients, which should be placed into head.coef.(ser) using 5 | % compute_compass_calibration_coefficients.m. These coefficients can be 6 | % any length as they simply rely on polyfit and polyval. 7 | % $Revision: 1.1.1.1 $ $Date: 2011/05/17 18:08:05 $ 8 | 9 | coef=head.coef.(upper(ser)); 10 | % This is pretty simple! 11 | cal.(ser)=polyval(coef,data.(ser)); 12 | -------------------------------------------------------------------------------- /calibrate/calibrate_compass.m: -------------------------------------------------------------------------------- 1 | function out=calibrate_compass(data,coef) 2 | % function cal=calibrate_chipod_compass(ser,data,head,cal) 3 | % Calibrates compass assuming you have already computed the calibration 4 | % coefficients, which should be placed into head.coef.(ser) using 5 | % compute_compass_calibration_coefficients.m. These coefficients can be 6 | % any length as they simply rely on polyfit and polyval. 7 | % $Revision: 1.1.1.1 $ $Date: 2011/05/17 18:08:05 $ 8 | 9 | if size(coef,1)>1 10 | coef=flipud(coef); 11 | else 12 | coef=fliplr(coef); 13 | end 14 | % This is pretty simple! 15 | out=polyval(coef,data); 16 | -------------------------------------------------------------------------------- /calibrate/calibrate_polynomial.m: -------------------------------------------------------------------------------- 1 | function [out]=calibrate_polynomial(in,coef) 2 | % function [out]=calibrate_poly(in) 3 | % in - input data structure 4 | % calibrates using polynomial coefficients in head.coef 5 | % $Revision: 1.1.1.1 $ $Date: 2011/05/17 18:08:05 $ 6 | 7 | out=coef(1)+coef(2).*in+coef(3).*(in.^2)+coef(4).*(in.^3); -------------------------------------------------------------------------------- /calibrate/run_compute_cali_compass.m: -------------------------------------------------------------------------------- 1 | function run_compute_cali_compass(unit,datadir) 2 | % makes mat file and figure with Chipod compass calibration coefficients 3 | % from text file with compass calibrations 4 | fname=['compass_' num2str(unit) '.txt']; 5 | data=load([datadir fname]); 6 | cname=['comp' num2str(unit)]; 7 | compass_coeffs.(cname)=compute_compass_calibration_coefficients(data(:,1),data(:,2),1,8); 8 | save([datadir 'compass_coeffs' num2str(unit)],'compass_coeffs') 9 | figure(1) 10 | subplot(3,1,1) 11 | title(['Compass calibration. Chipod ' num2str(unit)]) 12 | print('-dpng','-r200',[datadir fname(1:end-4)]); -------------------------------------------------------------------------------- /chipod/Chitcal.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/chipod/Chitcal.fig -------------------------------------------------------------------------------- /chipod/chipod_summary/multiple_chipod_summary.m: -------------------------------------------------------------------------------- 1 | %performs chipod summary files for multiple chipods especially on a mooring 2 | rootname = 'C:\work\chipod\'; 3 | summary_loc = 'C:\work\chipod\'; 4 | lm = dir(rootname); 5 | 6 | parfor j = 4:length(lm) 7 | display(lm(j).name); 8 | make_avg_chipod(str2num(lm(j).name),rootname,summary_loc); 9 | end 10 | -------------------------------------------------------------------------------- /chipod/chivert.m: -------------------------------------------------------------------------------- 1 | function [ newname ] = chivert( data1, data2 ) 2 | % CHIVERT concatonates data in two chipod files 3 | % Detailed explanation goes here 4 | 5 | field = fieldnames(data1); 6 | for i=1:length(field) 7 | % newname.P = vertcat(data1.P,data2.P) 8 | eval(['newname.' field{i} ' = vertcat(data1.' field{i} ',data2.' field{i} ');']) 9 | end 10 | 11 | -------------------------------------------------------------------------------- /chipod/compute_chi/get_dTdz_byslope.m: -------------------------------------------------------------------------------- 1 | function [dtdz]=get_dTdz_byslope(depth,tmpr,time,ts,tf) 2 | % function [dtdz]=get_dTdz_byslope(depth,tmpr,time,ts,tf) 3 | % depth=cal.DEPTH 4 | % tmpr=cal.T1 5 | % time=cal.TIME 6 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 7 | % 8 | id=find(time>=ts & time<=tf); 9 | [p]=polyfit(depth(id),tmpr(id),1); 10 | dtdz=-p(1); -------------------------------------------------------------------------------- /chipod/compute_chi/get_tao_spd.m: -------------------------------------------------------------------------------- 1 | function [tao]=get_tao_spd(dpath,ts,tf,depth) 2 | % function [tao]=get_tao_spd(dpath,ts,tf,depth) 3 | % dpath - data directory, i.e. '\\mserver\data\chipod\tao_sep05\' 4 | % dpl - deployment name (string), i.e. 'or07b' 5 | % ts - start time, Matlab format 6 | % tf - finish time, Matlab format 7 | % depth - unit depth, it is used to get current data from tao buoy 8 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 9 | 10 | load([dpath '\buoy_data\tao']) 11 | tao1=tao; 12 | clear tao; 13 | 14 | idt=find(tao1.cur.time>(ts-.02) & tao1.cur.time<(tf+.02)); 15 | tao.curtime=tao1.cur.time(idt); 16 | [c,idz]=min(abs(tao1.cur.depth-depth)); 17 | tao.u=tao1.cur.u(idt,idz); 18 | tao.v=tao1.cur.v(idt,idz); 19 | speed2=tao.u.^2+tao.v.^2; 20 | speed=sqrt(speed2); 21 | tao.spd=speed; 22 | theta=atan2(tao.u,tao.v).*180./pi; 23 | idtheta=find(theta<0); 24 | theta(idtheta)=theta(idtheta)+360; 25 | tao.dir=theta; 26 | -------------------------------------------------------------------------------- /chipod/inertial_subrange/binavg.m: -------------------------------------------------------------------------------- 1 | function [bin] = binavg(frq,spc,binwidth) 2 | % function [bin] = binavg(frq,spc,binwidth) 3 | % function to bin average spectral coefficients 4 | % frq - frequencies 5 | % spc - spectral coefficient 6 | % binwidth - user-selected averaging width (log10) 7 | % 8 | 9 | len=length(frq); 10 | 11 | nbins=(log10(max(frq))-log10(min(frq)))/binwidth-1; 12 | 13 | bin.dof=[]; 14 | bin.frq=[]; 15 | bin.spc=[]; 16 | 17 | for ibin=1:nbins 18 | lgmnfrq=log10(min(frq))+ibin*binwidth; 19 | lgmxfrq=log10(min(frq))+(ibin+1)*binwidth; 20 | id=find(log10(frq) >= lgmnfrq & log10(frq) <= lgmxfrq); 21 | 22 | if length(id)>0 23 | bin.dof=[bin.dof length(id)]; 24 | bin.frq=[bin.frq nanmean(frq(id))]; 25 | bin.spc=[bin.spc nanmean(spc(id))]; 26 | else 27 | bin.dof=[bin.dof nan]; 28 | bin.frq=[bin.frq nan]; 29 | bin.spc=[bin.spc nan]; 30 | end 31 | 32 | end 33 | -------------------------------------------------------------------------------- /chipod/inertial_subrange/e_ic.m: -------------------------------------------------------------------------------- 1 | function ec=e_ic(chi_fit,pt,f,f1,f2,N2,dTdz,cal,gamma,Ct) 2 | warning('off') 3 | % pc=2*pi*chi_fit.*Ct.*(nanmean(N2).*chi_fit/2/gamma/nanmean(dTdz).^2)^(-1/3).*(2*pi*f./nanmean(cal.fspd)).^(1/3)./nanmean(cal.fspd); 4 | pc=(2*pi)^(4/3)*Ct.*(2*gamma*nanmean(dTdz).^2/nanmean(N2))^(1/3).*chi_fit^(2/3).*nanmean(cal.fspd)^(-4/3).*f.^(1/3); 5 | ec=integrate(f1,f2,f,(log10(pt./pc)).^2); -------------------------------------------------------------------------------- /chipod/integrate_spectrum.m: -------------------------------------------------------------------------------- 1 | function [displacement]=integrate_spectrum(sp,f,f1,f2) 2 | % function [displacement]=integrate_spectrum(sp,f,f1,f2) 3 | % integrate spectrum sp over f1 < f < f2 4 | % return displacement = sqrt(cumtrapz(sp*df)); 5 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 6 | 7 | df=nanmean(diff(f)); 8 | id=find(f>f1&f 1.5 m. 5 | Use GUI to plot power spectra for that patch, 6 | save it (if it looks reasonable) and load a new file 7 | Continue untill all the calibration files are through. 8 | 9 | 2. Modify probnames.m: change deployment name, sensor names and 10 | maximum and minimum file numbers for each sensor 11 | 12 | 3. Run compute_transfer_functions_filters.m to create transfer functions. 13 | This script uses saved spectra created during the first step. 14 | -------------------------------------------------------------------------------- /chipod/transfer_function/save_data.m: -------------------------------------------------------------------------------- 1 | % save_data.m 2 | % called from the GUI 3 | % saves relevant power spectra information to directory dpath/saves/ 4 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 5 | % Originally J.Nash 6 | 7 | fname=[dpl num2str(hmenu.thisfile) '_p_' ... 8 | num2str(round(abs(mean(plims))))]; 9 | disp(fname); 10 | 11 | mkdir(dpath,'saves'); 12 | save([dpath '/saves/' fname],'power','freq','plims','fname','indices') 13 | 14 | filenames{fn_index}=fname; 15 | fn_index=fn_index+1; 16 | mkdir(dpath,'figs'); 17 | print('-dpng','-r100',[dpath 'figs\' fname]) 18 | 19 | save([dpath '/saves/filename_list'],'filenames') 20 | -------------------------------------------------------------------------------- /colormaps/autumn.m: -------------------------------------------------------------------------------- 1 | function c = autumn(m) 2 | %AUTUMN Shades of red and yellow color map. 3 | % AUTUMN(M) returns an M-by-3 matrix containing a "autumn" colormap. 4 | % AUTUMN, by itself, is the same length as the current colormap. 5 | % 6 | % For example, to reset the colormap of the current figure: 7 | % 8 | % colormap(autumn) 9 | % 10 | % See also HSV, GRAY, HOT, BONE, COPPER, PINK, FLAG, 11 | % COLORMAP, RGBPLOT. 12 | 13 | % Copyright (c) 1984-96 by The MathWorks, Inc. 14 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 15 | 16 | if nargin < 1, m = size(get(gcf,'colormap'),1); end 17 | r = (0:m-1)'/max(m-1,1); 18 | c = [ones(m,1) r zeros(m,1)]; 19 | 20 | -------------------------------------------------------------------------------- /colormaps/autumn_dark.m: -------------------------------------------------------------------------------- 1 | function c = autumn(m) 2 | %AUTUMN Shades of red and yellow color map. 3 | % AUTUMN(M) returns an M-by-3 matrix containing a "autumn" colormap. 4 | % AUTUMN, by itself, is the same length as the current colormap. 5 | % 6 | % For example, to reset the colormap of the current figure: 7 | % 8 | % colormap(autumn) 9 | % 10 | % See also HSV, GRAY, HOT, BONE, COPPER, PINK, FLAG, 11 | % COLORMAP, RGBPLOT. 12 | 13 | % Copyright (c) 1984-96 by The MathWorks, Inc. 14 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 15 | 16 | if nargin < 1, m = size(get(gcf,'colormap'),1); end 17 | 18 | m1=ceil(m*0.42); 19 | m2=m-2*m1; 20 | r = (0:m1-1)'/max(m1-1,1); 21 | c = [ones(m1,1) r zeros(m1,1)]; 22 | r = (0:m2-1)'/max(m2-1,1); 23 | c2= [ ones(m2,1) ones(m2,1) r]; 24 | 25 | r = 0.4*(m1-1)/max(m1-1,1)+0.6*(0:m1-1)'/max(m1-1,1); 26 | c1= [ r zeros(m1,1) zeros(m1,1)]; 27 | 28 | c=[c1;c;c2]; 29 | 30 | -------------------------------------------------------------------------------- /colormaps/bluegreen.m: -------------------------------------------------------------------------------- 1 | function [cm] = bluegreen(m) 2 | % 3 | % BLUEGREEN Shades of blue to green colormap. 4 | % BLUEGREEN(M) returns an M-by-3 matrix containing a 5 | % "bluegreen colormap" 6 | % 7 | % See also HSV, COLORMAP, RGBPLOT. 8 | 9 | if nargin<1 10 | [m,n] = size(colormap); 11 | end; 12 | 13 | mid = m/2; 14 | 15 | g = [ones(mid,1)',1-(1/mid):-1/mid:0']'; 16 | if (m-floor(mid)==mid) 17 | r = [0:1/mid:1-(1/mid)',1-(1/mid):-1/mid:0']'; 18 | else 19 | r = [0:1/mid:1,1-(1/mid):-1/mid:0']'; 20 | end; 21 | b = [0:1/mid:(1-(1/mid))',ones(mid,1)']'; 22 | 23 | cm = flipud([r,g,b]); 24 | % darken so that transparencies look good. 25 | cm = brighten(cm,-0.5); 26 | -------------------------------------------------------------------------------- /colormaps/cbrewer_preview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/colormaps/cbrewer_preview.jpg -------------------------------------------------------------------------------- /colormaps/coldhot.m: -------------------------------------------------------------------------------- 1 | function [cm] = coldhot(m) 2 | % 3 | % COOLHOT Shades of purple to blue to white to red to yellow colormap. 4 | % COLDHOT(M) returns an M-by-3 matrix containing a 5 | % "coldhot colormap" 6 | % 7 | % See also HSV, COLORMAP, RGBPLOT. 8 | 9 | if nargin<1 10 | [m,n] = size(colormap); 11 | end; 12 | 13 | hs=flipud(hsv(ceil(2.91*m*1/3))); 14 | ch=brighten(coolhot(ceil(m*1/3)),0.5); 15 | aut=brighten(autumn(ceil(m*1/3)),0.5); 16 | mm=ceil(m*1/3); 17 | cm = [hs(1:mm,:); ch; aut(1:mm,:)]; 18 | 19 | %cm = flipud([r,g,b]); 20 | % darken so that transparencies look good. 21 | %cm = brighten(cm,-0.3); 22 | -------------------------------------------------------------------------------- /colormaps/colorbrewer.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/colormaps/colorbrewer.mat -------------------------------------------------------------------------------- /colormaps/cooldark.m: -------------------------------------------------------------------------------- 1 | function c = coolwhite(m) 2 | %AUTUMN Shades of red and yellow color map. 3 | % AUTUMN(M) returns an M-by-3 matrix containing a "autumn" colormap. 4 | % AUTUMN, by itself, is the same length as the current colormap. 5 | % 6 | % For example, to reset the colormap of the current figure: 7 | % 8 | % colormap(autumn) 9 | % 10 | % See also HSV, GRAY, HOT, BONE, COPPER, PINK, FLAG, 11 | % COLORMAP, RGBPLOT. 12 | 13 | % Copyright (c) 1984-96 by The MathWorks, Inc. 14 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 15 | 16 | if nargin < 1, m = size(get(gcf,'colormap'),1); end 17 | 18 | m1=ceil(m/2); 19 | m2=m-m1; 20 | c=[flipud(coolwhite(m1));flipud(autumn_dark(m2))]; 21 | -------------------------------------------------------------------------------- /colormaps/coolhot.m: -------------------------------------------------------------------------------- 1 | function [cm] = coolhot(m) 2 | % 3 | % COOLHOT Shades of blue to red colormap. 4 | % COOLHOT(M) returns an M-by-3 matrix containing a 5 | % "coolhot colormap" 6 | % 7 | % See also HSV, COLORMAP, RGBPLOT. 8 | 9 | if nargin<1 10 | [m,n] = size(colormap); 11 | end; 12 | 13 | mid = m/2; 14 | 15 | r = [ones(mid,1)',1-(1/mid):-1/mid:0']'; 16 | if (m-floor(mid)==mid) 17 | g = [0:1/mid:1-(1/mid)',1-(1/mid):-1/mid:0']'; 18 | else 19 | g = [0:1/mid:1,1-(1/mid):-1/mid:0']'; 20 | end; 21 | b = [0:1/mid:(1-(1/mid))',ones(mid,1)']'; 22 | 23 | cm = flipud([r,g,b]); 24 | % darken so that transparencies look good. 25 | cm = brighten(cm,-0.3); 26 | -------------------------------------------------------------------------------- /colormaps/coolwhite.m: -------------------------------------------------------------------------------- 1 | function c = coolwhite(m) 2 | %AUTUMN Shades of red and yellow color map. 3 | % AUTUMN(M) returns an M-by-3 matrix containing a "autumn" colormap. 4 | % AUTUMN, by itself, is the same length as the current colormap. 5 | % 6 | % For example, to reset the colormap of the current figure: 7 | % 8 | % colormap(autumn) 9 | % 10 | % See also HSV, GRAY, HOT, BONE, COPPER, PINK, FLAG, 11 | % COLORMAP, RGBPLOT. 12 | 13 | % Copyright (c) 1984-96 by The MathWorks, Inc. 14 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 15 | 16 | if nargin < 1, m = size(get(gcf,'colormap'),1); end 17 | 18 | m1=ceil(0.85*m); 19 | m2=m-m1; 20 | 21 | c1=cool(m1); 22 | c2= (m2:-1:1)'./max(m2,1) 23 | c2=[c2 ones(m2,1) ones(m2,1)]; 24 | c=[c2;c1]; 25 | 26 | 27 | -------------------------------------------------------------------------------- /colormaps/invgray.m: -------------------------------------------------------------------------------- 1 | function g = invgray(m) 2 | % Inversed gray colormap (max values are black, minimum values are white) 3 | %GRAY Linear gray-scale color map. 4 | % GRAY(M) returns an M-by-3 matrix containing a gray-scale colormap. 5 | % GRAY, by itself, is the same length as the current colormap. 6 | % 7 | % For example, to reset the colormap of the current figure: 8 | % 9 | % colormap(gray) 10 | % 11 | % See also HSV, HOT, COOL, BONE, COPPER, PINK, FLAG, 12 | % COLORMAP, RGBPLOT. 13 | 14 | % Copyright 1984-2002 The MathWorks, Inc. 15 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 16 | 17 | if nargin < 1, m = size(get(gcf,'colormap'),1); end 18 | g = (m-1:-1:0)'/max(m-1,1); 19 | g = [g g g]; 20 | -------------------------------------------------------------------------------- /colormaps/invhot.m: -------------------------------------------------------------------------------- 1 | function h = hot(m) 2 | %HOT Black-red-yellow-white color map. 3 | % HOT(M) returns an M-by-3 matrix containing a "hot" colormap. 4 | % HOT, by itself, is the same length as the current colormap. 5 | % 6 | % For example, to reset the colormap of the current figure: 7 | % 8 | % colormap(hot) 9 | % 10 | % See also HSV, GRAY, PINK, COOL, BONE, COPPER, FLAG, 11 | % COLORMAP, RGBPLOT. 12 | 13 | % C. Moler, 8-17-88, 5-11-91, 8-19-92. 14 | % Copyright 1984-2002 The MathWorks, Inc. 15 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:42 $ 16 | 17 | if nargin < 1, m = size(get(gcf,'colormap'),1); end 18 | n = fix(3/8*m); 19 | 20 | r = [(1:n)'/n; ones(m-n,1)];r=flipud(r); 21 | g = [zeros(n,1); (1:n)'/n; ones(m-2*n,1)];g=flipud(g); 22 | b = [zeros(2*n,1); (1:m-2*n)'/(m-2*n)];b=flipud(b); 23 | 24 | h = [r g b]; 25 | -------------------------------------------------------------------------------- /colormaps/ocean.m: -------------------------------------------------------------------------------- 1 | function cmp = sea(vargin); 2 | % cmp = sea(vargin); 3 | 4 | % @(#)GMT_sealand.cpt 1.1 03/19/99 5 | % 6 | % Colortable for ocean and land with break at sealevel 7 | % Designed by W.H.F. Smith, NOAA 8 | % COLOR_MODEL = HSV 9 | 10 | if nargin==1 11 | len=vargin; 12 | else 13 | len=length(colormap); 14 | end; 15 | 16 | X=[ 17 | -8000 0 0 0 18 | -7000 0 5 25 19 | -6000 0 10 50 20 | -5000 0 80 125 21 | -4000 0 150 200 22 | -3000 86 197 184 23 | -2000 172 245 168 24 | -1000 211 250 211 25 | 0 250 255 255 26 | ]; 27 | 28 | x=X(:,1); 29 | rgb_ = X(:,2:4)/255; 30 | 31 | newx=min(x)+(max(x)-min(x))*((1:len)/len); 32 | 33 | cmp = interp1(x,rgb_,newx); 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /colormaps/pmelcmap.m: -------------------------------------------------------------------------------- 1 | function [c] = redblue(m) 2 | % 3 | % redblue Sh!ades of red to white to blue colormap. 4 | % REDBLUE(M) returns an M-by-3 matrix containing a 5 | % "redblue" colormap. 6 | % CAVEAT this actually only works properly for even length 7 | % colormaps. Some fiddling will get it to work generally. 8 | % 9 | % See also HSV, COLORMAP, RGBPLOT. 10 | 11 | if nargin<1 12 | m=length(colormap); 13 | end; 14 | 15 | 16 | x=[0 0 100 100 17 | 20 20 20 100 18 | 35 100 100 100 19 | 65 100 100 100 20 | 80 100 20 20 21 | 100 100 100 0]; 22 | 23 | x=[0 0 100 100 24 | 25 20 20 100 25 | 49 100 100 100 26 | 51 100 100 100 27 | 75 100 20 20 28 | 100 100 100 0]; 29 | 30 | pos = x(:,1)/100; 31 | rgb = x(:,2:4)/100; 32 | 33 | c = interp1(pos,rgb,(1:m)/m); 34 | 35 | 36 | -------------------------------------------------------------------------------- /colormaps/rbmag.m: -------------------------------------------------------------------------------- 1 | function [c] = redblue(m) 2 | % 3 | % redblue Shades of red to white to blue colormap. 4 | % REDBLUE(M) returns an M-by-3 matrix containing a 5 | % "redblue" colormap. 6 | % CAVEAT this actually only works properly for even length 7 | % colormaps. Some fiddling will get it to work generally. 8 | % 9 | % See also HSV, COLORMAP, RGBPLOT. 10 | 11 | if nargin<1 12 | [m,n] = size(colormap); 13 | end; 14 | 15 | mm = m; 16 | 17 | p = [0 1 1.5 2 3 4:8 ]/8; 18 | 19 | r = [1 0.8 0 0 0 1 1 1 0.8 0.8]'; 20 | g = [0 0 0 0 1 1 1 0 0 0]'; 21 | b = [0.9 0.9 0.9 1 1 1 0 0 0 1]'; 22 | 23 | c = interp1(p,[r g b],(1:mm)/mm); 24 | 25 | 26 | -------------------------------------------------------------------------------- /colormaps/redblue.m: -------------------------------------------------------------------------------- 1 | function [c] = redblue(m) 2 | % 3 | % redblue Shades of red to white to blue colormap. 4 | % REDBLUE(M) returns an M-by-3 matrix containing a 5 | % "redblue" colormap. 6 | % CAVEAT this actually only works properly for even length 7 | % colormaps. Some fiddling will get it to work generally. 8 | % 9 | % See also HSV, COLORMAP, RGBPLOT. 10 | 11 | if nargin<1 12 | [m,n] = size(colormap); 13 | end; 14 | 15 | m0=floor(m*0.0); 16 | m1=floor(m*0.20); 17 | m2=floor(m*0.20); 18 | m3=floor(m/2)-m2-m1; 19 | 20 | b_= [ 0.4*(0:m1-1)'/(m1-1)+0.6; ones(m2+m3,1)]; 21 | g_= [zeros(m1,1); (0:m2-1)'/(m2-1);ones(m3,1)]; 22 | r_= [zeros(m1,1); zeros(m2,1); (0:m3-1)'/(m3-1)]; 23 | 24 | r=[r_; flipud(b_)]; 25 | g=[g_; flipud(g_)]; 26 | b=[b_; flipud(r_)]; 27 | 28 | c=[r g b]; 29 | -------------------------------------------------------------------------------- /colormaps/redblue2.m: -------------------------------------------------------------------------------- 1 | function [c] = redblue(m) 2 | % 3 | % redblue Shades of red to white to blue colormap. 4 | % REDBLUE(M) returns an M-by-3 matrix containing a 5 | % "redblue" colormap. 6 | % CAVEAT this actually only works properly for even length 7 | % colormaps. Some fiddling will get it to work generally. 8 | % 9 | % See also HSV, COLORMAP, RGBPLOT. 10 | 11 | if nargin<1 12 | [m,n] = size(colormap); 13 | end; 14 | 15 | m0=floor(m*0.0); 16 | m1=floor(m*0.20); 17 | m2=floor(m*0.20); 18 | m3=floor(m/2)-m2-m1; 19 | 20 | b_= [ 0.4*(0:m1-1)'/(m1-1)+0.6; ones(m2+m3,1)]; 21 | g_= [zeros(m1,1); (0:m2-1)'/(m2-1);ones(m3,1)]; 22 | r_= [0.4*(m1-1:-1:0)'/(m1-1); zeros(m2,1); (0:m3-1)'/(m3-1)]; 23 | 24 | r=[r_; flipud(b_)]; 25 | g=[g_; flipud(g_)]; 26 | b=[b_; flipud(r_)]; 27 | b(end-m1:end)=0; 28 | m4=round(1.5*(m1)); 29 | b(1:m4)=(0.3+(0:m4-1)/(m4-1)*0.7).^2; 30 | m5=round(0.85*m1); 31 | b(1:m5)=0.5; 32 | 33 | c=[r g b]; 34 | -------------------------------------------------------------------------------- /cruises/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/cruises/.DS_Store -------------------------------------------------------------------------------- /ctd_processing/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/ctd_processing/.DS_Store -------------------------------------------------------------------------------- /ctd_processing/PlotRawCTDprofiles.m: -------------------------------------------------------------------------------- 1 | function h=PlotRawCTDprofiles(data2,ctdlist,icast) 2 | 3 | %% 4 | h=figure;clf 5 | 6 | subplot(121) 7 | plot(data2.t1,data2.p,data2.t2,data2.p) 8 | ylim([0 nanmax(data2.p)]) 9 | axis ij 10 | ylabel('p [db]') 11 | grid on 12 | xlabel('temp [^oC]') 13 | title(ctdlist(icast).name,'interpreter','none') 14 | legend('t1','t2','location','Southeast') 15 | 16 | subplot(122) 17 | plot(data2.c1,data2.p,data2.c2,data2.p) 18 | ylim([0 nanmax(data2.p)]) 19 | axis ij 20 | ylabel('p [db]') 21 | grid on 22 | xlabel('cond.') 23 | legend('c1','c2','location','east') 24 | 25 | return 26 | %% -------------------------------------------------------------------------------- /ctd_processing/binavg.m: -------------------------------------------------------------------------------- 1 | function[ybin,num]=binavg(x,y,xbin,cutt) 2 | 3 | % cutoff for entries within a bin 4 | if ~exist('cutt'); cutt=3; end 5 | 6 | [m,n]=size(x); 7 | x1=reshape(x,1,m*n); 8 | y1=reshape(y,1,m*n); 9 | ybin=NaN*xbin; num=NaN*xbin; 10 | nn=length(xbin); 11 | 12 | ig=find(~isnan(x1)&~isnan(y1)); 13 | x1=x1(ig); y1=y1(ig); 14 | 15 | dbin=diff(xbin); 16 | 17 | %1st bin 18 | ii=find((x1>(xbin(1)-dbin(1)/2))&(x1<(xbin(1)+dbin(1)/2))); 19 | if length(ii)>cutt 20 | ybin(1)=mean(y1(ii)); num(1)=length(ii); 21 | end 22 | 23 | %last bin 24 | ii=find((x1>(xbin(nn)-dbin(nn-1)/2))&(x1<(xbin(nn)+dbin(nn-2)/2))); 25 | if length(ii)>cutt 26 | ybin(nn)=mean(y1(ii)); num(nn)=length(ii); 27 | end 28 | 29 | %other bins 30 | for i=2:(nn-1) 31 | ii=find((x1>(xbin(i)-dbin(i-1)/2))&(x1<(xbin(i)+dbin(i)/2))); 32 | if length(ii)>cutt 33 | ybin(i)=mean(y1(ii)); num(i)=length(ii); 34 | end 35 | end 36 | 37 | 38 | -------------------------------------------------------------------------------- /ctd_processing/clip.m: -------------------------------------------------------------------------------- 1 | function x=clip(y,miny,maxy); 2 | % function x=clip(y,miny,maxy); 3 | % 4 | % clip y by the min and max. 5 | 6 | x=y; 7 | x(find(xmaxy))=maxy; 9 | 10 | -------------------------------------------------------------------------------- /ctd_processing/ctd_switch.m: -------------------------------------------------------------------------------- 1 | % ctd_switch 2 | % switch T-C pairs 3 | 4 | switch icast 5 | case 1 6 | % t1, c2 good 7 | c1 = data.c1; 8 | data.c1 = data.c2; 9 | data.c2 = c1; 10 | clear c1 11 | end 12 | -------------------------------------------------------------------------------- /ctd_processing/ctdpreen.m: -------------------------------------------------------------------------------- 1 | function d = ctdpreen(d) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % function d = ctdpreen(d) 4 | % 5 | % remove spikes in p t1 t2 t2 c1 c2 6 | % and oxygen trans fl in volts 7 | % 8 | %------------------- 9 | % 11/12/15 - AP - lower t limit (looking at Arctic data!) 10 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 | %% 12 | d.p = preen(d.p, 0, 6200); 13 | d.t1 = preen(d.t1, -3, 35); 14 | d.t2 = preen(d.t2, -3, 35); 15 | d.c1 = preen(d.c1, 2.5, 6); 16 | d.c2 = preen(d.c2, 2.5, 6); 17 | %d.oxygen = preen(d.oxygen, 0.5, 3.5); % volts 18 | %d.trans = preen(d.trans, 3, 5); 19 | %d.fl = preen(d.fl, 3, 5); 20 | %% -------------------------------------------------------------------------------- /ctd_processing/findsegments.m: -------------------------------------------------------------------------------- 1 | function segments = findsegments(ibad) 2 | % 3 | % function segments = findsegments(ibad) 4 | % 5 | % ibad is index of bad data 6 | % returns indices: 7 | % segments.start 8 | % segments.stop 9 | % and 10 | % segments.length 11 | % nx = length(data) 12 | % 13 | 14 | % test 15 | % 16 | testing = 0; 17 | if testing 18 | x = rand(1, 20); 19 | x([1 4 6 7 8 15 16 17 18 20]) = -99; 20 | ibad = find(x == -99); 21 | end 22 | 23 | ibad = ibad(:); 24 | 25 | jj = find(diff(ibad) > 1); 26 | nseg = length(jj) + 1; 27 | 28 | istart = jj + 1; 29 | istart = [1; istart]; 30 | 31 | istop = jj; 32 | istop = [istop; length(ibad)]; 33 | 34 | segments.start = ibad(istart); 35 | segments.stop = ibad(istop); 36 | segments.length = segments.stop - segments.start + 1; 37 | -------------------------------------------------------------------------------- /ctd_processing/freq2cond.m: -------------------------------------------------------------------------------- 1 | function cond = freq2cond(freq,temp,pres,ccal) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | %function cond = freq2cond(freq,temp,press,ccal) 4 | % 5 | % calculates conductivity given frequency, temperature, 6 | % pressure and conductivity calibration structure ccal. 7 | % 8 | %D. Rudnick 01/06/05 9 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 | %% 11 | ff = freq ./ 1000; 12 | 13 | cond = (ccal.ghij(1) + ff .* ff .* (ccal.ghij(2) + ff .* (ccal.ghij(3) + ff .* ccal.ghij(4)))) ./ (10 * (1 + ccal.ctpcor(1) .* temp + ccal.ctpcor(2) .* pres)); 14 | -------------------------------------------------------------------------------- /ctd_processing/freq2pressure.m: -------------------------------------------------------------------------------- 1 | function pres = freq2pressure(freq, tc, pcal) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % function pres = freq2pressure(freq, tc, pcal) 4 | % 5 | % Calculates pressure given frequency pressure temperature compensation 6 | % and pressure calibration structure pcal 7 | % 8 | % Original code from Jen MacKinnon in 'ctd_proc2' folder. 9 | % Added to 'ctd_processing' folder by A. Pickering 10 | % 11 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 | %% 13 | psi2dbar = 0.689476; 14 | 15 | Td = pcal.AD590(1) .* tc + pcal.AD590(2); 16 | 17 | c = pcal.c(1) + Td .* (pcal.c(2) + Td .* pcal.c(3)); 18 | d = pcal.d(1) + Td .* pcal.d(2); 19 | t0 = pcal.t(1) + Td .* (pcal.t(2) + Td .* (pcal.t(3) + Td .* (pcal.t(4) + Td .* pcal.t(5)))); 20 | t0f = 1e-6 .* t0 .* freq; 21 | fact = 1 - (t0f .* t0f); 22 | pres = psi2dbar .* (c .* fact .* (1 - d .* fact)); 23 | pres = pcal.linear(1)*pres + pcal.linear(2); 24 | 25 | return 26 | -------------------------------------------------------------------------------- /ctd_processing/freq2temp.m: -------------------------------------------------------------------------------- 1 | function temp = freq2temp(freq,tcal) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % function temp = freq2temp(freq,cfg) 4 | % 5 | % Calculates temperature given frequency and temperature 6 | % calibration structure tcal 7 | % 8 | % 9 | % D. Rudnick 01/06/05 10 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 | %% 12 | logf0f = log(tcal.f0 ./ freq); 13 | 14 | temp = (1 ./ (tcal.ghij(1) + logf0f .* (tcal.ghij(2) + logf0f .* (tcal.ghij(3) + logf0f .* tcal.ghij(4))))) - 273.15; 15 | 16 | %% -------------------------------------------------------------------------------- /ctd_processing/freq2temperature.m: -------------------------------------------------------------------------------- 1 | function temp = freq2temperature(f, tcal) 2 | % function temp = freq2temperature(f, tcal) 3 | % calculates temperature given frequency and calibration structure tcal 4 | 5 | f = log(tcal.f0./f); 6 | temp = 1./(tcal.ghij(1) + f.*tcal.ghij(2) + f.^2.*tcal.ghij(3) + f.^3.*tcal.ghij(4)) - 273.15; 7 | -------------------------------------------------------------------------------- /ctd_processing/freqconvert.m: -------------------------------------------------------------------------------- 1 | function data = freqconvert(data, cfg) 2 | 3 | data.p = freq2pressure(data.p, data.pst, cfg.pcal); 4 | data.t1 = freq2temp(data.t1, cfg.t1cal); 5 | data.t2 = freq2temp(data.t2, cfg.t2cal); 6 | data.c1 = freq2cond(data.c1, data.t1, data.p, cfg.c1cal); 7 | data.c2 = freq2cond(data.c2, data.t2, data.p, cfg.c1cal); 8 | 9 | data.s1 = sw_salt(10*data.c1/sw_c3515, data.t1, data.p); 10 | data.s2 = sw_salt(10*data.c2/sw_c3515, data.t2, data.p); 11 | 12 | data.theta1 = sw_ptmp(data.s1, data.t1, data.p,0); 13 | data.theta2 = sw_ptmp(data.s2, data.t2, data.p,0); 14 | 15 | data.sigma1 = sw_pden(data.s1, data.t1, data.p, 0); 16 | data.sigma2 = sw_pden(data.s2, data.t2, data.p, 0); 17 | 18 | data.oxygen = volt2ox(data.oxygen, data.s1, data.t1, data.p, cfg.oxcal); 19 | -------------------------------------------------------------------------------- /ctd_processing/hexword2freq.m: -------------------------------------------------------------------------------- 1 | function f = hexword2freq(h) 2 | % function f = hexword2freq(h) 3 | % 4 | % each byte is given as two hex digits 5 | % each SB freq word is 3 bytes 6 | % calculates freq from 3 byte word 7 | 8 | f = hex2dec(h(:, 1:2))*256 + hex2dec(h(:, 3:4)) + hex2dec(h(:, 5:6))/256; 9 | -------------------------------------------------------------------------------- /ctd_processing/hexword2lonlat.m: -------------------------------------------------------------------------------- 1 | function [lon, lat, newpos] = hexword2lonlat(h) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % function [lon, lat, newpos] = hexword2lonlat(h) 4 | % 5 | % each byte is given as two hex digits 6 | % each SB word is 3 bytes 7 | % calculates lon and lat from 3 byte word 8 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 | %% 10 | b = dec2bin(hex2dec(h(:, 13:14)), 8); 11 | newpos = str2num(b(1,8)); % 1/0 = new/old position 12 | latneg = str2num(b(1,1)); 13 | lonneg = str2num(b(1,2)); 14 | 15 | lat = (-1).^latneg*(hex2dec(h(:, 1:2))*65536 + hex2dec(h(:, 3:4))*256 + hex2dec(h(:, 5:6)))/5e4; 16 | lon = (-1).^lonneg*(hex2dec(h(:, 7:8))*65536 + hex2dec(h(:, 9:10))*256 + hex2dec(h(:, 11:12)))/5e4; 17 | -------------------------------------------------------------------------------- /ctd_processing/hexword2pststat.m: -------------------------------------------------------------------------------- 1 | function [pst, ctdstatus] = hexword2pststat(h) 2 | % function [pst, ctdstatus] = hexword2pststat(h) 3 | % each byte is given as two hex digits 4 | % 12 bit number from 0-4095 represents P sensor temperature 5 | % 4 bit CTD status: 6 | % bit 0 = pump status = 1/0 = on/off 7 | % bit 1 = bottom contact = 1/0 = no contact/contact 8 | % bit 2 = water sampler confirm = 1/0 = deck unit detetcts/does not signal 9 | % bit 3 = CTD modem carrier detects/does not detect deck unit = 1/0 10 | 11 | byte1 = dec2bin(hex2dec(h(:, 1:2)), 8); 12 | byte2 = dec2bin(hex2dec(h(:, 3:4)), 8); 13 | 14 | pst = bin2dec([byte1 byte2(:, 1:4)]); 15 | ctdstatus = byte2(:, 5:8); 16 | -------------------------------------------------------------------------------- /ctd_processing/hexword2spar.m: -------------------------------------------------------------------------------- 1 | function v2 = hexword2spar(h) 2 | % function v2 = hexword2spar(h) 3 | % each byte is given as two hex digits 4 | % each SB voltage is 1.5 words (8 MSB + 4 LSB) 5 | % calculates SPAR voltages from 1.5 byte half word 6 | 7 | byte2 = dec2bin(hex2dec(h(1)), 4); 8 | byte3 = dec2bin(hex2dec(h(2:3)), 8); 9 | v2 = bin2dec([byte2 byte3])/819; 10 | -------------------------------------------------------------------------------- /ctd_processing/hexword2volt.m: -------------------------------------------------------------------------------- 1 | function [v1, v2] = hexword2volt(h) 2 | % function [v1, v2] = hexword2volt(h) 3 | % each byte is given as two hex digits 4 | % each SB voltage is 1.5 words (8 MSB + 4 LSB) 5 | % calculates 2 voltages from 3 byte word 6 | 7 | byte1 = dec2bin(hex2dec(h(:, 1:2)), 8); 8 | byte2 = dec2bin(hex2dec(h(:, 3:4)), 8); 9 | byte3 = dec2bin(hex2dec(h(:, 5:6)), 8); 10 | 11 | v1 = bin2dec([byte1 byte2(:, 1:4)]); 12 | v2 = bin2dec([byte2(:, 5:8) byte3]); 13 | 14 | v1 = 5*(1 - v1/4095); 15 | v2 = 5*(1 - v2/4095); 16 | -------------------------------------------------------------------------------- /ctd_processing/inearby.m: -------------------------------------------------------------------------------- 1 | function k = inearby(ibad, inearm, inearp, n); 2 | % function k = inearby(ibad, inearm, inearp, n); 3 | % 4 | % k = indices at/near ibad 5 | % 6 | ibadm=ibad-inearm; 7 | ibadp=ibad+inearp; 8 | k=unique([ibad(:); ibadm(:); ibadp(:)]); 9 | k(find(k<1)) = []; 10 | k(find(k>n)) = []; 11 | 12 | 13 | -------------------------------------------------------------------------------- /ctd_processing/interpbadsegments.m: -------------------------------------------------------------------------------- 1 | function y = interpbadsegments(x, ibad) 2 | % function y = interpbadsegments(x, ibad) 3 | 4 | segs = findsegments(ibad); 5 | nsegs = length(segs.start); 6 | y = x; 7 | for ii = 1:nsegs 8 | if ~mod(nsegs, 1000) 9 | disp(['interpbadsegments: ' num2str(nsegs - ii)]) 10 | end 11 | i1 = segs.start(ii) - 1; 12 | i2 = [segs.start(ii):segs.stop(ii)]'; 13 | i3 = segs.stop(ii) + 1; 14 | if i1 < 1 15 | disp('interpbadsegments: bad at istart - no interpolation at start') 16 | elseif i3 > length(x) 17 | disp('interpbadsegments: bad at istop - no interpolation at stop') 18 | else 19 | y(i2) = interp1q([i1 i3]', x([i1 i3]), i2); 20 | end 21 | end -------------------------------------------------------------------------------- /ctd_processing/midpoints.m: -------------------------------------------------------------------------------- 1 | function xmid=midpoints(x,ord) 2 | % function xmid=midpoints(x) 3 | 4 | if nargin<2 5 | ord=1; 6 | end; 7 | 8 | [M,N]=size(x); 9 | if M==1 10 | transp=1; 11 | x=x'; 12 | else 13 | transp=0; 14 | end; 15 | 16 | if ord==1 17 | xmid = x(1:end-1,:)+diff(x)/2; 18 | if transp 19 | xmid=xmid'; 20 | end; 21 | else 22 | error('Not implemented'); 23 | end; -------------------------------------------------------------------------------- /ctd_processing/nanfilt.m: -------------------------------------------------------------------------------- 1 | function y = filtfiltnan(b,a,x) 2 | 3 | % filtfilt, but removes nans 4 | y=NaN*x; 5 | ig=find(~isnan(x)); 6 | 7 | x=interp1(ig,x(ig),1:length(x)); 8 | ig=find(~isnan(x)); 9 | y(ig)=filtfilt(b,a,x(ig)); 10 | -------------------------------------------------------------------------------- /ctd_processing/physicalunits.m: -------------------------------------------------------------------------------- 1 | function data = physicalunits(data, cfg) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % function data = physicalunits(data, cfg) 5 | % 6 | % Original code from Jen MacKinnon. 7 | % Added to 'ctd_processing' folder by A. Pickering April 23 2015 8 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 | %% 10 | p_atm = 10.1353; 11 | data.p = freq2pressure(data.p, data.pst, cfg.pcal) - p_atm; 12 | data.t1 = freq2temp(data.t1, cfg.t1cal); 13 | data.t2 = freq2temp(data.t2, cfg.t2cal); 14 | data.c1 = freq2cond(data.c1, data.t1, data.p, cfg.c1cal); 15 | data.c2 = freq2cond(data.c2, data.t2, data.p, cfg.c2cal); 16 | data = rmfield(data, 'pst'); 17 | 18 | return 19 | %% -------------------------------------------------------------------------------- /ctd_processing/preen.m: -------------------------------------------------------------------------------- 1 | function xp=preen(x,xmin,xmax) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % function xp=preen(x,xmin,xmax) 4 | % 5 | % eliminates values of x outside the range 6 | % defined by xmin and xmax in favor of interpolated values. 7 | % 8 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 | %% 10 | xin=x; 11 | count=[1:length(x)]'; 12 | ii=find(x < xmin | x > xmax | imag(x) ~= 0); 13 | x(ii)=[]; 14 | cp=count; 15 | count(ii)=[]; 16 | 17 | if ~isempty(x) 18 | xp=interp1q(count,x,cp); 19 | else 20 | % xp=nan*ones(size(xin)); 21 | xp=xin; warning('all values outside range, not doing anything') 22 | end 23 | 24 | clear xin 25 | 26 | %% -------------------------------------------------------------------------------- /ctd_processing/swcalcs-1.m: -------------------------------------------------------------------------------- 1 | function data = swcalcs(data, cfg) 2 | % function data = swcalcs(data, cfg) 3 | % calc s1 s2 theta1 theta2 sigma1 sigma2 oxygen depth 4 | 5 | data.s1 = sw_salt(10*data.c1/sw_c3515, data.t1, data.p); 6 | data.s2 = sw_salt(10*data.c2/sw_c3515, data.t2, data.p); 7 | 8 | data.theta1 = sw_ptmp(data.s1, data.t1, data.p,0); 9 | data.theta2 = sw_ptmp(data.s2, data.t2, data.p,0); 10 | 11 | data.sigma1 = sw_pden(data.s1, data.t1, data.p, 0); 12 | data.sigma2 = sw_pden(data.s2, data.t2, data.p, 0); 13 | 14 | %data.oxygen = volt2ox(data.oxygen, data.s1, data.t1, data.p, cfg.oxcal); 15 | 16 | data.depth = sw_dpth(data.p, data.lat); 17 | 18 | 19 | -------------------------------------------------------------------------------- /ctd_processing/swcalcs.m: -------------------------------------------------------------------------------- 1 | function data = swcalcs(data) 2 | % function data = swcalcs(data) 3 | % calc s1 s2 theta1 theta2 sigma1 sigma2 oxygen depth 4 | 5 | data.s1 = sw_salt(10*data.c1/sw_c3515, data.t1, data.p); 6 | data.s2 = sw_salt(10*data.c2/sw_c3515, data.t2, data.p); 7 | 8 | data.theta1 = sw_ptmp(data.s1, data.t1, data.p,0); 9 | data.theta2 = sw_ptmp(data.s2, data.t2, data.p,0); 10 | 11 | data.sigma1 = sw_pden(data.s1, data.t1, data.p, 0); 12 | data.sigma2 = sw_pden(data.s2, data.t2, data.p, 0); 13 | 14 | %data.oxygen = volt2ox(data.oxygen, data.s1, data.t1, data.p, cfg.oxcal); 15 | 16 | data.depth = sw_dpth(data.p, data.lat); 17 | 18 | 19 | -------------------------------------------------------------------------------- /ctd_processing/volt2ox.m: -------------------------------------------------------------------------------- 1 | function ox=volt2ox(v,s,t,p,oxcal) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | %function ox=volt2ox(v,s,t,p,oxcal) calculates oxygen concentration in 4 | % 5 | % ml/l given volts from sensor, temperature, salinity, and oxygen 6 | % calibration structure oxcal. 7 | % 8 | %D. Rudnick 07/30/06 9 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 | ox=(oxcal.soc*(v+oxcal.voffset)).*exp(oxcal.tcor*t).*sw_satO2(s,t).*exp(oxcal.pcor*p); 11 | -------------------------------------------------------------------------------- /droppoint/do_droppoint.m: -------------------------------------------------------------------------------- 1 | dirname = 'c:\data\hm02\cals\july2002'; 2 | d = dir([dirname '\*.dat']); 3 | for i=29:length(d) 4 | drop_point(d(i).name,'hm02cals'); 5 | end; 6 | -------------------------------------------------------------------------------- /fcs/findDiveFCS.m: -------------------------------------------------------------------------------- 1 | function [ k, n, z, t, s ] = findDiveFCS( ctd, kDive ) 2 | %function [ k n z t s ] = findDive( ctd, kDive ); 3 | %where ctd = struct with ctd.dive, ctd.npts 4 | %finds index=k where ctd.dive == kDive, and 5 | %returns k, n, where n=#profile points at k 6 | %if not found, k=0, n=0 7 | % returns arrays z, t, s of valid data 8 | 9 | k = find( ctd.dive == kDive ); 10 | if ~isempty(k) 11 | k = k(1); %if multiple ones, just use first one 12 | n = ctd.npts(k); 13 | %fprintf('found %3d pts at %3d index for dive %4d \n', n, k, kDive); 14 | else 15 | k = 0; 16 | n = 0; 17 | end 18 | 19 | if n>0 20 | z = cell2mat( ctd.p(k) ); 21 | t = cell2mat( ctd.t(k) ); 22 | s = cell2mat( ctd.s(k) ); 23 | else 24 | t = []; 25 | z = []; 26 | s = []; 27 | end 28 | 29 | -------------------------------------------------------------------------------- /general/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/general/.DS_Store -------------------------------------------------------------------------------- /general/aclear.m: -------------------------------------------------------------------------------- 1 | function aclear(varargin) 2 | % ACLEAR 'Anti' clear 3 | % Clears all variables except for those specified. 4 | % 5 | % ACLEAR has three forms: 6 | % ACLEAR var1 var2 var3 7 | % ACLEAR({'var1' 'var2' 'var3'}) 8 | % ACLEAR('var1','var2','var3') 9 | % 10 | % Each of these forms will clear all variables in the current workspace 11 | % EXCEPT for var1, var2 and var3. 12 | % 13 | 14 | if length(varargin)==1 && iscell(varargin{1}) 15 | keep=varargin{1}; 16 | else 17 | keep=varargin; 18 | end 19 | 20 | % What variables exist: 21 | vars=evalin('caller','who'); 22 | 23 | % What variables ARE we clearing?: 24 | clr=setdiff(vars,keep); 25 | 26 | if isempty(clr) % Nothing to clear. 27 | return 28 | end 29 | 30 | % Catenate the string: 31 | str='clear'; 32 | for i0=1:length(clr) 33 | str=[str ' ' clr{i0}]; 34 | end 35 | 36 | % Clear the variables: 37 | evalin('caller',str) 38 | 39 | -------------------------------------------------------------------------------- /general/boot_v5.m: -------------------------------------------------------------------------------- 1 | % function [b] = boot_v5(x,m) 2 | % function to bootstrap series x, m times 3 | % returns 95% CI 4 | 5 | function [b] = boot_v5(x,m) 6 | n = length(x); 7 | clear ss 8 | clear mi 9 | rand('state',sum(100*clock)) 10 | for i=1:m 11 | mi(i) = mean(x(floor(rand(1,n)*n+1))); 12 | % mi(i) = nanmean(x(rand(1,n)*(n-1)+1)); 13 | end; 14 | mi = sort(mi); 15 | lim975_index = round(m*0.025); 16 | ans(1) = mi(lim975_index+1); 17 | ans(2) = mean(mi); 18 | ans(3) = mi(m-lim975_index); 19 | b = ans; 20 | -------------------------------------------------------------------------------- /general/bootstrap_profile.m: -------------------------------------------------------------------------------- 1 | function [bb]=bootstrap_profile(X,nboot) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % function [bb]=bootstrap_profile(X,nboot) 5 | % 6 | % Compute profiles of bootstrap mean and confidence intervals (95%) for a 7 | % set of observations at different depths. 8 | % 9 | % INPUT: 10 | % X : Data to be bootstrapped. Each row is a different depth, each column 11 | % a different observation. Size [M X N] 12 | % nboot : # of times to bootstrap 13 | % 14 | % OUTPUT: 15 | % bb : Vectors of 95% conf. lims and mean:[ lower95% mean upper95%] - Size [M X 3] 16 | % 17 | % Dependencies: 18 | % Uses boot_v5.m to bootstrap at each depth. 19 | % 20 | % 4 Mar. 2015 - A. Pickering - andypicke@gmail.com 21 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 22 | %% 23 | 24 | [M N]=size(X); 25 | bb=nan*ones(M,3); 26 | 27 | for whz=1:M 28 | clear dataToboot 29 | dataToboot=X(whz,:); 30 | dataToboot=dataToboot(~isnan(dataToboot)); 31 | bb(whz,:) = boot_v5(dataToboot,nboot); 32 | end 33 | 34 | return 35 | %% -------------------------------------------------------------------------------- /general/calc_stratification.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/general/calc_stratification.m -------------------------------------------------------------------------------- /general/cropdata.m: -------------------------------------------------------------------------------- 1 | function dat = cropdata(dat,varargin); 2 | % function dat = cropdata(dat,datmin,datmax); 3 | % Crops data to be between datmin and datmax. 4 | % 5 | % Can also be called dat = cropdata(dat,[datmin datmax]); 6 | 7 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:45 $ $Author: aperlin $ 8 | % Originally J. Klymak, July 2002 9 | datlim = varargin{1}; 10 | if nargin==3 11 | datlim = [datlim varargin{2}]; 12 | end; 13 | bad = find(dat>datlim(2)); 14 | dat(bad)=datlim(2); 15 | bad = find(dat.000001 14 | disp(['ddz2: values not evenly spaced!']) 15 | d=NaN; 16 | return 17 | end 18 | del=z(2)-z(1);N=length(z); 19 | d=zeros(N,N); 20 | for n=3:N-2 21 | d(n,n-2)=1.; 22 | d(n,n-1)=-4.; 23 | d(n,n)=6.; 24 | d(n,n+1)=-4.; 25 | d(n,n+2)=1.; 26 | end 27 | d=d/del^4; 28 | return 29 | end 30 | 31 | -------------------------------------------------------------------------------- /general/dn2yd.m: -------------------------------------------------------------------------------- 1 | function [yd,t0]=dn2yd(dn); 2 | % function [yd,t0]=dn2yd(dn); 3 | % Converts MatLab datenum to a yearday... 4 | % 5 | V = datevec(dn); 6 | t0 = datenum(V(:,1),0,0); 7 | t0 = min(t0); 8 | yd=dn-t0; 9 | -------------------------------------------------------------------------------- /general/gappy_max.m: -------------------------------------------------------------------------------- 1 | function out=gappy_max(in); 2 | ind=find(~isnan(in)); 3 | out=max(in(ind)); -------------------------------------------------------------------------------- /general/gappy_mean.m: -------------------------------------------------------------------------------- 1 | function [mn]=gappy_mean(in); 2 | 3 | ind=find(~isnan(in)); 4 | mn=mean(in(ind)); 5 | -------------------------------------------------------------------------------- /general/gappy_min.m: -------------------------------------------------------------------------------- 1 | function out=gappy_min(in); 2 | ind=find(~isnan(in)); 3 | out=min(in(ind)); -------------------------------------------------------------------------------- /general/gappy_std.m: -------------------------------------------------------------------------------- 1 | function st=gappy_std(in) 2 | 3 | ind=find(~isnan(in)); 4 | st=std(in); -------------------------------------------------------------------------------- /general/gappy_var.m: -------------------------------------------------------------------------------- 1 | function [vr]=gappy_var(in); 2 | 3 | ind=find(~isnan(in)); 4 | vr=var(in(ind)); 5 | -------------------------------------------------------------------------------- /general/interp_missing_data.m: -------------------------------------------------------------------------------- 1 | function in=interp_missing_data(in,maxgap) 2 | % interp_missing_data interpolates over NaNs in a matrix. 3 | % call as function in=interp_missing_data(in,maxgap). 4 | % linear interp of the data in the columnwise direction 5 | % maxgap is the biggest gap we allow to fill (default=5). 6 | % 7 | % see also extrapolate_data, fillgap, fillgap2d 8 | % 9 | % *** (sjw Jan 2018) USE fast_fillgap which is nearly 100x 10 | % faster than this code for large datasets!! *** 11 | 12 | if nargin<2 13 | maxgap=5; 14 | end 15 | [nrow,ncol]=size(in); 16 | 17 | % first we replace all of the NaN occurences in order: 18 | for gapsize=1:maxgap 19 | for k=1:gapsize 20 | tmp=find(isnan(in)); 21 | tmp=tmp(find(tmp>=(1+k) & tmp<=(nrow*ncol-gapsize+k-1))); 22 | in(tmp)=((gapsize-k+1)*in(tmp-k)+k*in(tmp-k+gapsize+1))/(gapsize+1); 23 | % tmp=find(isnan(in)); 24 | % tmp=tmp(find(tmp>=gapsize & tmp<=(nrow*ncol-gapsize))); 25 | end 26 | end 27 | 28 | 29 | -------------------------------------------------------------------------------- /general/invert_filt.m: -------------------------------------------------------------------------------- 1 | function [out]=invert_filt(freq,spec,n_order,f_cut) 2 | % invert_filt applies the correction from an n_order butterworth filter with 3 | % cut-off frequency at f_cut usinq data vector spec at frequencies freq. 4 | % This was the routine before february 24, 1998, but I think it is wrong and 5 | % should be replaced by the thing below ref. Horowitz and Hill pg 269. 6 | % out=spec.*sqrt(1+(freq./f_cut).^(2*n_order)); 7 | out=spec.*(1+(freq./f_cut).^(2*n_order)); -------------------------------------------------------------------------------- /general/make_newtimebase.m: -------------------------------------------------------------------------------- 1 | function time = make_newtimebase(time0,irep); 2 | % function time = make_newtimebase(time0,irep); 3 | % returns the time that is irepped properly. i.e. for cal files, 4 | % cal.TIME is 16000 long, but cal.S1 is 65000 long, so irep=4;... 5 | 6 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:45 $ $Author: aperlin $ 7 | 8 | 9 | % make the time series for different ireps... 10 | ind0 = 1:length(time0); 11 | ind = 1:1/irep:length(time0); 12 | 13 | time = interp1(ind0,time0,ind); 14 | % this is irep-1 too short... 15 | if irep>1 16 | dt = diff(time(end-1:end)); 17 | time = [time time(end)+(1:irep-1)*dt]; 18 | end; 19 | 20 | -------------------------------------------------------------------------------- /general/nanboot_median.m: -------------------------------------------------------------------------------- 1 | % function [b] = nanboot_median(x,m) 2 | % function to bootstrap series x m times 3 | % treating NaNs as missing values, 4 | % returns 95% CI 5 | 6 | function [b] = nanboot_median(x,m) 7 | n = length(x); 8 | clear ss 9 | clear mi 10 | rand('state',sum(100*clock)) 11 | for i=1:m 12 | mi(i) = nanmedian(x(floor(rand(1,n)*n+1))); 13 | % mi(i) = nanmean(x(rand(1,n)*(n-1)+1)); 14 | end; 15 | mi = sort(mi); 16 | lim975_index = round(m*0.025); 17 | ans(1) = mi(lim975_index+1); 18 | ans(2) = median(mi); 19 | ans(3) = mi(m-lim975_index); 20 | b = ans; 21 | -------------------------------------------------------------------------------- /general/nanboot_v5.m: -------------------------------------------------------------------------------- 1 | % function [b] = nanboot_v5(x,m) 2 | % function to bootstrap series x m times 3 | % treating NaNs as missing values, 4 | % returns 95% CI 5 | 6 | function [b] = nanboot_v5(x,m) 7 | n = length(x); 8 | clear ss 9 | clear mi 10 | rand('state',sum(100*clock)) 11 | for i=1:m 12 | mi(i) = nanmean(x(floor(rand(1,n)*n+1))); 13 | % mi(i) = nanmean(x(rand(1,n)*(n-1)+1)); 14 | end; 15 | mi = sort(mi); 16 | lim975_index = round(m*0.025); 17 | ans(1) = mi(lim975_index+1); 18 | ans(2) = nanmean(mi); 19 | ans(3) = mi(m-lim975_index); 20 | b = ans; 21 | -------------------------------------------------------------------------------- /general/nandemean.m: -------------------------------------------------------------------------------- 1 | function y = nandemean(x); 2 | % function y = nandemean(x); 3 | % NANDEMEAN removes the mean of data excluding NaN's. 4 | % 5 | % Y = nandemean(X) removes the mean from each column of X, ignoring NaNs. 6 | % If X is a vector it removes the mean of the vector. 7 | % 8 | 9 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:45 $ $Author: aperlin $ 10 | % J. Klymak, Jan, 2003 11 | 12 | if size(x,1)==1 & size(x,1) 0); 16 | %5/03 change: if ind returns only one point use the next point too 17 | if length(ind)==1 18 | ind=[ind ind+1]; 19 | end 20 | if ~isempty(ind) %2/05 change: fix if there are no points 21 | yi=interp1(x(is(ind)),y(is(ind)),xi,str); 22 | else 23 | yi=NaN*xi; 24 | end 25 | -------------------------------------------------------------------------------- /general/rms.m: -------------------------------------------------------------------------------- 1 | function y = rms(x, dim) 2 | %RMS Root mean squared value. 3 | % For vectors, RMS(X) is the root mean squared value in X. For matrices, 4 | % RMS(X) is a row vector containing the RMS value from each column. For 5 | % N-D arrays, RMS(X) operates along the first non-singleton dimension. 6 | % 7 | % Y = RMS(X,DIM) operates along the dimension DIM. 8 | % 9 | % When X is complex, the RMS is computed using the magnitude 10 | % RMS(ABS(X)). 11 | % 12 | % % Example #1: RMS of sinusoid vector 13 | % x = cos(2*pi*(1:100)/100); 14 | % y = rms(x) 15 | % 16 | % % Example #2: RMS of columns of matrix 17 | % x = [rand(100000,1) randn(100000,1)]; 18 | % y = rms(x, 1) 19 | % 20 | % % Example #3: RMS of rows of matrix 21 | % x = [2 -2 2; 3 3 -3]; 22 | % y = rms(x, 2) 23 | % 24 | % See also MIN, MAX, MEDIAN, MEAN, STD, PEAK2RMS. 25 | 26 | % Copyright 2011 The MathWorks, Inc. 27 | 28 | if nargin==1 29 | y = sqrt(mean(x .* conj(x))); 30 | else 31 | y = sqrt(mean(x .* conj(x), dim)); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /general/sign_corr.m: -------------------------------------------------------------------------------- 1 | function rr=sign_corr(r,N) 2 | % sign_corr(r,N) 3 | % Significance levels for correlation coefficient 4 | % with 95% confidence interval (default, but could be changed) 5 | % (on assumption of Gaussian distribution) 6 | % r is the estimated correlation coefficient (i.e. computed by corrcoef) 7 | % N is the number of sample pairs 8 | zalphaovertwo=1.96; % for 95% confidence interval 9 | % zalphaovertwo=2.575; % for 99% confidence interval 10 | zr=0.5*(log(1+r)-log(1-r)); 11 | sigz=1/(sqrt(N-3)); 12 | zrr(1)=zr-zalphaovertwo*sigz; zrr(2)=zr+zalphaovertwo*sigz; 13 | rr=(exp(2*zrr)-1)./(exp(2*zrr)+1); 14 | -------------------------------------------------------------------------------- /general/smooth.m: -------------------------------------------------------------------------------- 1 | function outy = smooth(inny,length); 2 | % boxcar filter along first dimention of inny 3 | % i.e. if inny=inny(a,b) than 4 | % outy would be filtered along a 5 | % length is a length of boxcar filter 6 | % 7 | 8 | Lh=length; 9 | % filter once horizontally 10 | bh = ones(Lh,1)/Lh;a=1; 11 | 12 | outy = gappy_filter(bh,a,inny,10,1,0); 13 | -------------------------------------------------------------------------------- /general/smooth2.m: -------------------------------------------------------------------------------- 1 | function outy = smooth(inny,hlength,vlength); 2 | % 3 | % outy = smooth(inny,hlength,vlength); 4 | % 5 | % boxcar filter along first and then second 6 | % dimention of inny 7 | % i.e. if inny=inny(a,b), than outy 8 | % would be filtered along a and then b 9 | % hlength is a length of boxcar filter along b 10 | % vlength is a length of boxcar filter along a 11 | % 12 | 13 | 14 | Lh=hlength;Lv=vlength; 15 | % filter once horizontally 16 | bh = ones(Lh,1)/Lh;a=1; 17 | bv = ones(Lv,1)/Lv;a=1; 18 | 19 | outy = gappy_filter(bv,a,inny,10,1,0); 20 | outy = gappy_filter(bh,a,outy',10,1,0)'; 21 | -------------------------------------------------------------------------------- /general/space.m: -------------------------------------------------------------------------------- 1 | function in=space(in); 2 | % function in=space(in) changes zeros to 32 so that character strings 3 | % defined in raw files as 0 will become ' ' 4 | 5 | [i,j]=find(~in); 6 | in(i,j)=in(i,j)+32; -------------------------------------------------------------------------------- /general/unv_spec.m: -------------------------------------------------------------------------------- 1 | function [unfreq,unspec]=unv_spec(epsilon_re,nu,kks,f2,fspd) 2 | % function [unfreq,unspec]=unv_spec(epsilon_re,nu,kks,f2,fspd) 3 | % 4 | % Universal spectrum for a given epsilon (epsilon_re). f2 is the 5 | % universal spectrum and kks is the wavenumbers at which the 6 | % spectrum was evaluated. fspd is the profiler fall speed and nu 7 | % the viscocity of water. 8 | 9 | 10 | % function to calculate the universal spectrum corresponding to this epsilon... 11 | % note that ks is defined in terms of radian wavenumber 12 | 13 | 14 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:45 $ $Author: aperlin $ 15 | 16 | ks=(epsilon_re/(nu^3))^.25; 17 | unfreq=ks*kks*fspd; 18 | unspec=(epsilon_re*nu^5)^0.25*ks^2/fspd*f2; 19 | 20 | -------------------------------------------------------------------------------- /graphics/PlotBootProfile.m: -------------------------------------------------------------------------------- 1 | function h=PlotBootProfile(bb,z) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % function h=PlotBootProfile(bb,z) 5 | % 6 | % Plot bootstrap mean and shade in 95% confidence intervals for profile. 7 | % 8 | % INPUT 9 | % bb (MX3): Bootstrap mean and 95% conf. limits from bootstrap_profile.m 10 | % z (MX1): Depth vector corresponding to bb profile. 11 | % 12 | % OUTPUT 13 | % h: Handles to patch and and line. 14 | % 15 | % See also bootstrap_profile.m, boot_v5.m 16 | % 17 | % 4 Mar. 2015 - A. Pickering 18 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 | %% 20 | 21 | hax=gca; 22 | idg=find(~isnan(bb(:,1))); 23 | hf=fill([bb(idg,1)' flipud(bb(idg,3))'],[z(idg)' flipud(z(idg))'],0.75*[1 1 1]); 24 | hf.EdgeColor=[1 1 1]; 25 | hold on 26 | hL=semilogx(bb(:,2),z,'k','linewidth',2) 27 | axis ij 28 | shg 29 | h=[hf hL]; 30 | 31 | return 32 | %% -------------------------------------------------------------------------------- /graphics/cbfreeze.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/cbfreeze.m -------------------------------------------------------------------------------- /graphics/cblabel.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/cblabel.m -------------------------------------------------------------------------------- /graphics/cbunits.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/cbunits.m -------------------------------------------------------------------------------- /graphics/cm_and_cb_utilities.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/cm_and_cb_utilities.png -------------------------------------------------------------------------------- /graphics/colordot.m: -------------------------------------------------------------------------------- 1 | function h=colorline(x,y,c,ms); 2 | % function h=colorline(x,y,c,lw); 3 | % 4 | % Makes a filled color line at x,y with color c. lw is the line 5 | % width. 6 | % 7 | 8 | if nargin<4 9 | ms=6; 10 | end; 11 | 12 | if size(x,1)>size(x,2) 13 | x=x'; 14 | end; 15 | if size(y,1)>size(y,2) 16 | y=y'; 17 | end; 18 | if size(c,1)>size(c,2) 19 | c=c'; 20 | end; 21 | 22 | % if all x or all y cannot be identical 23 | if nanmin(x)==nanmax(x) 24 | x(end)=x(end-1)*0.999999; 25 | end 26 | if nanmin(y)==nanmax(y) 27 | y(end)=y(end-1)*0.999999; 28 | end 29 | % now we need to find the NaNs 30 | %good = find(~isnan(x) & ~isnan(y) & ~isnan(c)); 31 | %x=x(good);y=y(good);c=c(good); 32 | xx=[x;x]';yy=[y;y]'; 33 | cc=[c;c]'; 34 | 35 | 36 | % h=surface(xx,yy,cc); 37 | h=pcolor(xx,yy,cc); 38 | set(h,'facecolor','none','edgecolor','flat','linestyle','none',... 39 | 'marker','.','markersize',ms); 40 | 41 | -------------------------------------------------------------------------------- /graphics/colorline.m: -------------------------------------------------------------------------------- 1 | function h=colorline(x,y,c,lw); 2 | % function h=colorline(x,y,c,lw); 3 | % 4 | % Makes a filled color line at x,y with color c. lw is the line 5 | % width. 6 | % 7 | 8 | if nargin<4 9 | lw=4; 10 | end; 11 | 12 | if size(x,1)>size(x,2) 13 | x=x'; 14 | end; 15 | if size(y,1)>size(y,2) 16 | y=y'; 17 | end; 18 | if size(c,1)>size(c,2) 19 | c=c'; 20 | end; 21 | 22 | % now we need to find the NaNs 23 | %good = find(~isnan(x) & ~isnan(y) & ~isnan(c)); 24 | %x=x(good);y=y(good);c=c(good); 25 | xx=[x;x]';yy=[y;y]'; 26 | cc=[c;c]'; 27 | 28 | 29 | % h=surface(xx,yy,cc); 30 | h=pcolor(xx,yy,cc); 31 | set(h,'facecolor','none','edgecolor','flat','linewidth',lw); 32 | 33 | -------------------------------------------------------------------------------- /graphics/export_fig/.gitignore: -------------------------------------------------------------------------------- 1 | /.ignore 2 | *.txt 3 | *.asv 4 | *~ 5 | *.mex* 6 | -------------------------------------------------------------------------------- /graphics/export_fig/.ignore/ghostscript.txt: -------------------------------------------------------------------------------- 1 | /usr/local/bin/gs -------------------------------------------------------------------------------- /graphics/export_fig/.ignore/gs_font_path.txt: -------------------------------------------------------------------------------- 1 | /usr/share/fonts:/usr/local/share/fonts:/usr/share/fonts/X11:/usr/local/share/fonts/X11:/usr/share/fonts/truetype:/usr/local/share/fonts/truetype -------------------------------------------------------------------------------- /graphics/export_fig/ImageSelection.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/export_fig/ImageSelection.class -------------------------------------------------------------------------------- /graphics/export_fig/ImageSelection.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/export_fig/ImageSelection.java -------------------------------------------------------------------------------- /graphics/export_fig/print2eps.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/export_fig/print2eps.m -------------------------------------------------------------------------------- /graphics/jtext.m: -------------------------------------------------------------------------------- 1 | function h=jtext(str,x,y,varargin); 2 | if ~exist('x','var') 3 | x=.05; 4 | end 5 | if ~exist('y','var') 6 | y=1.05; 7 | end 8 | h=text(x,y,str,'units','normalized','fontweight','bold',varargin{:}); 9 | end 10 | -------------------------------------------------------------------------------- /graphics/m_colordot.m: -------------------------------------------------------------------------------- 1 | function h=colorline(x,y,c,ms); 2 | % function h=colorline(x,y,c,lw); 3 | % 4 | % Makes a filled color line at x,y with color c. lw is the line 5 | % width. 6 | % 7 | 8 | if nargin<4 9 | ms=6; 10 | end; 11 | 12 | if size(x,1)>size(x,2) 13 | x=x'; 14 | end; 15 | if size(y,1)>size(y,2) 16 | y=y'; 17 | end; 18 | if size(c,1)>size(c,2) 19 | c=c'; 20 | end; 21 | 22 | % now we need to find the NaNs 23 | %good = find(~isnan(x) & ~isnan(y) & ~isnan(c)); 24 | %x=x(good);y=y(good);c=c(good); 25 | xx=[x;x]';yy=[y;y]'; 26 | cc=[c;c]'; 27 | 28 | 29 | % h=surface(xx,yy,cc); 30 | h=m_pcolor(xx,yy,cc); 31 | set(h,'facecolor','none','edgecolor','flat','linestyle','none',... 32 | 'marker','.','markersize',ms); 33 | 34 | -------------------------------------------------------------------------------- /graphics/m_map/doc/SouthChinaSea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/SouthChinaSea.png -------------------------------------------------------------------------------- /graphics/m_map/doc/VanHarb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/VanHarb.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exColmaps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exColmaps.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exMAG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exMAG.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exSAR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exSAR.png -------------------------------------------------------------------------------- /graphics/m_map/doc/ex_ssmi2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/ex_ssmi2.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exargo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exargo.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exbathym.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exbathym.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exblueT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exblueT.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exblueocean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exblueocean.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exgoog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exgoog.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exgshhs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exgshhs.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exlamber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exlamber.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exmiller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exmiller.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exmodis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exmodis.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exncread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exncread.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exobl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exobl2.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exquiv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exquiv.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exrring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exrring.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exsinus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exsinus.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exspeckle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exspeckle.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exsst.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exsst.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exstepjet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exstepjet.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exstepjetT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exstepjetT.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exster.png -------------------------------------------------------------------------------- /graphics/m_map/doc/extbase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/extbase.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exterra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exterra.png -------------------------------------------------------------------------------- /graphics/m_map/doc/extrack1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/extrack1.png -------------------------------------------------------------------------------- /graphics/m_map/doc/exvec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/exvec.png -------------------------------------------------------------------------------- /graphics/m_map/doc/mlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/mlogo.png -------------------------------------------------------------------------------- /graphics/m_map/doc/new.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/new.gif -------------------------------------------------------------------------------- /graphics/m_map/doc/shaded1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/shaded1.png -------------------------------------------------------------------------------- /graphics/m_map/doc/stepjet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/stepjet.png -------------------------------------------------------------------------------- /graphics/m_map/doc/usermap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/doc/usermap.gif -------------------------------------------------------------------------------- /graphics/m_map/m_coast.m: -------------------------------------------------------------------------------- 1 | function h=m_coast(varargin) 2 | % M_COAST Add a coastline to a given map. 3 | % M_COAST draw a coastline as either filled patches (slow) or 4 | % lines (fast) on a given projection. It uses a coastline database with 5 | % a resolution of about 1/4 degree. 6 | % 7 | % M_COAST( (standard line option,...,...) ) or 8 | % M_COAST('line', (standard line option,...,...) ) draws the coastline 9 | % as a simple line. 10 | % M_COAST('patch' ( ,standard patch options,...,...) ) draws the 11 | % coastline as a number of patches. 12 | % 13 | % 14 | % See also M_PROJ, M_GRID 15 | 16 | % Rich Pawlowicz (rich@ocgy.ubc.ca) 15/June/98 17 | % 18 | % 19 | % This software is provided "as is" without warranty of any kind. But 20 | % it's mine, so you can't sell it. 21 | 22 | 23 | % Set current projection to geographic 24 | Currentmap=m_coord('set'); 25 | m_coord('geographic'); 26 | 27 | 28 | h=mu_coast('default',varargin{:},'tag','m_coast'); 29 | 30 | m_coord(Currentmap.name); 31 | -------------------------------------------------------------------------------- /graphics/m_map/m_plot.m: -------------------------------------------------------------------------------- 1 | function han = m_plot(varargin) 2 | 3 | % M_PLOT Plot objects on an M_MAP plot. All of the normal 4 | % Matlab plot options are available. NOTE - this isn't exactly 5 | % like plot as only the first two arguments are actually converted 6 | % to map coords, i.e.: 7 | % 8 | % USAGE: M_PLOT(LON,LAT,[OPTIONS]) 9 | % 10 | 11 | % Deirdre Byrne, dbyrne@umeoce.maine.edu 00/07/27 (v1.1) 12 | % 13 | % This software is provided "as is" without warranty of any kind. 14 | 15 | global MAP_PROJECTION MAP_VAR_LIST 16 | 17 | if isempty(MAP_PROJECTION) 18 | disp('No Map Projection initialized - call M_PROJ first!'); 19 | return; 20 | end 21 | 22 | if nargin < 2 23 | help m_plot 24 | return 25 | end 26 | 27 | [x,y] = m_ll2xy(varargin{1},varargin{2}); 28 | varargin = varargin(:); 29 | s = size(varargin,1); 30 | h=plot(x,y,varargin{3:s}); 31 | 32 | if nargout == 1 33 | han = h; 34 | end 35 | 36 | return 37 | -------------------------------------------------------------------------------- /graphics/m_map/m_usercoast.m: -------------------------------------------------------------------------------- 1 | function m_usercoast(varargin) 2 | % M_USERCOAST Add a coastline using a user-specified coastline file. 3 | % M_USERCOAST(FILENAME) uses data previously extracted and stored 4 | % in FILENAME to draw a coast. 5 | % 6 | % M_USERCOAST(... ,(standard line option,...,...) ) draws the coastline 7 | % as a simple line. 8 | % M_USERCOAST(..., 'patch' ( ,standard patch options,...,...) ) draws the 9 | % coastline as a number of patches. 10 | % M_USERCOAST(..., 'speckle' ( ,standard line options,...,...) ) draws the 11 | % coastline as a speckled line. 12 | % 13 | % 14 | % See also M_PROJ, M_GRID, M_COAST, M_GSHHS_C 15 | 16 | % Rich Pawlowicz (rich@ocgy.ubc.ca) 15/June/98 17 | % 18 | % 19 | % This software is provided "as is" without warranty of any kind. But 20 | % it's mine, so you can't sell it. 21 | 22 | mu_coast('user',varargin{:},'tag','m_usercoast'); 23 | 24 | -------------------------------------------------------------------------------- /graphics/m_map/m_xydist.m: -------------------------------------------------------------------------------- 1 | function dist = m_xydist(x,y) 2 | % M_XYDIST Spherical earth distance between points in map projection coordinates. 3 | % RANGE=M_XYDIST(X,Y) gives the distance in kilometers between 4 | % successive points in the vectors X and Y which are coordinates 5 | % in the current map projection. This function is useful for finding 6 | % distances between points "picked off" a map, e.g.: 7 | % 8 | % Example: 9 | % G = GINPUT(2); km_dist = M_XYDIST(G(:,1),G(:,2)); 10 | % 11 | % See also M_LLDIST 12 | 13 | % Rich Pawlowicz (rich@ocgy.ubc.ca) 6/Nov/00, based largely on an 14 | % idea by Deirdre Byrne. 15 | 16 | % This software is provided "as is" without warranty of any kind. But 17 | % it's mine, so you can't sell it. 18 | 19 | global MAP_PROJECTION MAP_VAR_LIST 20 | 21 | if isempty(MAP_PROJECTION) 22 | disp('No Map Projection initialized - call M_PROJ first!'); 23 | return; 24 | end 25 | 26 | % get lon, lat coords 27 | [lon,lat] = m_xy2ll(x,y); 28 | 29 | dist = m_lldist(lon,lat); 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /graphics/m_map/private/m_coasts.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/private/m_coasts.mat -------------------------------------------------------------------------------- /graphics/m_map/private/mc_ellips.m: -------------------------------------------------------------------------------- 1 | function MAP_ELLIP=mc_ellips() 2 | % 3 | % Definitions of different ellipsoids 4 | % 5 | 6 | % Rich Pawlowicz (rich@ocgy.ubc.ca) 7 | 8 | MAP_ELLIP = struct ( ... 9 | 'normal', [1.0, 0], ... 10 | 'sphere', [6370997.0, 0], ... 11 | 'grs80' , [6378137.0, 1/298.257], ... 12 | 'grs67' , [6378160.0, 1/247.247], ... 13 | 'wgs84' , [6378137.0, 1/298.257], ... 14 | 'wgs72' , [6378135.0, 1/298.260], ... 15 | 'wgs66' , [6378145.0, 1/298.250], ... 16 | 'wgs60' , [6378165.0, 1/298.300], ... 17 | 'clrk66', [6378206.4, 1/294.97870], ... 18 | 'clrk80', [6378249.1, 1/293.466], ... 19 | 'intl24', [6378388.0, 1/297.000], ... 20 | 'intl67', [6378157.5, 1/298.250]); 21 | -------------------------------------------------------------------------------- /graphics/m_map/private/mp_tmerc.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/graphics/m_map/private/mp_tmerc.m -------------------------------------------------------------------------------- /graphics/m_map/wysiwyg.m: -------------------------------------------------------------------------------- 1 | function wysiwyg 2 | %WYSIWYG -- this function is called with no args and merely 3 | % changes the size of the figure on the screen to equal 4 | % the size of the figure that would be printed, 5 | % according to the papersize attribute. Use this function 6 | % to give a more accurate picture of what will be 7 | % printed. 8 | % 9 | % Particularly useful after calling ORIENT to set a papersize. 10 | 11 | % Dan(K) Braithwaite, Dept. of Hydrology U.of.A 11/93 12 | % 13 | % Changes: Dec/2017 - updated for post-2014b matlab 14 | 15 | unis = get(gcf,'units'); 16 | ppos = get(gcf,'paperposition'); 17 | set(gcf,'units',get(gcf,'paperunits')); 18 | pos = get(gcf,'position'); 19 | pos(3:4) = ppos(3:4); 20 | set(gcf,'position',pos,'PaperPositionMode','manual'); 21 | set(gcf,'units',unis); 22 | 23 | -------------------------------------------------------------------------------- /graphics/putonleft.m: -------------------------------------------------------------------------------- 1 | function h=putonleft(h); 2 | % function h=putonleft(h); 3 | % puts the text pointed to in h on the upper left of plot. 4 | % 5 | 6 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:46 $ $Author: aperlin $ 7 | % J. Klymak July 2002 8 | 9 | set(h,'unit','nor'); 10 | pos = get(h,'pos'); 11 | set(h,'pos',[0 pos(2:3)],'horiz','left'); 12 | return; 13 | -------------------------------------------------------------------------------- /graphics/resize_gca.m: -------------------------------------------------------------------------------- 1 | function resize_gca(pp,h) 2 | % RESIZE_GCA([left_coordinate bottom_coordinate width height],handle) 3 | % resizes the axis handle 4 | % by the amount specified. 5 | 6 | 7 | if nargin==1 8 | h=gca; 9 | end 10 | 11 | pp1=get(h,'position'); 12 | pp1(1:length(pp))=pp+pp1(1:length(pp)); 13 | set(h,'position',pp1) 14 | -------------------------------------------------------------------------------- /graphics/setpaper.m: -------------------------------------------------------------------------------- 1 | function setpaper(varargin) 2 | % function SETPAPER sets the printed output to be the same size as that 3 | % in the window. 4 | if nargin 5 | fig=varargin{1}; 6 | else 7 | fig=gcf; 8 | end 9 | oldunits=get(fig,'units'); 10 | set(fig,'units','inches'); 11 | position=get(fig,'position'); 12 | papersize=get(fig,'papersize'); 13 | paperposition=[(papersize(1)-position(3))/2 (papersize(2)-position(4))/2 ... 14 | position(3) position(4)]; 15 | set(fig,'paperpositionmode','manual','paperposition',paperposition); 16 | set(fig,'units',oldunits); -------------------------------------------------------------------------------- /graphics/smallbar2.m: -------------------------------------------------------------------------------- 1 | function smallbar2(h1,h2,del,s) 2 | if nargin==2 3 | del=.03; 4 | end 5 | p1=get(h1,'position'); 6 | p2=get(h2,'position'); 7 | p1(3)=p1(3)+del; 8 | p2(3)=del/2; 9 | p2(1)=p2(1)+del; 10 | if p1(3)>0 11 | set(h2,'position',p2); 12 | set(h1,'position',p1); 13 | end 14 | 15 | %if nargin==4 16 | %h=text; 17 | %set(h,'string',s,'rot',90,'units','normal','position',[p2(1)-del/2 p2(2)+p2(4)/2]) 18 | %end -------------------------------------------------------------------------------- /graphics/wysiwyg.m: -------------------------------------------------------------------------------- 1 | function wysiwyg 2 | %WYSIWYG -- this function is called with no args and merely 3 | % changes the size of the figure on the screen to equal 4 | % the size of the figure that would be printed, 5 | % according to the papersize attribute. Use this function 6 | % to give a more accurate picture of what will be 7 | % printed. 8 | % Dan(K) Braithwaite, Dept. of Hydrology U.of.A 11/93 9 | 10 | % $Author: aperlin $ $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:46 $ 11 | unis = get(gcf,'units'); 12 | ppos = get(gcf,'paperposition'); 13 | set(gcf,'units',get(gcf,'paperunits')); 14 | pos = get(gcf,'position'); 15 | pos(3:4) = ppos(3:4); 16 | pos(1:2) = [0.2 0.2]; 17 | set(gcf,'position',pos); 18 | set(gcf,'units',unis); 19 | 20 | -------------------------------------------------------------------------------- /marlcham/Contents.m: -------------------------------------------------------------------------------- 1 | % Marlin and Chameleon software 2 | % 3 | % mg_raw_load - load raw Chameleon or Marlin software. 4 | % 5 | % mg_calibrate - calibrate individual data streams. 6 | % 7 | -------------------------------------------------------------------------------- /marlcham/calc_density.m: -------------------------------------------------------------------------------- 1 | function calc_sigma(density_name,salt_name,temp_name,depth_name) 2 | % function CALC_SIGMA(SIGMA_NAME,SALT_NAME,TEMP_NAME,DEPTH_NAME) 3 | % called like: CALC_SIGMA('sigma','S','T','P') 4 | 5 | global cal head 6 | eval(['s=cal.' upper(salt_name) ';,p=cal.' upper(depth_name) ... 7 | ';,t=cal.' upper(temp_name) ';,irep_s=head.irep.' upper(salt_name) ... 8 | ';,irep_t=head.irep.' upper(temp_name) ';,irep_p=head.irep.' ... 9 | upper(depth_name) ';']); 10 | 11 | if irep_p ~= irep_t 12 | % t=decimate(t,irep_t/irep_p); 13 | t=t(1:irep_t/irep_p:length(t)); 14 | end 15 | if irep_p ~= irep_c 16 | % c=decimate(c,irep_c/irep_p); 17 | c=c(1:irep_c/irep_p:length(c)); 18 | end 19 | eval(['cal.' upper(density_name) '=sw_pden(s,t,p);']); 20 | eval(['irep.head.' upper(density_name) '=irep_p;']); 21 | -------------------------------------------------------------------------------- /marlcham/calc_dynamic_z.m: -------------------------------------------------------------------------------- 1 | function head=calc_dynamic_z(avg,head); 2 | inds=find(avg.P>5.25 & avg.P<56.25); 3 | bins=diff(avg.P(inds)); 4 | %size(bins) 5 | if length(inds)>1 6 | %size(inds) 7 | ind2=inds(1:(length(inds)-1)); 8 | % size(ind2) 9 | head.dynamic_gz=sum(bins'./(1000.+avg.SIGMA(ind2)')).*10000; 10 | %eval(['head.dynamic_gz=sum(bins''./(1000.+avg.SIGMA(ind2)'')).*10000;','head.dynamic_gz=NaN;']); 11 | else 12 | head.dynamic_gz=NaN; 13 | end 14 | -------------------------------------------------------------------------------- /marlcham/calc_salt.m: -------------------------------------------------------------------------------- 1 | function calc_salt(salt_name,cond_name,temp_name,depth_name) 2 | % function CALC_SALT(SALT_NAME,COND_NAME,TEMP_NAME,DEPTH_NAME) 3 | % called like: CALC_SALT('S','C','T','P') 4 | 5 | global cal head 6 | eval(['c=cal.' upper(cond_name) ';,p=cal.' upper(depth_name) ... 7 | ';,t=cal.' upper(temp_name) ';,irep_c=head.irep.' upper(cond_name) ... 8 | ';,irep_t=head.irep.' upper(temp_name) ';,irep_p=head.irep.' ... 9 | upper(depth_name) ';']); 10 | if mean(c)<7 11 | error('Check to make sure that Conductivity is in Mmho/cm=mS/cm=10 S/m') 12 | end 13 | if irep_p ~= irep_t 14 | % t=decimate(t,irep_t/irep_p); 15 | t=t(1:irep_t/irep_p:length(t)); 16 | end 17 | if irep_p ~= irep_c 18 | % c=decimate(c,irep_c/irep_p); 19 | c=c(1:irep_c/irep_p:length(c)); 20 | end 21 | eval(['cal.' upper(salt_name) '=sw_salt(c/sw_c3515,t,p);']); 22 | eval(['head.irep.' upper(salt_name) '=irep_p;']); 23 | -------------------------------------------------------------------------------- /marlcham/calc_sigma.m: -------------------------------------------------------------------------------- 1 | function calc_sigma(density_name,salt_name,temp_name,depth_name) 2 | % function CALC_SIGMA(SIGMA_NAME,SALT_NAME,TEMP_NAME,DEPTH_NAME) 3 | % calculates the potential density (sigma_theta) at S,T,P referenced to the surface 4 | % called like: CALC_SIGMA('sigma','S','T','P') 5 | % produces a field of CAL with name THETA_NAME containing the potential 6 | % density 7 | 8 | global cal head 9 | eval(['s=cal.' upper(salt_name) ';,p=cal.' upper(depth_name) ... 10 | ';,t=cal.' upper(temp_name) ';,irep_s=head.irep.' upper(salt_name) ... 11 | ';,irep_t=head.irep.' upper(temp_name) ';,irep_p=head.irep.' ... 12 | upper(depth_name) ';']); 13 | 14 | if irep_p ~= irep_t 15 | % t=decimate(t,irep_t/irep_p); 16 | t=t(1:irep_t/irep_p:length(t)); 17 | end 18 | if irep_p ~= irep_s 19 | % s=decimate(s,irep_s/irep_p); 20 | s=s(1:irep_s/irep_p:length(s)); 21 | end 22 | eval(['cal.' upper(density_name) '=sw_pden(s,t,p,0);']); 23 | eval(['head.irep.' upper(density_name) '=irep_p;']); 24 | -------------------------------------------------------------------------------- /marlcham/calc_theta.m: -------------------------------------------------------------------------------- 1 | function calc_theta(theta_name,salt_name,temp_name,depth_name) 2 | % function CALC_THETA(THETA_NAME,SALT_NAME,TEMP_NAME,DEPTH_NAME) 3 | % calculates potential temperature (theta) at S,T,P referenced to the surface 4 | % called like: CALC_THETA('theta','S','T','P') 5 | % produces a field of CAL with name THETA_NAME containing the potential 6 | % temperature 7 | 8 | global cal head 9 | eval(['s=cal.' upper(salt_name) ';,p=cal.' upper(depth_name) ... 10 | ';,t=cal.' upper(temp_name) ';,irep_s=head.irep.' upper(salt_name) ... 11 | ';,irep_t=head.irep.' upper(temp_name) ';,irep_p=head.irep.' ... 12 | upper(depth_name) ';']); 13 | 14 | if irep_p ~= irep_t 15 | % t=decimate(t,irep_t/irep_p); 16 | t=t(1:irep_t/irep_p:length(t)); 17 | end 18 | if irep_p ~= irep_s 19 | % s=decimate(s,irep_s/irep_p); 20 | s=s(1:irep_s/irep_p:length(s)); 21 | end 22 | eval(['cal.' upper(theta_name) '=sw_ptmp(s,t,p,0);']); 23 | eval(['head.irep.' upper(theta_name) '=irep_p;']); 24 | -------------------------------------------------------------------------------- /marlcham/calibrate/calibrate_p.m: -------------------------------------------------------------------------------- 1 | function out=calibrate_p(in,coeff) 2 | % function OUT=calibrate_p(IN,COEFF) 3 | % TO CALIBRATE PRESSURE IN DECIBARS. 4 | % This function does a polynomial calibration on the 5 | % vector IN with polynomial coefficients given by the 6 | % vector COEFF. 7 | if size(in,2)==2 8 | in=ch(in); 9 | end 10 | % add a gain step if coeff(5) is non-zero 11 | if coeff(5), in=in/coeff(5);, end 12 | % note that the first number converts psi to dBar 13 | out=0.689476*(coeff(1)+coeff(2)*in+coeff(3)*in.^2+coeff(4)*in.^3); 14 | -------------------------------------------------------------------------------- /marlcham/calibrate/calibrate_poly.m: -------------------------------------------------------------------------------- 1 | function out=calibrate_poly(in,coeff) 2 | % function OUT=calibrate_poly(IN,COEFF) 3 | % TO CALIBRATE any series with a standard polynomial calibration 4 | % This function does a polynomial calibration on the 5 | % vector IN with polynomial coefficients given by the 6 | % vector COEFF. 7 | if size(in,2)==2 8 | in=ch(in); 9 | end 10 | % add a gain step if coeff(5) is non-zero 11 | if coeff(5), in=in/coeff(5);, end 12 | out=(coeff(1)+coeff(2)*in+coeff(3)*in.^2+coeff(4)*in.^3); 13 | -------------------------------------------------------------------------------- /marlcham/calibrate/calibrate_tc.m: -------------------------------------------------------------------------------- 1 | function [tc,coef]=qv_caltc(t1,T0,cjc,mini,maxi) 2 | % function [tc,coef]=qv_caltc(t1,T0,cjc,index) determines the calibration 3 | % coefficients for the thermocouple based on the thermisot temperature of a 4 | % range of thermistor indices (index). 5 | if size(cjc,2)==2 6 | cjc=ch(cjc); 7 | end 8 | if size(T0,2)==2 9 | T0=ch(T0); 10 | end 11 | if nargin==3 12 | mini=1; 13 | maxi=length(cjc); 14 | end 15 | 16 | step=20; 17 | lt0=length(T0); 18 | irep=lt0/length(t1); 19 | 20 | [b,a]=butter(2,.1./irep); 21 | T0_filt=filtfilt(b,a,T0); 22 | [b,a]=butter(2,.1); 23 | t1_filt=filtfilt(b,a,t1); 24 | [b,a]=butter(2,.02); 25 | cjc=filtfilt(b,a,cjc); 26 | index=mini:step:maxi; 27 | b=regress(t1_filt(index),[ones(size(T0_filt(irep*index))) T0_filt(irep*index) cjc(index)]); 28 | tc=b(1)+T0*b(2)+makelen(cjc,lt0)*b(3); 29 | coef=[b' 0 1]; -------------------------------------------------------------------------------- /marlcham/calibrate/calibrate_tcp.m: -------------------------------------------------------------------------------- 1 | function out=calibrate_tcp(tcp,coeff_tcp,tc,coeff_tc,fspd) 2 | % function out=qv_caltcp(tcp,coeff_tcp,tc,coeff_tc,fspd) 3 | % This function does a polynomial calibration on the 4 | % vector tcp with time constant given in coeff_tcp, dc time series 5 | % given in tc, and polynomial coefficients for tc given by coeff_tc 6 | if size(tc,2)==2 7 | tc=ch(tc); 8 | end 9 | if size(tcp,2)==2 10 | tcp=ch(tcp); 11 | end 12 | if coeff_tcp(1)==0 13 | coeff_tcp(1)=coeff_tcp(2); 14 | end 15 | ltcp=length(tcp); 16 | tc=makelen(tc,ltcp); 17 | fspd=makelen(fspd,ltcp); 18 | warning off 19 | out=(coeff_tc(2)).*tcp.*100./(coeff_tcp(1)*fspd); 20 | out(find(fspd<5))=NaN; 21 | warning on -------------------------------------------------------------------------------- /marlcham/calibrate/calibrate_tilt.m: -------------------------------------------------------------------------------- 1 | function out=calibrate_tilt(in,coeff) 2 | % function OUT=calibrate_tilt(IN,COEFF) 3 | % TO CALIBRATE acceleration in degrees. 4 | % This function does a polynomial calibration on the 5 | % vector IN with polynomial coefficients given by the 6 | % vector COEFF. 7 | if size(in,2)==2 8 | in=ch(in); 9 | end 10 | % add a gain step if coeff(5) is non-zero 11 | if coeff(5), in=in/coeff(5);, end 12 | 13 | out=real(180/pi*asin(coeff(1)+coeff(2)*in+coeff(3)*in.^2+coeff(4)*in.^3)); -------------------------------------------------------------------------------- /marlcham/calibrate/calibrate_w_old.m: -------------------------------------------------------------------------------- 1 | function out=calibrate_w(in,coef,spd) 2 | % function OUT=calibrate_w(IN,COEFF) 3 | % This function calibrates raw voltages from DC-pitot 4 | % module using sensitivity in header coeff.W(2) 5 | % cgs units 6 | rho=1.024;% nominal density 7 | if size(in,2)==2 8 | in=ch(in); 9 | end 10 | in=in(1:length(in)/length(spd):length(in)); 11 | % check to make sure gain is non-zero: 12 | if ~coef(5),coef(5)=1;, end 13 | sp=coef(5)/coef(2);% probe sensitivity [volts/(dyne/cm^2)] 14 | out=in./(2*rho*spd.*sp); 15 | -------------------------------------------------------------------------------- /marlcham/density_contours.m: -------------------------------------------------------------------------------- 1 | % function dens=density_contours(s,t) 2 | % computes density over the ranges 3 | % specified by s, t 4 | % I wrote this to use to plot density 5 | % contours on s T-S plot, hence the name 6 | % example - define s=35:1:39; 7 | % t=2:1:15; 8 | % jnm 9/99 9 | 10 | function dens=density_contours(s,t) 11 | 12 | dens=[]; 13 | %s=34.15:0.001:34.19; 14 | %t=2.2:0.001:2.5; 15 | 16 | for i=1:length(s) 17 | for j=1:length(t) 18 | dens(i,j)=sw_dens(s(i),t(j),0); 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /marlcham/determine_depth_range.m: -------------------------------------------------------------------------------- 1 | function [qmini,qmaxi,got_bottom]=determine_depth_range(qtop) 2 | % determine_depth_range(TOP) is a script to determine the slow-sampled 3 | % indices which correspond to the begining and the end of the range over 4 | % which most quantities will be calibrated. TOP is the upper limit of the 5 | % range; the bottom is determined using find_bottom 6 | 7 | 8 | if nargin==0 9 | qtop=9; 10 | end 11 | 12 | global cal data 13 | 14 | [qmaxi, got_bottom]=find_bot(cal.P,cal.AZ); 15 | if qmaxi==length(cal.P) 16 | qmaxi=qmaxi-1; 17 | end 18 | qmaxi=qmaxi-1; 19 | 20 | qmini=max(find(cal.P(1:qmaxi)= ts & cham.time <= tf); 10 | dep=[]; 11 | 12 | for i=ipx; 13 | % find depth of density surface 14 | good=~isnan(cham.SIGMA(:,i)); 15 | zz=interp1(cham.SIGMA(good,i),cham.depth(good)',density); 16 | dep=[dep zz']; 17 | end 18 | iso.profno=cham.castnumber(ipx); 19 | iso.depth=dep; 20 | iso.dens=density; 21 | iso.time=cham.time(ipx); 22 | iso.lat=cham.lat(ipx); 23 | iso.lon=cham.lon(ipx); 24 | 25 | %[c,h]=contour(chamgrid.time,-chamgrid.depth,chamgrid.dens,[1023,1024,1025]); 26 | %set(h,'edgecolor','b') 27 | %set(gca,'visible','off') -------------------------------------------------------------------------------- /marlcham/lag_sensor.m: -------------------------------------------------------------------------------- 1 | function in=lag_sensor(in,lag) 2 | % function out=lag_sensor(in,lag) 3 | % positive lag mean that the sensor responds before the average sensor 4 | % negative lag means that the sensor responds after the average. 5 | 6 | lin=length(in); 7 | if lag>0 8 | in(lag+1:lin,:)=in(1:lin-lag,:); 9 | for j=1:lag 10 | in(j,:)=in(1,:); 11 | end 12 | elseif lag<0 13 | in(1:lin+lag,:)=in(-lag+1:lin,:); 14 | for j=lag+1:0 15 | in(lin+j,:)=in(lin,:); 16 | end 17 | end -------------------------------------------------------------------------------- /marlcham/lonlattox.m: -------------------------------------------------------------------------------- 1 | function [x,y]=lonlattox(lon,lat,lon0,lat0); 2 | %subroutine for plot_panels.m 3 | mpernm=1.85318e3; 4 | dlon = lon-lon0(1); 5 | dlat = lat-lat0(1); 6 | xx = 60*dlon*mpernm*cos(mean(lat0)*pi/180) + sqrt(-1)*60*dlat* ... 7 | mpernm; 8 | 9 | x = real(xx); 10 | y = imag(xx); 11 | return; 12 | -------------------------------------------------------------------------------- /marlcham/make_time_series.m: -------------------------------------------------------------------------------- 1 | function cal=mg_make_time_series(data,head,cal) 2 | % function MAKE_TIME_SERIES creates a time series based on 3 | % head.slow_samp_rate. The time series is stored in cal.TIME and has a 4 | % repition rate of 1 (head.irep.TIME=1) 5 | 6 | eval(['len=length(data.' head.sensor_name(1,:) ')/head.irep.' ... 7 | head.sensor_name(1,:) ';']); 8 | cal.TIME=1/(head.slow_samp_rate)*[0:(len-1)]'; 9 | head.irep.TIME=1; 10 | -------------------------------------------------------------------------------- /marlcham/mg_calc_salt.m: -------------------------------------------------------------------------------- 1 | function [cal head]=mg_calc_salt(salt_name,cond_name,temp_name,depth_name,cal,head) 2 | % [CAL HEAD]=MG_CALC_SALT(SALT_NAME,COND_NAME,TEMP_NAME,DEPTH_NAME,CAL,HEAD) 3 | % 4 | c=cal.(upper(cond_name)); 5 | p=cal.(upper(depth_name)); 6 | t=cal.(upper(temp_name)); 7 | irep_c=head.irep.(upper(cond_name)); 8 | irep_t=head.irep.(upper(temp_name)); 9 | irep_p=head.irep.(upper(depth_name)); 10 | 11 | if mean(c)<10 12 | disp('Check to make sure that Conductivity is in Mmho/cm=mS/cm=10 S/m') 13 | end 14 | if irep_p ~= irep_t 15 | % t=decimate(t,irep_t/irep_p); 16 | % t=t(1:irep_t/irep_p:length(t)); 17 | t=nanmedian(reshape(t,irep_t/irep_p,length(p)),1)'; 18 | end 19 | if irep_p ~= irep_c 20 | % c=decimate(c,irep_c/irep_p); 21 | % c=c(1:irep_c/irep_p:length(c)); 22 | t=nanmedian(reshape(c,irep_c/irep_p,length(p)),1)'; 23 | end 24 | cal.(upper(salt_name))=sw_salt(c/sw_c3515,t,p); 25 | head.irep.(upper(salt_name))=irep_p; 26 | -------------------------------------------------------------------------------- /marlcham/mg_calc_sigma.m: -------------------------------------------------------------------------------- 1 | function [cal head]=mg_calc_sigma(density_name,salt_name,temp_name,depth_name,cal,head) 2 | % [CAL HEAD]=CALC_SIGMA(SIGMA_NAME,SALT_NAME,TEMP_NAME,DEPTH_NAME,CAL,HEAD) 3 | % calculates the potential density (sigma_theta) at S,T,P referenced to the surface 4 | % produces a field of CAL with name SIGMA_NAME containing the potential 5 | % density 6 | 7 | s=cal.(upper(salt_name)); 8 | p=cal.(upper(depth_name)); 9 | t=cal.(upper(temp_name)); 10 | irep_s=head.irep.(upper(salt_name)); 11 | irep_t=head.irep.(upper(temp_name)); 12 | irep_p=head.irep.(upper(depth_name)); 13 | 14 | if irep_p ~= irep_t 15 | %t=decimate(t,irep_t/irep_p); 16 | %t=t(1:irep_t/irep_p:length(t)); 17 | t=nanmedian(reshape(t,irep_t/irep_p,length(p)),1)'; 18 | end 19 | if irep_p ~= irep_s 20 | %s=decimate(s,irep_s/irep_p); 21 | %s=s(1:irep_s/irep_p:length(s)); 22 | s=nanmedian(reshape(s,irep_s/irep_p,length(p)),1)'; 23 | end 24 | cal.(upper(density_name))=sw_pden(s,t,p,0); 25 | head.irep.(upper(density_name))=irep_p; 26 | -------------------------------------------------------------------------------- /marlcham/mg_calc_theta.m: -------------------------------------------------------------------------------- 1 | function [cal head]=mg_calc_theta(theta_name,salt_name,temp_name,depth_name,cal,head) 2 | % [CAL HEAD]=MG_CALC_THETA(THETA_NAME,SALT_NAME,TEMP_NAME,DEPTH_NAME,CAL HEAD) 3 | % calculates potential temperature (theta) at S,T,P referenced to the surface 4 | % 5 | % produces a field of CAL with name THETA_NAME containing the potential 6 | % temperature 7 | 8 | eval(['s=cal.' upper(salt_name) ';,p=cal.' upper(depth_name) ... 9 | ';,t=cal.' upper(temp_name) ';,irep_s=head.irep.' upper(salt_name) ... 10 | ';,irep_t=head.irep.' upper(temp_name) ';,irep_p=head.irep.' ... 11 | upper(depth_name) ';']); 12 | 13 | if irep_p ~= irep_t 14 | % t=decimate(t,irep_t/irep_p); 15 | t=t(1:irep_t/irep_p:length(t)); 16 | end 17 | if irep_p ~= irep_s 18 | % s=decimate(s,irep_s/irep_p); 19 | s=s(1:irep_s/irep_p:length(s)); 20 | end 21 | eval(['cal.' upper(theta_name) '=sw_ptmp(s,t,p,0);']); 22 | eval(['head.irep.' upper(theta_name) '=irep_p;']); 23 | -------------------------------------------------------------------------------- /marlcham/mg_make_time_series.m: -------------------------------------------------------------------------------- 1 | function [cal,head]=mg_make_time_series(data,head,cal) 2 | % function [cal,head]=mg_make_time_series(data,head,cal) 3 | % 4 | % function MG_MAKE_TIME_SERIES creates a time series based on 5 | % head.slow_samp_rate. The time series is stored in cal.TIME and has a 6 | % repition rate of 1 (head.irep.TIME=1) 7 | 8 | eval(['len=length(data.' head.sensor_name(1,:) ')/head.irep.' ... 9 | head.sensor_name(1,:) ';']); 10 | cal.TIME=1/(head.slow_samp_rate)*[0:(len-1)]'; 11 | head.irep.TIME=1; 12 | -------------------------------------------------------------------------------- /marlcham/nondim_chi.m: -------------------------------------------------------------------------------- 1 | function [kkb,outspec]=nondim_chi(k,inspec,chi,kb,D) 2 | % function outspec=nondim_chi(inspec,chi,epsilon,nu,D) nondimensionalizes 3 | % a temperature gradient spectrum and wavenumber 4 | 5 | % first make all the matrices the same size: 6 | big_chi=meshgrid(chi',inspec(1,:)); 7 | big_kb=meshgrid(kb',inspec(1,:)); 8 | big_D=meshgrid(D',inspec(1,:)); 9 | kkb=k./big_kb'; 10 | outspec=inspec.*big_kb'.*big_D'./big_chi'; -------------------------------------------------------------------------------- /marlcham/remove_sonar_spikes.m: -------------------------------------------------------------------------------- 1 | function out=remove_sonar_spikes(in,thres); 2 | 3 | % Function out=remove_sonar_spikes(in,OPT_THRESHOLD) removes the 2.5 second spikes 4 | % introduced by the sonar. The threshold default is 0.07. 5 | if nargin==1 6 | thres=.07; 7 | end 8 | out=in; 9 | deriv=diff(in,2); 10 | inds=find(deriv>thres)+1; 11 | inds(find(inds<6))=6; 12 | inds(find(inds>(length(in)-6)))=length(in)-6; 13 | if length(inds)>250*length(in) 14 | warning(['Remove_sonar_spikes removed 1 in ' ... 15 | num2str(floor(length(in)/length(inds))) ' points']) 16 | end 17 | for i=-4:4 18 | out(inds+i)=mean([in(inds+5) in(inds-5)],2); 19 | end 20 | -------------------------------------------------------------------------------- /marlcham/save_matfile.m: -------------------------------------------------------------------------------- 1 | function save_matfile(fn,series) 2 | % function save_matfile(filename,series) writes to FILENAME the series 3 | % SERIES contained within cal. and writes the header information. 4 | 5 | global head cal 6 | nplots=length(series); 7 | for i=1:nplots 8 | tempser=[upper(deblank(char(series(i))))]; 9 | eval(['temp.' upper(tempser) '=cal.' ... 10 | upper(tempser) ';']); 11 | end 12 | cal=temp; 13 | eval(['save ' fn ' cal head']) 14 | -------------------------------------------------------------------------------- /marlcham/select_depth_range.m: -------------------------------------------------------------------------------- 1 | function out=select_depth_range(qmini,qmaxi) 2 | % select_depth_range.m is a script to subsample cal and data over the 3 | % desired index range. 4 | 5 | global data cal head 6 | 7 | f=fieldnames(data); 8 | if ~isempty(f) 9 | for i=1:length(f) 10 | eval(['irep=head.irep.' char(f(i)) ';']); 11 | eval(['data.' char(f(i)) ' =data.' char(f(i)) ... 12 | '(((qmini-1)*irep+1):qmaxi*irep);']); 13 | end 14 | end 15 | 16 | if ~isempty(cal) 17 | f=fieldnames(cal); 18 | if ~isempty(f) 19 | for i=1:length(f) 20 | eval(['irep=head.irep.' char(f(i)) ';']); 21 | eval(['cal.' char(f(i)) ' =cal.' char(f(i)) ... 22 | '(((qmini-1)*irep+1):qmaxi*irep);']); 23 | end 24 | end 25 | end 26 | out=qmaxi-qmini+1; 27 | -------------------------------------------------------------------------------- /marlcham/select_epsilon.m: -------------------------------------------------------------------------------- 1 | function avg=select_epsilon(avg,epsilon_glitch_factor) 2 | % select_epsilon(avg) selects the appropriate epsilon for function to select the smallest epsilon from two shear probes if one 3 | % looks glitchy, otherwise use the average. 4 | % Use S1 if only one shear probe is available. 5 | % EPSILON is returned as avg.EPSILON 6 | 7 | if nargin<2 8 | epsilon_glitch_factor=6; 9 | end 10 | min_eps=10^-10; 11 | 12 | tmp=fieldnames(avg); 13 | if any(strcmp(tmp,'EPSILON1')) & any(strcmp(tmp,'EPSILON2')) 14 | avg.EPSILON=(avg.EPSILON1+avg.EPSILON2)/2; 15 | % determine if EPSILON1>>>EPSILON2 16 | a=find(avg.EPSILON1>epsilon_glitch_factor*avg.EPSILON2 | isnan(avg.EPSILON1)); 17 | avg.EPSILON(a)=avg.EPSILON2(a); 18 | % determine if EPSILON2>>>EPSILON1 19 | a=find(avg.EPSILON2>epsilon_glitch_factor*avg.EPSILON1 | isnan(avg.EPSILON2)); 20 | avg.EPSILON(a)=avg.EPSILON1(a); 21 | else 22 | % if only one shear probe exists. 23 | avg.EPSILON=avg.EPSILON1; 24 | end 25 | -------------------------------------------------------------------------------- /marlcham/spa_cor.m: -------------------------------------------------------------------------------- 1 | function [corrected]=spa_cor(spec,freqs,fallspeed) 2 | % function [corrected]=spa_cor(spec,freqs,fallspeed) 3 | % Function to correct for spatial response of shear probe gives the 4 | % corrected values for spec at frequencies freqs. 5 | % probe spatial transfer function according to ninnis' thesis 1984. 6 | % k0=170 cycles/meter for osborn's probe. 7 | 8 | k0=170; 9 | f0=fallspeed*k0; 10 | % redefine coefficients (dimensionally) in terms of f0 11 | a=[1.0,-0.164/f0,-4.537/f0/f0,5.503/f0^3,-1.804/f0^4]; 12 | corrected=spec; 13 | inds=find(freqs<(.9*f0)); 14 | corrected(inds)=corrected(inds)./(a(1)+freqs(inds).*(a(2)+freqs(inds).*(a(3)+freqs(inds).*(a(4)+freqs(inds)*a(5))))); -------------------------------------------------------------------------------- /marlcham/spice_contours.m: -------------------------------------------------------------------------------- 1 | % function spc=spice_contours(s,t) 2 | % computes spiciness over the ranges 3 | % specified by s, t 4 | % example - define s=35:1:39; 5 | % t=2:1:15; 6 | % AP 12/07 7 | 8 | function spc=spice_contours(s,t) 9 | 10 | spc=[]; 11 | %s=34.15:0.001:34.19; 12 | %t=2.2:0.001:2.5; 13 | 14 | for i=1:length(s) 15 | for j=1:length(t) 16 | spc(i,j)=spice(s(i),t(j)); 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /marlcham/tdif.m: -------------------------------------------------------------------------------- 1 | function tdif=tdif(s,t,p) 2 | % function tdif=tdif(s,t,p) 3 | % temperature diffusivity (m2 s-1) 4 | % 5 | % uses functions cp, rho, tcond 6 | % 7 | % dave hebert 15/04/86 8 | tdif=tcond(s,t,p)/cp(s,t,p)/sw_dens(s,t,p); 9 | -------------------------------------------------------------------------------- /marlcham/therm_resp.m: -------------------------------------------------------------------------------- 1 | function out=therm_resp(power,freq,fcrit,filter) 2 | % function out=therm_response(power,freq,fcrit) 3 | % this function calculates the thermal response 4 | % from Rolf Leuck's 1977 paper.... 5 | % fcrit=25; 6 | %out=power.*(1+(freq./fcrit).^2); 7 | % this used to be the following 8 | % tau=0.035; 9 | %out=power.*(1+(2*pi*tau*freq).^2).^2; 10 | % 11 | % 2 feb 2009 modified to use also double-pole filter 12 | % (Cregg and Meagher, 1980) 13 | % out=power.*(1+(freq./fcrit).^2).^2; 14 | % filter==1 for single-pole (default) 15 | % filter==2 for double-pole 16 | 17 | % I changed this after doing the thermocouple paper... 18 | if nargin==2 19 | fcrit=2; 20 | filter=1; 21 | elseif nargin==3 22 | filter=1; 23 | end 24 | if length(fcrit)==1 25 | fcrit=[fcrit ; fcrit]; 26 | end 27 | if filter==1 28 | out=power.*sqrt(1+(freq./fcrit(1)).^2).*sqrt(1+(freq./fcrit(2)).^2); 29 | elseif filter==2 30 | out=power.*(1+(freq./fcrit(1)).^2).^2; 31 | end 32 | 33 | -------------------------------------------------------------------------------- /ndbc_buoy/make_ndbc_buoy.m: -------------------------------------------------------------------------------- 1 | % make_ndbc_buoy.m 2 | % define input parameters of the data: path, year, station # 3 | dpath='C:\work\ndbc_buoy\data\ney_jersey\'; 4 | year=2007; 5 | station_id='44009'; 6 | %% read and process the data 7 | met=read_NDBCbuoy_meteo([dpath station_id '\'],station_id,year); 8 | wind=read_NDBCbuoy_wind([dpath station_id '\'],station_id,year); 9 | % spwvdens=read_NDBCbuoy_spwvdens(dpath,station_number,year); 10 | % spwvdir=read_NDBCbuoy_spwvdir(dpath,station_number,year); 11 | %% save mat files 12 | save([[dpath station_id '\'] 'ndbc' station_id '_' num2str(year)],... 13 | 'met','wind'); 14 | % save([[dpath station_id '\'] 'ndbc' station_id '_' num2str(year)],... 15 | % 'met','wind','spwvdens','spwvdir'); 16 | -------------------------------------------------------------------------------- /pitot/PTempCal4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/pitot/PTempCal4.fig -------------------------------------------------------------------------------- /pitot/test_GUI.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/pitot/test_GUI.fig -------------------------------------------------------------------------------- /ppod/HSP_Host.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/ppod/HSP_Host.exe -------------------------------------------------------------------------------- /ppod/convert_paro2.m: -------------------------------------------------------------------------------- 1 | function [pressure, temperature]= convert_paro2( u0, y ,c ,d ,t ,pp ,tp ) 2 | % use calibration coefficients 3 | % paroscientific model 2200A 4 | % pp is pressure period in uS 5 | % tp is temperature period in uS 6 | 7 | 8 | u= tp -u0 ; % tp is temperature period 9 | 10 | temperature =(y(1).*u) + (y(2).*u.^2) +( y(3).*u.^3 ) ; 11 | 12 | cee=c(1)+ (c(2).*u) + (c(3).*u.^2) ; 13 | dee=d(1)+ (d(2).*u); 14 | t0 =t(1)+ (t(2).*u) + (t(3).*u.^2) + (t(4).*u.^3)+ (t(5).*u.^4) ; 15 | aa=1-(t0.^2./double(pp) .^2); 16 | pressure =cee.*aa.*(1-dee.*aa); 17 | 18 | return; 19 | 20 | -------------------------------------------------------------------------------- /ppod/matlabtime2ux.m: -------------------------------------------------------------------------------- 1 | function [ ux ]= matlabtime2ux( ml ) 2 | % convert unix time to matlabtime 3 | 4 | ux = (ml -datenum(1970,1,1) ) .* (24*60*60) ; 5 | 6 | return; 7 | 8 | 9 | -------------------------------------------------------------------------------- /ppod/raw_load_ppod.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/ppod/raw_load_ppod.m -------------------------------------------------------------------------------- /ppod/raw_load_ppod_old.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/ppod/raw_load_ppod_old.m -------------------------------------------------------------------------------- /ppod/raw_load_ppod_old1.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/ppod/raw_load_ppod_old1.m -------------------------------------------------------------------------------- /ppod/raw_load_ppod_z.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/ppod/raw_load_ppod_z.m -------------------------------------------------------------------------------- /ppod/uxtime2matlab.m: -------------------------------------------------------------------------------- 1 | function [mlt ]= uxtime2matlab( ux ) 2 | % convert unix time to matlabtime 3 | 4 | mlt = ux./(24*60*60) + datenum(1970,1,1) ; 5 | 6 | 7 | return; 8 | 9 | 10 | -------------------------------------------------------------------------------- /pwp/example_Output.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/pwp/example_Output.mat -------------------------------------------------------------------------------- /pwp/example_s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/pwp/example_s -------------------------------------------------------------------------------- /pwp/example_t: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/pwp/example_t -------------------------------------------------------------------------------- /pwp/example_u: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/pwp/example_u -------------------------------------------------------------------------------- /pwp/example_v: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/pwp/example_v -------------------------------------------------------------------------------- /pwp/private/gmax.m: -------------------------------------------------------------------------------- 1 | function xnew=gmax(x) 2 | %function xnew=gmax(x) 3 | % just like max, except that it skips over bad points 4 | [imax,jmax]=size(x); 5 | 6 | for j=1:jmax 7 | good=find(finite(x(:,j))); 8 | if length(good)>0 9 | xnew(j)=max(x(good,j)); 10 | else 11 | xnew(j)=NaN; 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /pwp/private/gmin.m: -------------------------------------------------------------------------------- 1 | function xnew=gmin(x) 2 | %function xnew=gmin(x) 3 | % just like mix, except that it skips over bad points 4 | [imax,jmax]=size(x); 5 | 6 | for j=1:jmax 7 | good=find(finite(x(:,j))); 8 | if length(good)>0 9 | xnew(j)=min(x(good,j)); 10 | else 11 | xnew(j)=NaN; 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /pwp/pwp_AddMomentum.m: -------------------------------------------------------------------------------- 1 | %pwp_AddMomentum Adds Momentum to top layer 2 | 3 | 4 | % Rotate half angle (other half-angle rotation is in main loop in pwp_Run.m) 5 | UV = UV*rotn; 6 | 7 | % Calculate the mixed layer depth 8 | pwp_MixedLayerDepth 9 | 10 | % Add x momentum 11 | UV(1:mld,1) = UV(1:mld,1) + dt*taux(it)*ones(mld,1)/(rho*(z(mld) + dz/2)); 12 | 13 | % Add y momentum 14 | UV(1:mld,2) = UV(1:mld,2) + dt*tauy(it)*ones(mld,1)/(rho*(z(mld) + dz/2)); 15 | 16 | % Apply drag (if nonzero) in x direction 17 | UV(:,1) = UV(:,1) - dt*r*UV(1:nz,1); 18 | 19 | % Apply drag (if nonzero) in y direction 20 | UV(:,2) = UV(:,2) - dt*r*UV(1:nz,2); 21 | -------------------------------------------------------------------------------- /pwp/pwp_BulkRichardson.m: -------------------------------------------------------------------------------- 1 | %pwp_BulkRichardson Subroutine to do the bulk Richardson number adjustment 2 | % Checks to see if BRi is less than critical value, and 3 | % if so, deepens mixed layer 4 | 5 | 6 | vd = sum((diff(UV).^2)')'; 7 | 8 | % Compute bulk Richardson number (without H, i.e., the bulk Richardson number is H*Ri) 9 | Ri = 9.8/rho*(diff(Sig))./vd; 10 | 11 | % Start at base of mixed layer 12 | for i = mld:nz-2 13 | % Check if the Bulk Richardson number is less than the critical value 14 | if (z(i)+dz/2)*Ri(i) < BRiCrit 15 | mld = i+1; % Deepen by one step 16 | pwp_MixMixedLayer; % Mix everything up 17 | 18 | % Compute the bulk richardson number again 19 | Ri = 9.8/rho*(diff(Sig))./(sum((diff(UV).^2)')'); 20 | nbri = nbri+1; % Keep track of activity 21 | else 22 | % Water column has reached stability. Stop. 23 | break 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /pwp/pwp_MixMixedLayer.m: -------------------------------------------------------------------------------- 1 | %pwp_MixMixedLayer: Subroutine that mixes up the mixed layer 2 | 3 | Tm=mean(T(1:mld)); % Calculate the mean temperature of the mixed layer 4 | T(1:mld)=Tm*ones(mld,1); % Set the temperature of the mixed layer to the mean temperature 5 | Sm=mean(S(1:mld)); % Calculate the mean salinity of the mixed layer 6 | S(1:mld)=Sm*ones(mld,1); % Set the salinity of the mixed layer to the mean salinity 7 | Sigm=mean(Sig(1:mld)); % Calculate the mean density of the mixed layer 8 | Sig(1:mld)=Sigm*ones(mld,1); % Set the density of the mixed layer to the mean density 9 | UVm=mean(UV(1:mld,:),1); % Calculate the mean velocities of the mixed layer 10 | UV(1:mld,1)=UVm(1)*ones(mld,1); % Set the u velocity to the mean u velocity 11 | UV(1:mld,2)=UVm(2)*ones(mld,1); % Set the v velocity to the mean v velocity 12 | -------------------------------------------------------------------------------- /pwp/pwp_MixedLayerDepth.m: -------------------------------------------------------------------------------- 1 | %pwp_MixedLayerDepth PWP subroutine that finds the mixed layer depth index 2 | 3 | 4 | % Calculate the difference in density between depths 5 | delta_sig = [diff(Sig)./dz]; 6 | 7 | % Search for a jump in density, using 10^-4 as an arbitrary small number 8 | D = find(abs(delta_sig)>10^-4); 9 | 10 | % If there is no jump in density greater than 10^-4, 11 | % set the mixed layer depth to 1 (the first grid point) 12 | if isempty(D); 13 | D = 1; 14 | end 15 | % Otherwise, choose first value greater than 10^-4 for mixed layer depth 16 | mld = D(1); % Note mld is an index, not a depth. 17 | -------------------------------------------------------------------------------- /pwp/pwp_PrepareData.m: -------------------------------------------------------------------------------- 1 | %pwp_PrepareData Prepare Data for PWP Run 2 | -------------------------------------------------------------------------------- /pwp/pwp_ReadOutput.m: -------------------------------------------------------------------------------- 1 | %pwp_ReadOutput Routine to read output of Matlab version of PWP 2 | % 3 | % 4 | % Open Binary Files 5 | fidu = fopen([runname '_u'],'r','b'); 6 | fidv = fopen([runname '_v'],'r','b'); 7 | fidt = fopen([runname '_t'],'r','b'); 8 | fids = fopen([runname '_s'],'r','b'); 9 | 10 | % Load Data 11 | V = fread(fidv,[nz,inf],'float32'); 12 | U = fread(fidu,[nz,inf],'float32'); 13 | temp = fread(fidt,[nz,inf],'float32'); 14 | sal = fread(fids,[nz,inf],'float32'); 15 | 16 | % Close them all 17 | fclose('all'); 18 | 19 | % Select right time 20 | time = time(tstart:tstop); 21 | 22 | % Write MAT File 23 | %save([runname '_Output'],'U','V','time','z','temp','sal'); 24 | save([runname '_Output']);%,'U','V','time','z','temp','sal'); 25 | -------------------------------------------------------------------------------- /pwp/pwp_Stir.m: -------------------------------------------------------------------------------- 1 | function [Tout] = pwp_Stir(rmin,T,j) 2 | %pwp_Stir 'Stirs' (mixes) an input variable 3 | % [Out]=pwp_Stir(rmin,In,j) 4 | % used for turbulent mixing of T,S, and UV in pwp_GradRichardson.m 5 | % The algorithm used in this function follows directly from the PWP paper 6 | % Inputs: 7 | % j = indices of critical cells 8 | % In = variable to stir 9 | % rmin = 0.2 10 | 11 | Rg_prime = .3; % should be 0.3 as per the PWP paper 12 | Rfac = 1 - rmin./Rg_prime; 13 | Tout = T; 14 | Tout(j) = T(j) + Rfac.*(T(j+1) - T(j))./2; 15 | Tout(j+1) = T(j+1) - Rfac.*(T(j+1) - T(j))./2; 16 | -------------------------------------------------------------------------------- /pwp/pwp_example.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/pwp/pwp_example.mat -------------------------------------------------------------------------------- /pwp/znorth_sub.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/pwp/znorth_sub.mat -------------------------------------------------------------------------------- /qv/ch.m: -------------------------------------------------------------------------------- 1 | function out=ch(in) 2 | % function out=ch(in) converts the raw integer UINT8 signal from 3 | % chameleon into (DOUBLE) voltage (-4.5 V to +4.5 V) 4 | 5 | out=((double(in(:,1))+256*double(in(:,2)))/32768-1)*4.5; -------------------------------------------------------------------------------- /qv/interp8.m: -------------------------------------------------------------------------------- 1 | function out=interp8(in,num) 2 | % function out=interp8(in,num) interpolates the vector in using a linear 3 | % interpolation to produce an output vector which is num times as long. 4 | % jnas 5 | [m,n]=size(in); 6 | if m==1 7 | out=zeros(m,n*num); 8 | maxnum=n*num; 9 | maxn=n; 10 | elseif n==1 11 | out=zeros(m*num,n); 12 | maxnum=m*num; 13 | maxn=m; 14 | else 15 | sprintf('Need a vector input, not a matrix'); 16 | return 17 | end 18 | out(1:num:(maxnum-num+1))=in; 19 | for i=1:num 20 | out(1+i:num:(maxnum-2*num+1+i))= ... 21 | ((num-i)*in(1:(maxn-1))+i*in(2:(maxn)))/num; 22 | out(maxnum+1-i)=in(maxn); 23 | end 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /qv/ma.m: -------------------------------------------------------------------------------- 1 | function out=ma(in) 2 | % function out=ma(in) converts the raw integer UINT8 signal from 3 | % Marlin into (DOUBLE) voltage (-5 V to +5 V) 4 | 5 | out=((double(in(:,1))+256*double(in(:,2)))/32768-1)*5; -------------------------------------------------------------------------------- /qv/qv.m: -------------------------------------------------------------------------------- 1 | % qv - plot Marlin or Chameleon data in a fashion similar to 2 | % Chamview. 3 | 4 | % $Date: 2008/01/31 20:22:47 $ $Revision: 1.1.1.1 $ $Author: aperlin $ 5 | % Originally J. Nash 1998,2002 6 | 7 | clear all 8 | close all 9 | qv_load 10 | qv_disp 11 | qv_now 12 | qv_zoom on 13 | -------------------------------------------------------------------------------- /qv/qv_calp.m: -------------------------------------------------------------------------------- 1 | function out=qv_calp(in,coeff) 2 | % function OUT=qv_calp(IN,COEFF) 3 | % This function does a polynomial calibration on the 4 | % vector IN with polynomial coefficients given by the 5 | % vector COEFF. 6 | if size(in,2)==2 7 | in=ch(in); 8 | end 9 | out=coeff(1)+coeff(2)*in+coeff(3)*in.^2+coeff(4)*in.^3; 10 | -------------------------------------------------------------------------------- /qv/qv_cals1.m: -------------------------------------------------------------------------------- 1 | function out=qv_cals1(s1,coeff_s1,fspd) 2 | % function out=qv_cals1(s1,coeff_s1,fspd) 3 | % Adapted from banal's cal.f 4 | % This calibrates raw voltages from shear module 5 | % to du/dz [1/sec]. 6 | % 7 | % The formula used is: 8 | % 9 | % du/dz=Ed/(2*sqrt(2)*Gs*Ts*Ss*Rho*FS^2) 10 | % 11 | % Ed ---------- the A/D AC module voltage output. 12 | % Gs ---------- the AC module gain. 13 | % Ts ---------- the AC module time constant. 14 | % Ss ---------- the probe sensitivity in volts/dyne/cm^2. 15 | % Rho --------- the average seawater density in gr/cm^3. 16 | % FS ----------- the average fall speed in cm/s. 17 | 18 | % set up the parameters: 19 | fsmin=5.0; 20 | rho=1.024; 21 | gs=1.0; 22 | ts=.25; 23 | gdc=coeff_s1(5); 24 | if ~gdc 25 | gdc=1; 26 | end 27 | ss=coeff_s1(1); 28 | const=gdc*2.*sqrt(2.0)*gs*ts*ss*rho; 29 | fspd=makelen(fspd,length(s1)); 30 | warning off 31 | out=s1./(const*fspd.^2); 32 | warning on 33 | out(find(fspd0 7 | in(lag+1:lin,:)=in(1:lin-lag,:); 8 | for j=1:lag 9 | in(j,:)=in(1,:); 10 | end 11 | elseif lag<0 12 | in(1:lin+lag,:)=in(-lag+1:lin,:); 13 | for j=lag+1:0 14 | in(lin+j,:)=in(lin,:); 15 | end 16 | end -------------------------------------------------------------------------------- /qv/qv_new.m: -------------------------------------------------------------------------------- 1 | if q.nser > head.num_sensors 2 | for i=head.num_sensors+1:q.nser 3 | delete(h.update(i),h.select(i)); 4 | end 5 | q.display_series=q.display_series(find(q.display_series<=head.num_sensors)); 6 | if isempty(q.display_series) 7 | q.display_series=2; 8 | h.selected(2)=qv_sel(h.select(2),h.selected(2),h.update(2)); 9 | end 10 | q.nplots=length(q.display_series); 11 | h.update=h.update(1:head.num_sensors); 12 | h.selected=h.selected(1:head.num_sensors); 13 | h.select=h.select(1:head.num_sensors); 14 | end 15 | q.last_display_series=q.display_series; 16 | clear head data irep; 17 | qv_load 18 | qv_now 19 | -------------------------------------------------------------------------------- /qv/qv_save.m: -------------------------------------------------------------------------------- 1 | 2 | q.mini=max(find(cal.p(max(cal.p)-q.bot))); 7 | if q.maxi '); 4 | pf=input('enter end profile --> '); 5 | 6 | iprof=[ps:pf]; 7 | 8 | id_m=[]; 9 | id_s=[]; 10 | for ip=iprof 11 | id_m=[id_m find(floor(marlin.ptime)==ip)]; 12 | id_s=[id_s find(floor(sbd.ptime)==ip)]; 13 | end 14 | 15 | id_mrln=find(marlin.ptime>ps & marlin.ptimeps & sbd.ptime '); 4 | pf=input('enter end profile --> '); 5 | 6 | plot(marlin.ptime,1.82*(marlin.t1-mean(marlin.t1(isnan(marlin.t1)==0))), ... 7 | sbd.ptime,sbd.temp-mean(sbd.temp),'r');grid 8 | 9 | axis([ps pf -1 3]) 10 | -------------------------------------------------------------------------------- /seawater/README: -------------------------------------------------------------------------------- 1 | % README file $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:51 $ 2 | % 3 | % SEAWATER is a toolkit of MATLAB routines for calculating the 4 | % properties of sea water. They are a self contained library and 5 | % are extremely easy to use. 6 | % 7 | % See the file sw_info.m for info on installation and usage 8 | 9 | -------------------------------------------------------------------------------- /seawater/sw_airden.m: -------------------------------------------------------------------------------- 1 | function [h] = airden(airtmp,press,relhum) 2 | %C 3 | %C [h] = airden(airtmp,press,relhum) 4 | %C 5 | %C This function calculates air density as function of air temperature, 6 | %C pressure and humidity. Based on A. Gill's book Atmosphere-Ocean 7 | %C Dynamics p 41. 8 | %C 9 | %C AIRDEN ------------ Air density (kg/m^3) 10 | %C AIRTMP ------------ Air temperature (C) 11 | %C PRESS ------------- Barometric pressure (mb) 12 | %C P ----------------- Barometric pressure in Pascal (1 mb=100 Pa) 13 | %C RELHUM ------------ Relative humidity defined as W/Ws*100, where W is 14 | %C the mixing ratio and Ws the saturation mixing ratio 15 | %C R ----------------- Gas constant for dry air (287.04 J/kg/K) 16 | %C VIRTMP ------------ Virtual temperature (C) 17 | %C 18 | 19 | rgas=287.04; 20 | p=press*100.0; 21 | h=p./(rgas.*(273.15+sw_virtmp(airtmp,press,relhum))); 22 | -------------------------------------------------------------------------------- /seawater/sw_alphap.m: -------------------------------------------------------------------------------- 1 | function [r] = alphap(s,t,p) 2 | %C 3 | %C CALCULATES THE THERMAL EXPANSION COEFFICIENT 4 | %C -(D(RHO)/DT)/(RHO) 5 | %C 6 | %C S: SALINITY (PSU) 7 | %C T: TEMPERATURE (C) 8 | %C P: PRESSURE (DBARS) 9 | %C ALPHAP: THERMAL EXPANSION COEFFICIENT (1/C) 10 | %C 11 | %C USES SIG(S,T,P) AND RHO(S,T,P) 12 | %C 13 | %C DAVE HEBERT 02/01/86 14 | %C MODIFIED FOR PC 06/28/88 15 | %C 16 | dt=1E-2; 17 | r=-(sw_dens(s,t+dt,p)-sw_dens(s,t-dt,p))./dt./sw_dens(s,t,p)./2.00; 18 | -------------------------------------------------------------------------------- /seawater/sw_betap.m: -------------------------------------------------------------------------------- 1 | function [ss] = betap(s,t,p) 2 | %C 3 | %C CALCULATES THE HALINE CONTRACTION COEFFICIENT 4 | %C (D(RHO)/DS)/(RHO) 5 | %C 6 | %C S: SALINITY (PSU) 7 | %C T: TEMPERATURE (C) 8 | %C P: PRESSURE (DBARS) 9 | %C BETAP: HALINE CONTRACTION COEFFICIENT (1/PSU) 10 | %C 11 | %C USES SIG(S,T,P) AND RHO(S,T,P) 12 | %C 13 | %C DAVE HEBERT 02/01/86 14 | %C MODIFIED FOR PC 06/28/88 15 | 16 | ds=1E-2; 17 | ss=(sw_dens(s+ds,t,p)-sw_dens(s-ds,t,p))./ds./sw_dens(s,t,p)./2.0; 18 | -------------------------------------------------------------------------------- /seawater/sw_cpair.m: -------------------------------------------------------------------------------- 1 | function [j] = sw_cpair(airtmp,press,relhum) 2 | %C 3 | %C This function calculates the specific heat of moist air at constant 4 | %C pressure as function of air temperature, pressure and humidity. 5 | %C Based on A. Gill's book Atmosphere-Ocean Dynamics p 43. 6 | %C 7 | %C CPair ------------- Specific heat at constant pressure for moist 8 | %C air (J/kg/K) 9 | %C SPCHUM ------------ Specific humidity (the mass of vapour per unit 10 | %C mass of moist air 11 | %C AIRTMP ------------ Air temperature (C) 12 | %C PRESS ------------- Barometric pressure (mb) 13 | %C RELHUM ------------ Relative humidity defined as 100%*W/Ws, where W is 14 | %C the mixing ratio and Ws the saturation mixing ratio 15 | %C 16 | j=1004.64.*(1.0+0.83748.*sw_spchum(airtmp,press,relhum)); 17 | 18 | -------------------------------------------------------------------------------- /seawater/sw_data.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OceanMixingGroup/mixingsoftware/2d9f2576221d582bb81caa9d2358f9d889540c6c/seawater/sw_data.mat -------------------------------------------------------------------------------- /seawater/sw_drag.m: -------------------------------------------------------------------------------- 1 | function [out] = sw_drag(uz) 2 | %C 3 | %C DRAG=sw_drag(uz) 4 | %C This function calculates the aerodynamic drag coefficient over the 5 | %C sea surface. The formulae are based on W.G.Large and S.Pond JPO Vol. 11, 6 | %C No. 3, (March 1981) pp.324-336 7 | %C 8 | %C DRAG ---------- The drag coefficient 9 | %C UZ ----------- The wind speed at 10 m height above the sea surface (m/s) 10 | %C 11 | %C uz is the wind speed at 10m above the sea surface 12 | out=0.0012*ones(size(uz)); 13 | out(uz>=11)=0.00049+0.000065*uz(uz>=11); 14 | % for iii=1:length(uz); 15 | % if (uz(iii) < 11.0) 16 | % i(iii)=0.0012; 17 | % else 18 | % i(iii)=0.00049+0.000065*uz(iii); 19 | % end; 20 | % end; 21 | 22 | -------------------------------------------------------------------------------- /seawater/sw_rlatfl.m: -------------------------------------------------------------------------------- 1 | function [m] = sw_rlatfl(airtmp,press,relhum,sfctmp,u10) 2 | %C 3 | %C This function calculates the upward latent heat flux at the sea surface. 4 | %C It uses the evaporation rate calculated by function EVAPOR 5 | %C 6 | %C RLATFL --------- Upward flux of latent heat (W/m^2) 7 | %C EVAPOR --------- Evaporation rate (kg/m^2/sec) 8 | %C L -------------- Latent heat of vaporization as function of temperature 9 | %C (see Gill p 607) (J/kg) 10 | %C PRESS ---------- Barometric pressure (mb) 11 | %C RELHUM --------- Relative humidity defined as W/Ws*100, where W is 12 | %C the mixing ratio and Ws the saturation mixing ratio 13 | %C SFCTMP --------- Sea surface temperature (C) 14 | %C AIRTMP --------- The air temperature at 10 m (C) 15 | %C U10 ------------ Wind speed at 10 m above sea level (m/sec) 16 | %C 17 | 18 | ll=2.5008E6-2.3E3.*sfctmp; 19 | m=ll.*sw_evapor(airtmp,press,relhum,sfctmp,u10); 20 | 21 | -------------------------------------------------------------------------------- /seawater/sw_rmixrt.m: -------------------------------------------------------------------------------- 1 | function [b] = rmixrt(airtmp,press,relhum) 2 | %C 3 | %C This function calculates the mixing ratio as function of air 4 | %C temperature, pressure and humidity. Based on A. Gill's book 5 | %C Atmosphere-Ocean Dynamics p 605. 6 | %C 7 | %C RMIXRT ------------ The mixing ratio (the ratio of the mass of vapour 8 | %C to the mass of dry air) 9 | %C AIRTMP ------------ Air temperature (C) 10 | %C PRESS ------------- Barometric pressure (mb) 11 | %C RELHUM ------------ Relative humidity defined as 100%*W/Ws, where W is 12 | %C the mixing ratio and Ws the saturation mixing ratio 13 | %C SATMIX ----------- Saturation mixing ratio 14 | %C 15 | b=sw_satmix(airtmp,press).*relhum./100.0; 16 | -------------------------------------------------------------------------------- /seawater/sw_sathum.m: -------------------------------------------------------------------------------- 1 | function [f] = sw_sathum(airtmp,press) 2 | %C 3 | %C This function calculates the saturation specific humidity . 4 | %C The formula is from A. Gill's book Atmosphere-Ocean Dynamics pp. 605-606 5 | %C 6 | %C 7 | %C SATPRS ----------- Saturation vapour pressure in mb 8 | %C SATHUM ----------- Saturation specific humidity 9 | %C AIRTMP ----------- Air temperature (C) 10 | %C PRESS ------------ Air pressure (mb) 11 | %C 12 | 13 | es=sw_satprs(airtmp,press); 14 | f=0.62197./(press./es-0.37803); 15 | -------------------------------------------------------------------------------- /seawater/sw_satmix.m: -------------------------------------------------------------------------------- 1 | function [e] = satmix(airtmp,press) 2 | %C 3 | %C This function calculates the saturation mixing ratio . 4 | %C The formula is from A. Gill's book Atmosphere-Ocean Dynamics pp. 605-606 5 | %C 6 | %C 7 | %C SATPRS ----------- Saturation vapour pressure in mb 8 | %C SATMIX ----------- Saturation mixing ratio 9 | %C AIRTMP ----------- Air temperature (C) 10 | %C PRESS ------------ Air pressure (mb) 11 | %C 12 | 13 | es=sw_satprs(airtmp,press); 14 | e=0.62197.*es./(press-es); 15 | -------------------------------------------------------------------------------- /seawater/sw_satprs.m: -------------------------------------------------------------------------------- 1 | function [d] = satprs(airtmp,press) 2 | %C 3 | %C This function calculates the saturation vapour pressure in mb. 4 | %C The formula is from A. Gill's book Atmosphere-Ocean Dynamics, p 606, 5 | %C and is correct to 1 part in 500 for temperatures between -40 to 6 | %C +40 degrees Celsius 7 | %C 8 | %C 9 | %C SATPRS ----------- Saturation vapour pressure in mb 10 | %C AIRTMP ----------- Air temperature (C) 11 | %c PRESS ------------ Air pressure (mb) 12 | %C Fw --------------- Correction factor for the saturation vapour 13 | %C pressure in air (Fw lies between 1 and 1.006 14 | %C for observed atmospheric conditions) 15 | 16 | d=10.0.^((0.7859+0.03477.*airtmp)./(1.0+0.00412.*airtmp)); 17 | fw=1.0+1.0E-6*press.*(4.5+0.0006.*airtmp.^2.0); 18 | d=fw.*d; 19 | -------------------------------------------------------------------------------- /seawater/sw_sdif.m: -------------------------------------------------------------------------------- 1 | function sdif=sw_sdif(t) 2 | 3 | % function sdif=sdif(t) is the fickian diffusivity of salt in seawater. 4 | % From properties of sea water... 'Numerical data and functional 5 | % relationships in Science and Technology' 6 | % - Oceanography v.3. pg 257 -- from Caldwall 1973 and 1974 7 | % 8 | 9 | sdif=1e-11*(62.5+3.63*t); 10 | 11 | -------------------------------------------------------------------------------- /seawater/sw_spchum.m: -------------------------------------------------------------------------------- 1 | function [a] = spchum(airtmp,press,relhum) 2 | 3 | % This function calculates the specific humidity as function of air 4 | % temperature, pressure and humidity. Based on A. Gill's book 5 | % Atmosphere-Ocean Dynamics p 605. 6 | % 7 | % SPCHUM ------------ Specific humidity (the mass of vapour per unit 8 | % mass of moist air 9 | % RMIXRT ------------ The mixing ratio 10 | % AIRTMP ------------ Air temperature (C) 11 | % PRESS ------------- Barometric pressure (mb) 12 | % RELHUM ------------ Relative humidity defined as 100%*W/Ws, where W is 13 | % the mixing ratio and Ws the saturation mixing ratio 14 | % 15 | w=sw_rmixrt(airtmp,press,relhum); 16 | a=w./(1.0+w); 17 | -------------------------------------------------------------------------------- /seawater/sw_tcond.m: -------------------------------------------------------------------------------- 1 | function tcond=sw_tcond(s,t,p) 2 | % function tcond=sw_tcond(s,t,p) gives the thermal conductivity 3 | % 4 | % based on caldwell dsr 21:131-137 (1974) eqn. 6,7,8 5 | % 6 | % s salinity 7 | % t temperature (deg. c) 8 | % p pressure (dbars) 9 | % 10 | % tcond thermal conductivity (j m-1 k-1 s-1) 11 | % 12 | % tcond(40.,40.,1000.)=0.6623783057965 13 | % 14 | % dave hebert 11/04/86 15 | % 16 | ak0=0.565403020+t*(1.6999346e-3-t*5.910632e-6); 17 | f=0.0690-8e-5*t-2.0e-7*p-1.0e-4*s; 18 | tcond=ak0*(1+f); 19 | -------------------------------------------------------------------------------- /seawater/sw_tdif.m: -------------------------------------------------------------------------------- 1 | function tdif=sw_tdif(s,t,p) 2 | % function tdif=tdif(s,t,p) 3 | % temperature diffusivity (m2 s-1) 4 | % 5 | % uses functions sw_cp, sw_dens, sw_tcond 6 | % 7 | % dave hebert 15/04/86 8 | tdif=sw_tcond(s,t,p)/sw_cp(s,t,p)/sw_dens(s,t,p); 9 | -------------------------------------------------------------------------------- /seawater/sw_u10.m: -------------------------------------------------------------------------------- 1 | function [p] = sw_u10(uz,zz) 2 | %C 3 | %C U10=sw_u10(uz,zz) 4 | %C This function calculates the wind speed at 10m height given the wind speed 5 | %C at height z. This function is based on W.G.Large and S.Pond JPO Vol. 11, 6 | %C No. 3, (March 1981) pp.324-336 formula 16. Note that neutral stability is 7 | %C assumed. 8 | %C 9 | %C U10 ----------- The wind speed at 10 m height above the sea surface (m/s). 10 | %C UZ ----------- The wind speed at Z m above the sea surface (m/s). 11 | %C ZZ ---------- The height (m) at which the wind speed was measured. 12 | %C Cd ----------- The drag coefficient calculated using function DRAG. 13 | %C 14 | 15 | kappa=0.4; 16 | p=uz./(1+((sqrt(sw_drag(uz)))./kappa)*(log(zz/10.0))); 17 | -------------------------------------------------------------------------------- /seawater/sw_vapprs.m: -------------------------------------------------------------------------------- 1 | function [c] = vapprs(airtmp,press,relhum) 2 | %C 3 | %C This function calculates water vapour pressure as function of air 4 | %C temperature, pressure and humidity. Based on A. Gill's book 5 | %C Atmosphere-Ocean Dynamics p 605. 6 | %C 7 | %C AIRTMP ------------ Air temperature (C) 8 | %C PRESS ------------- Barometric pressure (mb) 9 | %C RELHUM ------------ Relative humidity defined as 100%*W/Ws, where W is 10 | %C the mixing ratio and Ws the saturation mixing ratio 11 | %C VAPPRS ------------ Water vapour pressure in moist air (mb) 12 | %C RMIXRT ------------ The mixing ratio 13 | %C 14 | w=sw_rmixrt(airtmp,press,relhum); 15 | c=press.*w./(w+0.62197); 16 | -------------------------------------------------------------------------------- /seawater/sw_ver.m: -------------------------------------------------------------------------------- 1 | % SW_VER Version number of SEAWATER library 2 | %========================================================================= 3 | % SW_VER $Id: sw_ver.m,v 1.1.1.1 2008/01/31 20:22:52 aperlin Exp $ 4 | % Copyright (C) CSIRO, Phil Morgan 1994 5 | % 6 | % sw_ver 7 | % 8 | % DESCRIPTION: 9 | % Returns version number of the SEAWATER library 10 | % 11 | % AUTHOR: Phil Morgan, Lindsay Pender (Lindsay.Pender@csiro.au) 12 | % 13 | % DISCLAIMER: 14 | % This software is provided "as is" without warranty of any kind. 15 | % See the file sw_copy.m for conditions of use and licence. 16 | % 17 | %========================================================================= 18 | disp('SEAWATER Version 3.2') 19 | 20 | -------------------------------------------------------------------------------- /seawater/sw_virtmp.m: -------------------------------------------------------------------------------- 1 | function [g] = virtmp(airtmp,press,relhum) 2 | %C 3 | %C This function calculates the virtual temperature as function of air 4 | %C temperature, pressure and humidity. Based on A. Gill's book 5 | %C Atmosphere-Ocean Dynamics pp 39-41. 6 | %C 7 | %C VIRTMP ------------ Virtual temperature (C) 8 | %C AIRTMP ------------ Air temperature (C) 9 | %C PRESS ------------- Barometric pressure (mb) 10 | %C RELHUM ------------ Relative humidity defined as W/Ws*100, where W is 11 | %C the mixing ratio and Ws the saturation mixing ratio 12 | %C SPCHUM ------------ Specific humidity 13 | %C 14 | 15 | g=(airtmp+273.15).*(1.0+0.6078*sw_spchum(airtmp,press,relhum)); 16 | g=g-273.15; 17 | -------------------------------------------------------------------------------- /seawater/sw_visc.m: -------------------------------------------------------------------------------- 1 | function visc=sw_visc(s,t,p) 2 | % function visc=SW_VISC(S,T,P) 3 | % 4 | % kinematic viscosity (nu) (no pressure dependence examined) 5 | % 6 | % based on dan kelley's fit to knauss's table ii-8 7 | % 8 | % s salinity (ppt) 9 | % t temperature (deg. c) 10 | % p pressure (dbars) 11 | % 12 | % visc kinematic viscosity (m**2 s-1) 13 | % 14 | % visc(40.,40.,1000.)=8.200167608e-7 15 | % 16 | % dave hebert 11/04/86 17 | % 18 | % renamed sw_visc and added to seawater routines 9/9/98 19 | 20 | visc=1e-4*(17.91-0.5381*t+0.00694*t.*t+0.02305*s)./sw_dens(s,t,p); 21 | -------------------------------------------------------------------------------- /seawater/sw_wetbulbtemp.m: -------------------------------------------------------------------------------- 1 | function tw=wetbulb(ta,rh) 2 | % a function to calculate wet bulb temperature 3 | % based on measured air temperature ta [degrees C] 4 | % and relative humidity rh [%] 5 | % Jensen et al. (1990), ASCE Manual No. 70 (see pages 176 & 177) 6 | % see also http://www.faqs.org/faqs/meteorology/temp-dewpoint/ 7 | 8 | % calculate saturated vapor pressure es and actual vapor pressure e [kPa] 9 | % es=0.611*exp(17.27*ta./(ta+237.3)); 10 | check=0; 11 | if size(ta,1)>1; ta=ta'; check=1; end 12 | if size(rh,1)>1; rh=rh'; end 13 | 14 | es=sw_satprs(ta,1000)/10; 15 | e=rh/100.*es; 16 | 17 | % compute dewpoint temperature td [degrees C] 18 | td=(116.9+237.3*log(e))./(16.78-log(e)); 19 | 20 | % compute wet bulb temperature tw [degrees C] 21 | P=100; % [kPa] ambient barometric pressure 22 | gamma=0.00066*P; 23 | delta=4098*e./(td+237.3).^2; 24 | tw=(gamma.*ta+delta.*td)./(gamma+delta); 25 | if check==1; tw=tw';end -------------------------------------------------------------------------------- /sensorconfig/Contents.m: -------------------------------------------------------------------------------- 1 | % SensorConfig 2 | % Routines for turning Excell spreadseets into MarlCham Instrument and 3 | % EPROM files. 4 | % 5 | % sc_make_eprom_ins.m 6 | % % function make_eprom_ins(fname); 7 | % % Translate a special xls file into an ins and a eprom file. 8 | % sc_readexcel.m 9 | % % function B=sc_readexcel(fname,SheetName); 10 | % % Open the spreadsheet in fname and read the data from SheetName. 11 | -------------------------------------------------------------------------------- /sensorconfig/sc_readexcel.m: -------------------------------------------------------------------------------- 1 | function B=sc_readexcel(fname,SheetName); 2 | % function B=sc_readexcel(fname,SheetName); 3 | % Open the spreadsheet in fname and read teh data from SheetName. 4 | 5 | % $Revision: 1.1.1.1 $ $Date: 2008/01/31 20:22:52 $ $Author: aperlin $ 6 | % J. Klymak, Aug 2002 7 | 8 | 9 | % First open an Excel Server 10 | Excel = actxserver('Excel.Application'); 11 | set(Excel, 'Visible', 0); 12 | 13 | % Open the workbook 14 | Workbooks = get(Excel,'Workbooks'); 15 | Workbook = Open(Workbooks,fname); 16 | Sheets = Excel.ActiveWorkBook.Sheets; 17 | for i=1:get(Sheets,'Count'); 18 | % Make the second sheet active 19 | sheet = get(Sheets, 'Item', i); 20 | get(sheet,'Name'); 21 | if strcmp(get(sheet,'Name'),SheetName) 22 | % Get back a range. It will be a cell array, since the cell range can 23 | % contain different types of data. 24 | Range = get(sheet, 'UsedRange'); 25 | B = Range.value; 26 | break 27 | end; 28 | end; 29 | 30 | % Quit Excel 31 | invoke(Excel, 'Quit'); 32 | 33 | -------------------------------------------------------------------------------- /smith_sandwell/GetSSbathy.m: -------------------------------------------------------------------------------- 1 | function SS=GetSSbathy(lonrange,latrange) 2 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 | % 4 | % SS=GetSSbathy(lonrange,latrange) 5 | % 6 | % Get Smith/Sandwell bathymmetry for a specified region. 7 | % 8 | % INPUT 9 | % - lonrange [minlon maxlon] 10 | % - latrange [minlat maxlat] 11 | % 12 | % OUTPUT 13 | % 14 | % SS : Structure with bathymetry data 15 | % - depth [m]- matrix of depths (lat X lon) 16 | % - lat - Vector of lats 17 | % - lon - Vector of lons 18 | % 19 | % Calls: 20 | % - extract_1m.m 21 | % 22 | %------------- 23 | % 07/21/12 A.Pickering - andypicke@gmail.com 24 | %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 | %% 26 | 27 | %addpath('/Users/Andy/Cruises_Research/Data/SmithSandwell/') 28 | 29 | [bathy,vlat,vlon] = extract_1m([latrange lonrange],1); 30 | 31 | SS=struct('depth',bathy,'lat',vlat,'lon',vlon); 32 | SS.info=['Made ' date ]; 33 | SS.source='SmithSandwell'; 34 | SS.MakeInfo=['Made ' date ' w/ GetSSbathy.m']; 35 | 36 | %% -------------------------------------------------------------------------------- /smith_sandwell/README.MD: -------------------------------------------------------------------------------- 1 | 2 | # smith_sandwell 3 | 4 | ## This folder contains scripts to extract depths from Smith-Sandwell data for a give range of latitudes and longitudes. 5 | 6 | ## The actual data file is quite large, so i'm currently trying to figure out where/how to store it.. 7 | 8 | ### 9 | -------------------------------------------------------------------------------- /tao/combine_tao_data.m: -------------------------------------------------------------------------------- 1 | function combine_tao_data(datadir,moor) 2 | % combine_tao_data.m 3 | % combines all processed tao data for the particular mooring 4 | % datadir is location of the processed *.mat files 5 | % and moor is the mooring position, e.g moor='0n110w'; 6 | 7 | d=dir([datadir '*' moor '*.mat']); 8 | for i=1:length(d) 9 | load([datadir d(i).name]); 10 | end 11 | if exist('adcp','var'); tao.adcp=adcp; end 12 | if exist('bp','var'); tao.bp=bp; end 13 | if exist('cur','var'); tao.cur=cur; end 14 | if exist('sigma','var'); tao.sigma=sigma; end 15 | if exist('met','var'); tao.met=met; end 16 | if exist('rain','var'); tao.rain=rain; end 17 | if exist('sal','var'); tao.sal=sal; end 18 | if exist('t','var'); tao.t=t; end 19 | if exist('rad','var'); tao.rad=rad; end 20 | if exist('lw','var'); tao.lw=lw; end 21 | save([datadir '\tao' moor],'tao') 22 | -------------------------------------------------------------------------------- /tao/process_tao_data.m: -------------------------------------------------------------------------------- 1 | function process_tao_data(datadir,var) 2 | % process_tao_data.m 3 | % var is variable name 4 | % could be either 'adcp','bp','cur','d','met','rad', 5 | % 'rain','lw','s' or 't' 6 | % 'met' data includes wind, airt, sst & rel. humidity data 7 | % so it is not necessary to download these files separately from TAO web 8 | % site 9 | 10 | d=dir([datadir var '*.ascii']); 11 | for i=1:length(d) 12 | eval(['read_tao_' var '([datadir d(i).name]);']); 13 | eval(['make_one_array_' var '([datadir d(i).name(1:end-6) ''.mat'']);']); 14 | end 15 | -------------------------------------------------------------------------------- /tpod/tpod_checkout.m: -------------------------------------------------------------------------------- 1 | %script to view tpod raw data ...Pavan Vutukur 05/18/2018 2 | [data] = raw_load_tpod() 3 | figure(1) 4 | subplot(2,1,1) 5 | plot(data.time,data.T1,'red') 6 | hold on 7 | plot(data.time,data.T2,'green') 8 | legend('T1','T2') 9 | ylabel('Volts') 10 | title('TPOD T1 and T2 signals'); 11 | xlim([data.time(1) data.time(end)]); 12 | datetick('x','KeepLimits'); 13 | 14 | subplot(2,1,2) 15 | plot(data.time,data.T3,'k') 16 | hold on 17 | plot(data.time,data.T4,'blue') 18 | legend('T3','T4') 19 | ylabel('Volts') 20 | title('TPOD T3 and T4 signals'); 21 | xlim([data.time(1) data.time(end)]); 22 | datetick('x','KeepLimits'); -------------------------------------------------------------------------------- /wtc/Readme.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Cross wavelet and wavelet coherence package (pre-release 1) 4 | by Aslak Grinsted, John Moore and Svetlana Jevrejeva 5 | ---------------------------------------------------- 6 | 7 | Please notice that most of the routines included in this package has the following license. 8 | 9 | This software may be used, copied, or redistributed as long as it is not sold and this copyright notice is reproduced on each copy made. This routine is provided as is without any express or implied warranties whatsoever. 10 | 11 | However, not all the routines are published under these terms, and before redistributing them in any form we advise you to ask permission from the authors. 12 | 13 | Acknowledgements 14 | We would like to thank the following people for letting us include their programs in our package. 15 | 16 | Torrence and Compo for CWT software. A Practical Guide to Wavelet Analysis 17 | Eric Breitenberger for AR1 and AR1Noise. 18 | Eric A. Johnson for Arrow.m. 19 | Blair Greenan for Colorbarf.m 20 | 21 | 22 | -------------------------------------------------------------------------------- /wtc/ar1noise.m: -------------------------------------------------------------------------------- 1 | function X=ar1noise(n,c,g,a) 2 | % AR1NOISE - Generate zero-mean red noise. 3 | % Syntax: X=ar1noise(n,c,g,a); 4 | % 5 | % Inputs: n - desired length of time series 6 | % c - number of time series to generate 7 | % g - lag-1 autocorrelation 8 | % a - noise innovation variance parameter 9 | % 10 | % Output: X - n by c matrix of red noise series. 11 | % 12 | % Written by Eric Breitenberger. Version 1/21/96 13 | % Please send comments and suggestions to eric@gi.alaska.edu 14 | % 15 | 16 | % Comment out this line if you want the 17 | % same 'random' realization each time: 18 | randn('state',fix(sum(100*clock*(randn+4)))); 19 | 20 | X=zeros(n,c); 21 | X(1,:)=sqrt(a^2/(1-g^2))*randn(1,c); 22 | z=a*randn(n,c); 23 | 24 | for i=2:n 25 | X(i,:)=g*X(i-1,:)+z(i,:); 26 | end 27 | 28 | % Center the surrogates: 29 | X=X-ones(n,1)*mean(X); 30 | 31 | -------------------------------------------------------------------------------- /wtc/ar1spectrum.m: -------------------------------------------------------------------------------- 1 | function P=ar1spectrum(ar1,period) 2 | % AR1 power spectrum... 3 | % 4 | % power=ar1spectrum(ar1,period) 5 | % 6 | % 7 | % (c) Aslak Grinsted 2002-2004 8 | % 9 | 10 | 11 | % ------------------------------------------------------------------------- 12 | % Copyright (C) 2002-2004, Aslak Grinsted 13 | % This software may be used, copied, or redistributed as long as it is not 14 | % sold and this copyright notice is reproduced on each copy made. This 15 | % routine is provided as is without any express or implied warranties 16 | % whatsoever. 17 | 18 | 19 | freq=1./period; 20 | P=(1-ar1.^2)./(abs(1-ar1.*exp(-2*pi*i*freq))).^2; %http://www.madsci.org/posts/archives/may97/864012045.Eg.r.html 21 | %fixed typo in numerical recipes -------------------------------------------------------------------------------- /wtc/boxpdf.m: -------------------------------------------------------------------------------- 1 | function [boxedX,Bx,By]=boxpdf(X) 2 | % Forces the pdf of data to have a boxed distribution using a data adaptive lookup table. 3 | % 4 | % [boxedX,Bx,By]=boxpdf(X) 5 | % 6 | % boxedX=N(X) where N is an data adaptive monotonically increasing function. 7 | % boxedX vary between zero and one. 8 | % 9 | % Bx,By describes the lookup table 10 | % 11 | % Aslak Grinsted 2002 12 | [sx i]=sort(X(:)); 13 | [n, m] = size(sx); 14 | minx = min(sx); 15 | maxx = max(sx); 16 | range = maxx-minx; 17 | 18 | 19 | % Use the same Y vector if all columns have the same count 20 | eprob = [0.5./n:1./n:(n - 0.5)./n]'; 21 | 22 | 23 | %group x's with same value 24 | I=[1; find(diff(sx)~=0)+1]; %unique indices 25 | Bx=sx(I); %unique values 26 | nI=diff([I;length(sx)+1])-1; 27 | By=zeros(length(Bx),1); 28 | for i=length(I):-1:1 29 | 30 | By(i,1)=mean(eprob(I(i)+(0:nI(i)))); 31 | end 32 | %plot(sx,y); 33 | 34 | 35 | 36 | boxedX=interp1q(Bx,By,X); -------------------------------------------------------------------------------- /wtc/chisquare_solve.m: -------------------------------------------------------------------------------- 1 | function PDIFF = chisquare_solve(XGUESS,P,V); 2 | %CHISQUARE_SOLVE Internal function used by CHISQUARE_INV 3 | % 4 | % PDIFF=chisquare_solve(XGUESS,P,V) Given XGUESS, a percentile P, 5 | % and degrees-of-freedom V, return the difference between 6 | % calculated percentile and P. 7 | 8 | % Uses GAMMAINC 9 | % 10 | % Written January 1998 by C. Torrence 11 | 12 | % extra factor of V is necessary because X is Normalized 13 | PGUESS = gammainc(V*XGUESS/2,V/2); % incomplete Gamma function 14 | 15 | PDIFF = abs(PGUESS - P); % error in calculated P 16 | 17 | TOL = 1E-4; 18 | if (PGUESS >= 1-TOL) % if P is very close to 1 (i.e. a bad guess) 19 | PDIFF = XGUESS; % then just assign some big number like XGUESS 20 | end 21 | -------------------------------------------------------------------------------- /wtc/gammest.m: -------------------------------------------------------------------------------- 1 | function gout=gammest(gin) 2 | % GAMMEST - used by AR1 to compute 3 | % a function for minimization by fzero. 4 | % CEE_ZERO, CEE_ONE, and NPOINTS are globals. 5 | % 6 | % Written by Eric Breitenberger. Version 1/21/96 7 | % Please send comments and suggestions to eric@gi.alaska.edu 8 | % 9 | 10 | global CEE_ZERO CEE_ONE NPOINTS 11 | 12 | N=NPOINTS; 13 | g0=CEE_ONE/CEE_ZERO; 14 | 15 | gk=1:N-1; 16 | gk=gin.^gk; 17 | mu2=(1/N)+(2/N^2)*sum((N-1:-1:1).*gk); 18 | gout=(1-g0)*mu2+g0-gin; 19 | 20 | %disp(['Iterating in gammest: dg=' num2str(gout)]) 21 | --------------------------------------------------------------------------------