├── cresis-toolbox ├── icards │ ├── create_vectors_icards.m │ ├── onesided_window.m │ ├── icards_get_available.m │ ├── fname_info_icards.m │ └── create_records_icards_dealwithNaN.m ├── rss │ ├── default_radar_params_2016_Greenland_TO.m │ ├── arena_packet_strip_mex.mexa64 │ ├── arena_packet_strip_mex.mexw64 │ ├── arena_packet_strip_tcp_mex.mexa64 │ ├── arena_convert_range.m │ ├── arena_radar_header_type.m │ └── arena_create_waveform.m ├── OPS-MATLAB │ ├── .gitignore │ ├── input │ │ └── README.md │ ├── output │ │ └── README.md │ ├── utility │ │ ├── README.md │ │ └── opsUpdateMaterializedView.m │ ├── conversion │ │ ├── README.md │ │ ├── jsonlab │ │ │ ├── README.txt │ │ │ ├── examples │ │ │ │ ├── example3.json │ │ │ │ ├── example1.json │ │ │ │ ├── example4.json │ │ │ │ ├── example2.json │ │ │ │ ├── jsonlab_speedtest.m │ │ │ │ └── jsonlab_selftest.m │ │ │ ├── mergestruct.m │ │ │ └── jsonopt.m │ │ ├── matlab-json │ │ │ ├── tojson.mexa64 │ │ │ ├── tojson.mexw32 │ │ │ ├── tojson.mexw64 │ │ │ ├── fromjson.mexa64 │ │ │ ├── fromjson.mexw32 │ │ │ ├── fromjson.mexw64 │ │ │ ├── setjsonfield.mexw32 │ │ │ └── setjsonfield.mexw64 │ │ └── jsonWrapper.m │ └── README.md ├── +imb │ ├── @picktool_browse │ │ ├── create_ui.m │ │ ├── left_click.m │ │ ├── left_click_and_drag.m │ │ └── right_click.m │ ├── @prefwin │ │ ├── close_win.m │ │ ├── systemsLB_callback.m │ │ ├── mapsPM_callback.m │ │ ├── flightlinesPM_callback.m │ │ ├── layerSourcePM_callback.m │ │ └── layers_callback_new.m │ ├── @ascopewin │ │ ├── close_win.m │ │ ├── ascopeLB_callback.m │ │ ├── button_down.m │ │ ├── button_motion.m │ │ ├── button_up.m │ │ └── memory.m │ ├── @echowin │ │ ├── toolparam_close_callback.m │ │ ├── toggle_imagewin_visibility.m │ │ ├── get_crossover.m │ │ ├── open_crossover.m │ │ ├── cmds_save.m │ │ ├── qualityPM_callback.m │ │ ├── display_modePM_callback.m │ │ ├── framesPM_callback.m │ │ ├── key_release.m │ │ ├── close_win.m │ │ ├── yaxisPM_callback.m │ │ ├── crossoverPB_callback.m │ │ ├── imagewin_fn_callback.m │ │ ├── frameCM_callback.m │ │ ├── plot_cursors.m │ │ ├── cmds_synchronize.m │ │ ├── status_text_copy_callback.m │ │ ├── layerLB_str.m │ │ ├── cmds_set_undo_stack_after_draw.m │ │ ├── button_down.m │ │ ├── xaxisPM_callback.m │ │ ├── sourceLB_callback.m │ │ ├── status_text_set.m │ │ └── savePB_callback.m │ ├── @mapwin │ │ ├── ascope_memory.m │ │ ├── prefPB_callback.m │ │ ├── gisPB_callback.m │ │ ├── flightCM_callback.m │ │ ├── open_crossover_echowin.m │ │ ├── key_release.m │ │ ├── get_google_map.m │ │ ├── check_limits.m │ │ └── update_vector_layers.m │ ├── @picktool │ │ ├── close_win.m │ │ ├── key_press.m │ │ └── create_ui.m │ ├── @picktool_quality │ │ ├── left_click.m │ │ └── create_ui.m │ ├── @picktool_copy │ │ └── left_click.m │ ├── @undo_stack │ │ ├── save.m │ │ ├── peak.m │ │ ├── pop.m │ │ ├── ismodified.m │ │ ├── redo.m │ │ ├── remove_document.m │ │ ├── attach_document.m │ │ ├── push.m │ │ ├── get_save_cmds.m │ │ └── get_synchronize_cmds.m │ ├── @crossover │ │ └── close_win.m │ ├── picker.m │ ├── get_proj_info.m │ ├── sort_clicks.m │ ├── @picktool_snake │ │ └── left_click.m │ ├── @picktool_interpolate │ │ ├── left_click.m │ │ └── interpolate.m │ └── @picktool_viterbi │ │ └── left_click.m ├── gui │ ├── @imagewin │ │ ├── proc.m │ │ ├── close_win.m │ │ └── save_mat_callback.m │ ├── get_parent_figure.m │ ├── delete_figures.m │ ├── table │ │ ├── table_resize.m │ │ ├── table_pos.m │ │ └── table_size.m │ ├── zoom_figure_setup.m │ ├── get_mouse_info.m │ ├── gui_zoom.m │ └── link_figures.m ├── +tomo │ ├── +c3d_rnn_models │ │ └── __init__.py │ ├── trws.mexa64 │ ├── trws.mexw64 │ ├── trws2.mexa64 │ ├── RJ_MCMC.mexa64 │ ├── RJ_MCMC.mexw64 │ ├── detect.mexa64 │ ├── detect.mexw64 │ ├── extract.mexa64 │ ├── extract.mexw64 │ ├── stereo.mexa64 │ ├── stereo.mexw64 │ ├── viterbi.mexa64 │ ├── viterbi.mexw64 │ ├── viterbi2.mexa64 │ ├── viterbi2.mexw64 │ ├── train_model.mexa64 │ ├── train_model.mexw64 │ ├── viterbi2.mexmaci64 │ ├── train_model.m │ ├── run_C3D_RNN_Python.sh │ ├── +parameter_tuning │ │ ├── +helper_functions │ │ │ ├── set_detect_data.m │ │ │ ├── compute_errors.m │ │ │ ├── create_folders.m │ │ │ └── compute_hit_ratios.m │ │ └── user_settings_trws_grid_3D.m │ ├── SImage.h │ └── run_plot_DEM.m ├── utility │ ├── fdep.m │ ├── finitemax.m │ ├── finitemin.m │ ├── ct_rmfield.m │ ├── json_mex │ │ ├── windows_precompiled_readme.txt │ │ ├── json-c-master.zip │ │ ├── matlab-json-master.zip │ │ └── windows_precompiled.zip │ ├── get_first10_sync.mexa64 │ ├── get_first10_sync.mexw64 │ ├── TriangleRayIntersection.m │ ├── data_gaps_check_mex.mexa64 │ ├── data_gaps_check_mex.mexw64 │ ├── get_first10_sync.mexmaci64 │ ├── data_gaps_check_mex.mexmaci64 │ ├── nanmax.m │ ├── nanmin.m │ ├── remove_variable_support.mexa64 │ ├── remove_variable_support.mexmaci64 │ ├── boxcar.m │ ├── lcm_vector.m │ ├── get_disk_space.m │ ├── hanning.m │ ├── robust_cmd.m │ ├── empty_struct_element.m │ ├── nansum.m │ ├── ct_sgolayfilt.m │ ├── robust_save.m │ ├── nanmean.m │ ├── chebwin.m │ ├── xcorr_noedge.m │ ├── tukeywin_trim.m │ ├── nanmedian.m │ ├── tukeywin_cont.m │ ├── remove_variable.m │ ├── nanstd.m │ ├── robust_rmdir.m │ ├── get_filename.m │ ├── interp1_robust.m │ ├── gen_randn_wave.m │ ├── monotonic_indexes.m │ ├── frame_id_comp.m │ ├── convert_mat_version.m │ ├── robust_system.m │ ├── find_modes.m │ └── make_small_photos_for_blog.m ├── ct_support │ ├── @layerdata │ │ ├── callback_closePB.m │ │ ├── callback_plotCB.m │ │ ├── callback_save_metadataPB.m │ │ ├── callback_savePB.m │ │ ├── callback_layersSB.m │ │ ├── callback_presetPB.m │ │ └── callback_importPB.m │ ├── vector_editor.m │ ├── basic_load_hdr_mex.mexa64 │ ├── basic_load_hdr_mex.mexw64 │ ├── sidelobe_mask_mex.mexa64 │ ├── basic_load_hdr_mex.mexmaci64 │ ├── ct_generic_en.m │ ├── ct_smooth.m │ ├── run_ct_params.m │ ├── ct_whos.m │ ├── ct_saveas.m │ ├── run_get_segment_file_list.m │ ├── sidelobe_mask.m │ ├── ct_frame_latex.m │ ├── ct_fileparts.m │ ├── read_param_xls_text.m │ ├── customverctrl.m │ └── read_param_xls_boolean.m ├── em_model │ ├── sea_ice.m │ ├── tinga_dielectric_mixing.m │ ├── campCentury_bedrock.m │ ├── grip_bedrock.m │ ├── perm_profile.m │ ├── er_to_extinction.m │ ├── soil.m │ ├── salinity_to_normality.m │ ├── Debye.m │ ├── coherentRefl.m │ └── drysnow.m ├── gps │ ├── applanix_format.pdf │ ├── BCD_to_seconds.m │ ├── epoch_to_datenum.m │ ├── trajectory_turn_radius.m │ ├── datenum_to_epoch.m │ ├── run_all_gps_check.m │ ├── gps_interp1.m │ ├── run_google_map.m │ ├── utc_to_gps.m │ ├── gps_to_utc.m │ ├── geodetic_to_utm.m │ ├── geodetic_to_stereographic.m │ ├── epoch_to_gps_sow.m │ └── missions │ │ └── gps_create_2018_Antarctica_Ground_cpu_time.m ├── processing │ ├── RJ_MCMC.mexa64 │ ├── stereo.mexa64 │ ├── ml_tdp_mex.mexa64 │ ├── optimizer_fit_NT.m │ ├── sar_proc_task.mexa64 │ ├── wb_compute_cost.mexa64 │ ├── wb_compute_cost.mexw64 │ ├── gen_freq.m │ ├── freq_alias.m │ ├── change_static_param_frm.m │ ├── freq_nz.m │ ├── create_task_debug.m │ ├── run_all_frames_check.m │ ├── run_all_records_check.m │ ├── gen_kx.m │ ├── relative_rec_num_to_file_idx_vector.m │ ├── analysis_task_stats_max.m │ ├── mle_compute_cost.m │ ├── array_proc_methods.m │ ├── records_aux_files_create.m │ ├── analysis_task_stats_kx.m │ ├── doa_nonlcon.m │ ├── noise_burst_removal.m │ ├── ni_xml_name_encode.m │ ├── ni_xml_name_decode.m │ ├── records_aux_files_read.m │ ├── records_create_save_workspace.m │ ├── reset_param_spreadsheet.m │ └── sar_proc_task.h ├── mcords │ ├── load_mcords_hdr.mexa64 │ └── load_mcords_hdr.mexw64 ├── hardware │ ├── Anichoic_Chamber_Interface.fig │ ├── sbox │ │ ├── s2y.m │ │ ├── t2s4.m │ │ ├── s2t4.m │ │ ├── a2g.m │ │ ├── a2h.m │ │ ├── a2z.m │ │ ├── h2a.m │ │ ├── z2s.m │ │ ├── y2h.m │ │ ├── g2y.m │ │ ├── g2z.m │ │ ├── h2y.m │ │ ├── h2z.m │ │ ├── y2g.m │ │ ├── z2g.m │ │ ├── z2h.m │ │ ├── s2z.m │ │ ├── a2y.m │ │ ├── g2a.m │ │ ├── y2a.m │ │ ├── z2a.m │ │ ├── y2s.m │ │ ├── a2s4.m │ │ ├── s2a4.m │ │ ├── s2y4.m │ │ ├── y2s4.m │ │ ├── z2s4.m │ │ ├── s2t.m │ │ ├── s2z4.m │ │ └── t2s.m │ ├── getNASettings.m │ ├── awg_sinc_correction.m │ ├── putNASettings.m │ ├── getNAcal.m │ └── putNAcal.m ├── +utua_rds │ ├── parsave.m │ ├── syncnav.m │ ├── fname_info_utua_rds.m │ └── syncnav_loop.m ├── missions │ ├── default_radar_params_2018_Kansas_Vapor55.m │ ├── run_preprocess_settings_HERC.m │ ├── run_preprocess_settings_DOME.m │ ├── run_preprocess_settings_2022_Greenland_P3.m │ ├── run_preprocess_settings_BAS_RDS.m │ ├── run_preprocess_settings_2022_Greenland_Ground.m │ ├── run_preprocess_settings_AWI.m │ ├── run_preprocess_settings_VANILLA.m │ └── default_radar_params_2016_Greenland_P3_mcords.m ├── +sim │ ├── doa_plot_estimates.m │ ├── doa_nonlcon.m │ ├── sim.crosstrack_rmse.m │ ├── doa_rmse.m │ └── sar_example.m ├── +hfrds │ ├── strip_hdr.m │ ├── get_hdr_loc.m │ ├── write_hdr.m │ └── run_create_records.m ├── gis │ ├── repair_frame.m │ ├── split_frame.m │ └── concatenate_thickness_files.m ├── display │ └── lp.m ├── +deconv │ ├── plot_ascope.m │ └── remove_bad_wfs.m ├── mcrds │ └── fname_info_mcrds.m └── acords │ └── load_time_acords.m ├── python └── crossover-test-suite │ ├── requirements.txt │ └── postgres-conn.sample.json ├── bash ├── SDA_file_check.sh ├── watch_cpu_mem.sh └── tape_small_file_archive_script.sh ├── citation.cff └── .gitignore /cresis-toolbox/icards/create_vectors_icards.m: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cresis-toolbox/rss/default_radar_params_2016_Greenland_TO.m: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/.gitignore: -------------------------------------------------------------------------------- 1 | /.vagrant 2 | /.svn 3 | .svn -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/input/README.md: -------------------------------------------------------------------------------- 1 | Documentation coming soon... -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/output/README.md: -------------------------------------------------------------------------------- 1 | Documentation coming soon... -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/utility/README.md: -------------------------------------------------------------------------------- 1 | Documentation coming soon... -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/README.md: -------------------------------------------------------------------------------- 1 | Documentation coming soon... -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_browse/create_ui.m: -------------------------------------------------------------------------------- 1 | function create_ui(obj) 2 | 3 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/@imagewin/proc.m: -------------------------------------------------------------------------------- 1 | function data = proc(obj,data) 2 | 3 | return 4 | 5 | -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/+c3d_rnn_models/__init__.py: -------------------------------------------------------------------------------- 1 | from .cnn import * 2 | from .rnn import * 3 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/README.md: -------------------------------------------------------------------------------- 1 | # OPS MATLAB API 2 | 3 | Documentation coming soon ... 4 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/fdep.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/fdep.m -------------------------------------------------------------------------------- /cresis-toolbox/utility/finitemax.m: -------------------------------------------------------------------------------- 1 | function max_val = finitemax(A) 2 | 3 | max_val = max(A(isfinite(A))); 4 | 5 | end 6 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/finitemin.m: -------------------------------------------------------------------------------- 1 | function min_val = finitemin(A) 2 | 3 | min_val = min(A(isfinite(A))); 4 | 5 | end 6 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@prefwin/close_win.m: -------------------------------------------------------------------------------- 1 | function close_win(obj,varargin) 2 | set(obj.h_fig,'Visible','off'); 3 | return; 4 | -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/trws.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/trws.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/trws.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/trws.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/trws2.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/trws2.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/@layerdata/callback_closePB.m: -------------------------------------------------------------------------------- 1 | function callback_closePB(obj,status,event) 2 | 3 | delete(obj); 4 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/sea_ice.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/em_model/sea_ice.m -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/RJ_MCMC.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/RJ_MCMC.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/RJ_MCMC.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/RJ_MCMC.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/detect.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/detect.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/detect.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/detect.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/extract.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/extract.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/extract.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/extract.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/stereo.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/stereo.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/stereo.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/stereo.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/viterbi.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/viterbi.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/viterbi.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/viterbi.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/viterbi2.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/viterbi2.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/viterbi2.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/viterbi2.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/@layerdata/callback_plotCB.m: -------------------------------------------------------------------------------- 1 | function callback_plotCB(obj,status,event) 2 | 3 | status 4 | 5 | event 6 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/applanix_format.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/gps/applanix_format.pdf -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/train_model.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/train_model.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/train_model.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/train_model.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/viterbi2.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/+tomo/viterbi2.mexmaci64 -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/vector_editor.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/ct_support/vector_editor.m -------------------------------------------------------------------------------- /cresis-toolbox/processing/RJ_MCMC.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/processing/RJ_MCMC.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/processing/stereo.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/processing/stereo.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/processing/ml_tdp_mex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/processing/ml_tdp_mex.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/utility/ct_rmfield.m: -------------------------------------------------------------------------------- 1 | function s = ct_rmfield(s,rm_field_names) 2 | 3 | s = rmfield(s,intersect(fieldnames(s),rm_field_names)); 4 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/json_mex/windows_precompiled_readme.txt: -------------------------------------------------------------------------------- 1 | from /bin at https://github.com/christianpanton/matlab-json 2 | downloaded 03/04/2014 -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/@layerdata/callback_save_metadataPB.m: -------------------------------------------------------------------------------- 1 | function callback_save_metadataPB(obj,status,event) 2 | 3 | status 4 | 5 | event 6 | -------------------------------------------------------------------------------- /cresis-toolbox/mcords/load_mcords_hdr.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/mcords/load_mcords_hdr.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/mcords/load_mcords_hdr.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/mcords/load_mcords_hdr.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/processing/optimizer_fit_NT.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/processing/optimizer_fit_NT.m -------------------------------------------------------------------------------- /cresis-toolbox/processing/sar_proc_task.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/processing/sar_proc_task.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/utility/get_first10_sync.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/get_first10_sync.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/utility/get_first10_sync.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/get_first10_sync.mexw64 -------------------------------------------------------------------------------- /python/crossover-test-suite/requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/python/crossover-test-suite/requirements.txt -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@ascopewin/close_win.m: -------------------------------------------------------------------------------- 1 | function close_win(obj,varargin) 2 | % close_win(obj,varargin) 3 | % 4 | 5 | set(obj.h_fig,'visible','off'); 6 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/toolparam_close_callback.m: -------------------------------------------------------------------------------- 1 | function toolparam_close_callback(obj,hObj,event) 2 | 3 | obj.tool.visible = false; 4 | 5 | return; -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@mapwin/ascope_memory.m: -------------------------------------------------------------------------------- 1 | function ascope_memory(obj,hObj,event) 2 | % ascope_memory(obj,hObj,event) 3 | 4 | obj.map_ascope.memory(); 5 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/wb_compute_cost.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/processing/wb_compute_cost.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/processing/wb_compute_cost.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/processing/wb_compute_cost.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/rss/arena_packet_strip_mex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/rss/arena_packet_strip_mex.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/rss/arena_packet_strip_mex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/rss/arena_packet_strip_mex.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/utility/TriangleRayIntersection.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/TriangleRayIntersection.m -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool/close_win.m: -------------------------------------------------------------------------------- 1 | function close_win(obj,varargin) 2 | set(obj.h_fig,'Visible','off'); 3 | notify(obj,'hide_param'); 4 | return; 5 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/basic_load_hdr_mex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/ct_support/basic_load_hdr_mex.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/basic_load_hdr_mex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/ct_support/basic_load_hdr_mex.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/sidelobe_mask_mex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/ct_support/sidelobe_mask_mex.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/em_model/tinga_dielectric_mixing.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/em_model/tinga_dielectric_mixing.m -------------------------------------------------------------------------------- /cresis-toolbox/utility/data_gaps_check_mex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/data_gaps_check_mex.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/utility/data_gaps_check_mex.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/data_gaps_check_mex.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/utility/get_first10_sync.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/get_first10_sync.mexmaci64 -------------------------------------------------------------------------------- /cresis-toolbox/utility/json_mex/json-c-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/json_mex/json-c-master.zip -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_quality/left_click.m: -------------------------------------------------------------------------------- 1 | function cmds = left_click(obj,param) 2 | % quality tool, left click does nothing 3 | cmds = []; 4 | 5 | return 6 | -------------------------------------------------------------------------------- /cresis-toolbox/rss/arena_packet_strip_tcp_mex.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/rss/arena_packet_strip_tcp_mex.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/utility/data_gaps_check_mex.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/data_gaps_check_mex.mexmaci64 -------------------------------------------------------------------------------- /cresis-toolbox/utility/nanmax.m: -------------------------------------------------------------------------------- 1 | function [varargout] = nanmax(varargin) 2 | % [varargout] = nanmax(varargin) 3 | 4 | [varargout{1:nargout}] = max(varargin{:}); 5 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/nanmin.m: -------------------------------------------------------------------------------- 1 | function [varargout] = nanmin(varargin) 2 | % [varargout] = nanmin(varargin) 3 | 4 | [varargout{1:nargout}] = min(varargin{:}); 5 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/remove_variable_support.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/remove_variable_support.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@prefwin/systemsLB_callback.m: -------------------------------------------------------------------------------- 1 | function systemsLB_callback(obj,status,event) 2 | % systemsLB_callback(obj,status,event) 3 | 4 | obj.season_update(); 5 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonlab/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/OPS-MATLAB/conversion/jsonlab/README.txt -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/basic_load_hdr_mex.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/ct_support/basic_load_hdr_mex.mexmaci64 -------------------------------------------------------------------------------- /cresis-toolbox/hardware/Anichoic_Chamber_Interface.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/hardware/Anichoic_Chamber_Interface.fig -------------------------------------------------------------------------------- /cresis-toolbox/utility/json_mex/matlab-json-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/json_mex/matlab-json-master.zip -------------------------------------------------------------------------------- /cresis-toolbox/utility/json_mex/windows_precompiled.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/json_mex/windows_precompiled.zip -------------------------------------------------------------------------------- /cresis-toolbox/utility/remove_variable_support.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/utility/remove_variable_support.mexmaci64 -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_browse/left_click.m: -------------------------------------------------------------------------------- 1 | function cmds = left_click(obj,param) 2 | 3 | cmds = []; 4 | 5 | param.echowin.cursor_mode = ~param.echowin.cursor_mode; 6 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_copy/left_click.m: -------------------------------------------------------------------------------- 1 | function cmds = left_click(obj,param) 2 | % cmds = picktool_copy.left_click(obj,param) 3 | 4 | cmds = []; 5 | 6 | 7 | return 8 | -------------------------------------------------------------------------------- /cresis-toolbox/rss/arena_convert_range.m: -------------------------------------------------------------------------------- 1 | function nums = arena_convert_range(str) 2 | % Convert 0:2,4,5,7:10 to [0 1 2 3 4 7 8 9 10] 3 | 4 | nums = eval(['[' str(:).' ']']); 5 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/toggle_imagewin_visibility.m: -------------------------------------------------------------------------------- 1 | function toggle_imagewin_visibility(obj,h_obj,event) 2 | 3 | obj.left_panel.imagewin.toggle_visibility(true); 4 | 5 | end 6 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/save.m: -------------------------------------------------------------------------------- 1 | function save(obj) 2 | % save(obj) 3 | % 4 | % Notify all documents that a save has happened. 5 | 6 | notify(obj,'save_event'); 7 | 8 | end 9 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/matlab-json/tojson.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/OPS-MATLAB/conversion/matlab-json/tojson.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/matlab-json/tojson.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/OPS-MATLAB/conversion/matlab-json/tojson.mexw32 -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/matlab-json/tojson.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/OPS-MATLAB/conversion/matlab-json/tojson.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/@layerdata/callback_savePB.m: -------------------------------------------------------------------------------- 1 | function callback_savePB(obj,status,event) 2 | 3 | % Save layers 4 | 5 | % Delete layer object and close GUI 6 | delete(obj); 7 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/matlab-json/fromjson.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/OPS-MATLAB/conversion/matlab-json/fromjson.mexa64 -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/matlab-json/fromjson.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/OPS-MATLAB/conversion/matlab-json/fromjson.mexw32 -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/matlab-json/fromjson.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/OPS-MATLAB/conversion/matlab-json/fromjson.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/get_crossover.m: -------------------------------------------------------------------------------- 1 | function cur_frame = get_crossover(obj) 2 | % cur_frame = get_crossover(obj) 3 | 4 | cur_frame = obj.crossovers.gui.get_crossover(); 5 | 6 | end 7 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/open_crossover.m: -------------------------------------------------------------------------------- 1 | function open_crossover(obj,source,event) 2 | % echowin.open_crossover(obj,source,event) 3 | 4 | notify(obj,'open_crossover_event'); 5 | 6 | end 7 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_browse/left_click_and_drag.m: -------------------------------------------------------------------------------- 1 | function cmds = left_click_and_drag(obj,param) 2 | 3 | cmds = []; 4 | 5 | param.echowin.cursor_mode = ~param.echowin.cursor_mode; 6 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/matlab-json/setjsonfield.mexw32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/OPS-MATLAB/conversion/matlab-json/setjsonfield.mexw32 -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/matlab-json/setjsonfield.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CReSIS/OLD_cresis-toolbox/HEAD/cresis-toolbox/OPS-MATLAB/conversion/matlab-json/setjsonfield.mexw64 -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/@layerdata/callback_layersSB.m: -------------------------------------------------------------------------------- 1 | function callback_layersSB(obj,status,event) 2 | 3 | % Populate Metadata window 4 | 5 | % Order by twtt 6 | 7 | % Other context menu options -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/@layerdata/callback_presetPB.m: -------------------------------------------------------------------------------- 1 | function callback_presetPB(obj,status,event) 2 | 3 | % Update the merge settings 4 | 5 | % Update user interface 6 | obj.update_ui(); 7 | 8 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/boxcar.m: -------------------------------------------------------------------------------- 1 | function H = boxcar(N) 2 | % H = boxcar(N) 3 | % 4 | % Returns N-point boxcar window. Replaces Matlab's signal processing boxcar 5 | % function. 6 | 7 | H = ones(N,1); 8 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/peak.m: -------------------------------------------------------------------------------- 1 | function cmd = peak(obj) 2 | % Peaks at the current command 3 | 4 | if obj.pointer > 0 5 | cmd = obj.stack(obj.pointer); 6 | else 7 | cmd = []; 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/cmds_save.m: -------------------------------------------------------------------------------- 1 | function cmds_save(obj,varargin) 2 | % cmds_save(obj,varargin) 3 | % 4 | % Listener to undo class save event 5 | 6 | set(obj.left_panel.savePB,'String','(S)ave Layer'); 7 | 8 | end 9 | -------------------------------------------------------------------------------- /bash/SDA_file_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # $DATE should be passed from qsub when it's queued up 3 | htar -c -v -f /hpss/c/r/cresis/2017_Antarctica_Basler/$1.tar -P -Y auto -H copies=1 -H verify=1 /N/dcwan/projects/cresis/2017_Antarctica_Basler/$1 4 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@crossover/close_win.m: -------------------------------------------------------------------------------- 1 | function close_win(obj,varargin) 2 | % crossover.close_win(obj,varargin) 3 | 4 | if obj.hide_only 5 | set(obj.h_fig,'Visible','off'); 6 | else 7 | delete(obj); 8 | end 9 | 10 | return; 11 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/ct_generic_en.m: -------------------------------------------------------------------------------- 1 | function en = ct_generic_en(param) 2 | 3 | if ~isfield(param.cmd,'generic') || iscell(param.cmd.generic) || ischar(param.cmd.generic) || ~param.cmd.generic 4 | en = 0; 5 | else 6 | en = 1; 7 | end 8 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/@imagewin/close_win.m: -------------------------------------------------------------------------------- 1 | function close_win(obj,varargin) 2 | % imagewin.close_win(obj,varargin) 3 | 4 | if obj.hide_only 5 | set(obj.h_fig,'Visible','off'); 6 | else 7 | delete(obj); 8 | end 9 | 10 | return; 11 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/ct_smooth.m: -------------------------------------------------------------------------------- 1 | function data = ct_smooth(data,cutoff) 2 | % data = ct_smooth(data,cutoff) 3 | 4 | N = round(1/cutoff/2)*2+1; 5 | H = tukeywin(N,0.5).'; 6 | H = H ./ sum(H); 7 | data = fir_dec(data,H,1); 8 | 9 | 10 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/picker.m: -------------------------------------------------------------------------------- 1 | % For debugging purposes, it is nice to have the handle (gpicker) available 2 | global gpicker; 3 | if isempty(gpicker) 4 | gpicker = imb.mapwin(); 5 | else 6 | gpicker(end+1) = imb.mapwin(); 7 | end 8 | 9 | return; 10 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/get_proj_info.m: -------------------------------------------------------------------------------- 1 | function [proj] = get_proj_info(loc) 2 | % [proj] = get_proj_info(loc) 3 | 4 | proj_load_standard; 5 | 6 | switch loc 7 | case 'arctic' 8 | proj = arctic_proj; 9 | case 'antarctic' 10 | proj = antarctic_proj; 11 | end 12 | -------------------------------------------------------------------------------- /cresis-toolbox/rss/arena_radar_header_type.m: -------------------------------------------------------------------------------- 1 | % arena_radar_header_type 2 | % 3 | % script used to populate the different header types 4 | 5 | doppler_radar_header_type = 2; 6 | snow_radar_header_type = 5; 7 | hf_sounder_radar_header_type = 16; 8 | ku0001_radar_header_type = 23; 9 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/qualityPM_callback.m: -------------------------------------------------------------------------------- 1 | function qualityPM_callback(obj,source,event) 2 | % qualityPM_callback(obj,source,event) 3 | 4 | % Ensure focus stays on figure to prevent hotkeys registering with this 5 | % uicontrol. 6 | uicontrol(obj.right_panel.status_panel.statusText); 7 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@mapwin/prefPB_callback.m: -------------------------------------------------------------------------------- 1 | function prefPB_callback(obj,src,event) 2 | % mapwin.prefPB_callback(obj,hObj,event) 3 | % 4 | % Forces the pref window into the fore front 5 | 6 | set(obj.map_pref.h_fig,'Visible','on'); 7 | figure(obj.map_pref.h_fig); 8 | 9 | return 10 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/gen_freq.m: -------------------------------------------------------------------------------- 1 | function [freq] = gen_freq(time,fc) 2 | 3 | if ~exist('fc','var') 4 | fc = 0; 5 | end 6 | 7 | dt = time(2) - time(1); 8 | Nt = length(time); 9 | df = 1/(Nt*dt); 10 | freq = fc + ifftshift( -floor(Nt/2)*df : df : floor((Nt-1)/2)*df ).'; 11 | 12 | return -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/display_modePM_callback.m: -------------------------------------------------------------------------------- 1 | function display_modePM_callback(obj,hObj,event) 2 | 3 | % Ensure focus stays on figure to prevent hotkeys registering with this 4 | % uicontrol. 5 | uicontrol(obj.right_panel.status_panel.statusText); 6 | 7 | obj.change_display_c; 8 | obj.change_dynamic_range; 9 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_browse/right_click.m: -------------------------------------------------------------------------------- 1 | function cmds = right_click(obj,param) 2 | % cmds = right_click(obj,param) 3 | 4 | cmds = []; 5 | if param.echowin.cursor_mode == false 6 | param.echowin.update_cursor(param.x(1),param.y(1),true); 7 | end 8 | notify(obj,'ascope_memory'); 9 | 10 | 11 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/framesPM_callback.m: -------------------------------------------------------------------------------- 1 | function framesPM_callback(obj,hObj,event) 2 | 3 | % Ensure focus stays on figure to prevent hotkeys registering with this 4 | % uicontrol. 5 | uicontrol(obj.right_panel.status_panel.statusText); 6 | 7 | obj.default_params.max_frames = get(obj.left_panel.framesPM,'Value'); 8 | -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/train_model.m: -------------------------------------------------------------------------------- 1 | %Train template model using ground truth of surface layers 2 | % 3 | % Compile with mex -v -largeArrayDims train_model.cpp 4 | % -v: verbose 5 | % -largeArrayDims: required for 64 bit 6 | % 7 | % Usage: train_model(input_image, surface_layer) 8 | % 9 | % Authors: Mingze Xu 10 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@mapwin/gisPB_callback.m: -------------------------------------------------------------------------------- 1 | function gisPB_callback(obj,src,event) 2 | % mapwin.gisPB_callback(obj,hObj,event) 3 | % 4 | % Forces the gis window into the fore front 5 | 6 | % set(obj.map_gis.h_fig,'Visible','on'); 7 | % figure(obj.map_gis.h_fig); 8 | 9 | warning('This button is not implemented yet.'); 10 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/freq_alias.m: -------------------------------------------------------------------------------- 1 | function freq = freq_alias(freq,fs) 2 | % freq = freq_alias(freq,fs) 3 | % 4 | % Function for handling aliasing due to a DDC shift of digital data sampled 5 | % at fs. 6 | % 7 | % See also: freq_alias, freq_nz 8 | % 9 | % Author: John Paden 10 | 11 | freq = mod(freq + fs/2,fs)-fs/2; 12 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/pop.m: -------------------------------------------------------------------------------- 1 | function pop(obj) 2 | % Pops a set of commands off the stack 3 | 4 | if obj.pointer > 0 5 | obj.last_pointer = obj.pointer; 6 | obj.pointer = obj.pointer - 1; 7 | 8 | % Synch all the documents that are linked to current undo_stack 9 | notify(obj,'synchronize_event'); 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@mapwin/flightCM_callback.m: -------------------------------------------------------------------------------- 1 | function flightCM_callback(obj,hObj,event) 2 | % mapwin.flightCM_callback(obj,hObj,event) 3 | % 4 | % Copies to clipboard contents of the flight label string if it is not empty. 5 | 6 | str = get(obj.top_panel.flightLabel,'String'); 7 | if ~isempty(str) 8 | clipboard('copy',str); 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/@imagewin/save_mat_callback.m: -------------------------------------------------------------------------------- 1 | function save_mat_callback(obj,h_obj,event) 2 | % imagewin.save_mat_callback(obj,h_obj,event) 3 | % 4 | % Callback when save mat button is pushed 5 | 6 | if ~isempty(obj.save_mat_fh) 7 | obj.save_mat_fh(h_obj,event); 8 | else 9 | warning('Property save_mat_fh is not set'); 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /citation.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | message: "If you use this software, please cite it as below." 3 | authors: 4 | - family-names: CReSIS 5 | given-names: 6 | orcid: https://ror.org/04t2m2598 7 | title: "cresis-toolbox" 8 | version: 3.0.1 9 | doi: 10.5281/zenodo.5683959 10 | date-released: 2021-11-12 11 | url: "https://github.com/CReSIS/cresis-toolbox" 12 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/ismodified.m: -------------------------------------------------------------------------------- 1 | function [modified] = ismodified(obj) 2 | % Check to see if there are any commands in the undo stack that have not 3 | % been saved. Returns true if they have, otherwise returns false. 4 | 5 | if isempty(obj.stack) || obj.pointer == 0 6 | modified = false; 7 | else 8 | modified = true; 9 | end 10 | 11 | return; -------------------------------------------------------------------------------- /cresis-toolbox/+utua_rds/parsave.m: -------------------------------------------------------------------------------- 1 | function [] = parsave(path,block) 2 | % Michael Christoffersen 3 | % August 2018 4 | % Wrapper for saving a block file, allows use of matlab parfor in 5 | % syncnav_loop and tdms2block_loop 6 | 7 | %Saves a block file to a the given file name 8 | save(path,'block','-v7.3'); 9 | end 10 | 11 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/redo.m: -------------------------------------------------------------------------------- 1 | function redo(obj) 2 | % Repushes a set of commands onto the stack 3 | 4 | if obj.pointer < length(obj.stack) 5 | obj.last_pointer = obj.pointer; 6 | obj.pointer = obj.pointer + 1; 7 | 8 | % Synch all the documents that are linked to current undo_stack 9 | notify(obj,'synchronize_event'); 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/lcm_vector.m: -------------------------------------------------------------------------------- 1 | function c = lcm_vector(a) 2 | % c = lcm_vector(a) 3 | % 4 | % Find the least common multiple of a vector of numbers using a recursive 5 | % algorithm based on lcm.m 6 | 7 | if length(a) == 1 8 | c = a; 9 | elseif length(a) == 2 10 | c = lcm(a(1),a(2)); 11 | else 12 | c = lcm(lcm_vector(a(1:end-1)),a(end)); 13 | end 14 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@prefwin/mapsPM_callback.m: -------------------------------------------------------------------------------- 1 | function mapsPM_callback(obj,status,event) 2 | 3 | temp = get(obj.h_gui.mapsPM,'String'); 4 | 5 | map = temp{get(obj.h_gui.mapsPM,'Value')}; 6 | 7 | if strcmpi(map,'Connect to OPS') 8 | if obj.ops_connect() 9 | set(obj.h_gui.mapsPM,'Value',1); 10 | return; 11 | end 12 | end 13 | 14 | obj.season_update(); 15 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonlab/examples/example3.json: -------------------------------------------------------------------------------- 1 | {"menu": { 2 | "id": "file", 3 | "value": "_&File", 4 | "popup": { 5 | "menuitem": [ 6 | {"value": "_&New", "onclick": "CreateNewDoc(\"\"\")"}, 7 | {"value": "_&Open", "onclick": "OpenDoc()"}, 8 | {"value": "_&Close", "onclick": "CloseDoc()"} 9 | ] 10 | } 11 | }} 12 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/s2y.m: -------------------------------------------------------------------------------- 1 | function y = s2y(s); 2 | 3 | % Y = s2y(S) 4 | % 5 | % Scattering to Admittance transformation 6 | % 7 | % y = (I-s) * inv(I+s) 8 | % 9 | % for square matrices at multiple frequencies 10 | % 11 | % 27.09.2002 12 | 13 | I = diag(ones(1, size(s,2))); 14 | 15 | for i=1:size(s,3) 16 | y(:,:,i) = (I-s(:,:,i)) * inv(I+s(:,:,i)); 17 | end; -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/t2s4.m: -------------------------------------------------------------------------------- 1 | function s = t2s4(t); 2 | 3 | % S = t2s4(T) 4 | % 5 | % Transmission to Scattering transformation 6 | % only for N-by-4 matrix 7 | 8 | if size(t, 2) ~= 4 9 | disp(' screwed up data '); 10 | end; 11 | 12 | s(:,1) = t(:,3)./t(:,1); 13 | s(:,2) = t(:,4) - t(:,2).*t(:,3)./t(:,1); 14 | s(:,3) = 1./t(:,1); 15 | s(:,4) = -t(:,2)./t(:,1); -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/s2t4.m: -------------------------------------------------------------------------------- 1 | function t = s2t(s); 2 | 3 | % T = s2t(S) 4 | % 5 | % Scattering to Transmission transformation 6 | % only for N-by-four matrix 7 | 8 | if size(s, 2) ~= 4 9 | disp(' screwed up data '); 10 | end; 11 | 12 | t(:,1) = 1./s(:, 3); 13 | t(:,2) = -s(:, 4)./s(:, 3); 14 | t(:,3) = s(:, 1)./s(:, 3); 15 | t(:,4) = s(:, 2) - s(:, 1).*s(:, 4)./s(:, 3); -------------------------------------------------------------------------------- /cresis-toolbox/utility/get_disk_space.m: -------------------------------------------------------------------------------- 1 | function free = get_disk_space(path) 2 | % free = get_disk_space(path) 3 | % 4 | % Returns the amount of free space left on the drive that path points to 5 | 6 | if ~exist(path,'dir') 7 | [path] = fileparts(path); 8 | end 9 | if nargin < 1 || isempty(path) 10 | path= '.'; 11 | end 12 | 13 | free = java.io.File(path).getFreeSpace(); 14 | 15 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/a2g.m: -------------------------------------------------------------------------------- 1 | function g = a2g(A); 2 | 3 | % G = a2g(ABCD) 4 | % 5 | % ABCD to Hybrid-G transformation 6 | % only for 2x2 matrices 7 | 8 | d = A(1,1)*A(2,2) - A(1,2)*A(2,1); 9 | 10 | while abs(A(1,1)) < 1e-8 11 | A(1,1) = A(1,1)*(1+rand*1e-8); 12 | end; 13 | 14 | g(1,1) = A(2,1)/A(1,1); 15 | g(1,2) = -d/A(1,1); 16 | g(2,1) = 1/A(1,1); 17 | g(2,2) = A(1,2)/A(1,1); 18 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/a2h.m: -------------------------------------------------------------------------------- 1 | function h = a2h(A); 2 | 3 | % H = a2h(ABCD) 4 | % 5 | % ABCD to Hybrid-H transformation 6 | % only for 2x2 matrices 7 | 8 | d = A(1,1)*A(2,2) - A(1,2)*A(2,1); 9 | 10 | while abs(A(2,2)) < 1e-8 11 | A(2,2) = A(2,2)*(1+rand*1e-8); 12 | end; 13 | 14 | h(1,1) = A(1,2)/A(2,2); 15 | h(1,2) = d/A(2,2); 16 | h(2,1) = -1/A(2,2); 17 | h(2,2) = A(2,1)/A(2,2); 18 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/a2z.m: -------------------------------------------------------------------------------- 1 | function z = a2z(A); 2 | 3 | % Z = a2z(ABCD) 4 | % 5 | % ABCD to Impedance transformation 6 | % only for 2x2 matrices 7 | 8 | d = A(1,1)*A(2,2) - A(1,2)*A(2,1); 9 | 10 | while abs(A(2,1)) < 1e-8 11 | A(2,1) = A(2,1)*(1+rand*1e-8); 12 | end; 13 | 14 | z(1,1) = A(1,1)/A(2,1); 15 | z(1,2) = d/A(2,1); 16 | z(2,1) = 1/A(2,1); 17 | z(2,2) = A(2,2)/A(2,1); 18 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/BCD_to_seconds.m: -------------------------------------------------------------------------------- 1 | function seconds = BCD_to_seconds(seconds_BCD) 2 | 3 | seconds_BCD = double(seconds_BCD); 4 | 5 | seconds = ... 6 | 3600*(10*mod(floor(seconds_BCD/2^8),2^4) + mod(floor(seconds_BCD/2^12),2^4)) ... 7 | + 60*(10*mod(floor(seconds_BCD/2^16),2^4) + mod(floor(seconds_BCD/2^20),2^4)) ... 8 | + (10*mod(floor(seconds_BCD/2^24),2^4) + mod(floor(seconds_BCD/2^28),2^4)); 9 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/h2a.m: -------------------------------------------------------------------------------- 1 | function A = h2a(h); 2 | 3 | % ABCD = h2a(G) 4 | % 5 | % Hybrid H to ABCD transformation 6 | % only for 2x2 matrices 7 | 8 | d = h(1,1) * h(2,2) - h(1,2) * h(2,1); 9 | 10 | while abs(h(2,1)) < 1e-8 11 | h(2,1) = h(2,1)*(1+rand*1e-8); 12 | end; 13 | 14 | A(1,1) = -d/h(2,1); 15 | A(1,2) = -h(1,1)/h(2,1); 16 | A(2,1) = -h(2,2)/h(2,1); 17 | A(2,2) = -1/h(2,1); -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/z2s.m: -------------------------------------------------------------------------------- 1 | function s = z2s(z); 2 | 3 | % S = z2s(Z) 4 | % 5 | % Impedance to Scattering transformation 6 | % S, Z are matrices of size [P,P,F], 7 | % where P is the number of ports, F the number of frequencies 8 | % 9 | % s = inv(z+I) * (z-I) 10 | 11 | I = diag(ones(1, size(z,2))); 12 | 13 | for i=1:size(z,3) 14 | s(:,:,i) = inv(z(:,:,i)+I) * (z(:,:,i)-I) ; 15 | end; -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/y2h.m: -------------------------------------------------------------------------------- 1 | function h = y2h(y); 2 | 3 | % H = y2h(Y) 4 | % 5 | % Admittance Hybrid transformation 6 | % only for 2-by-2 matrices 7 | % 8 | % martie 27 9 | 10 | if y(1,1) == 0 11 | disp('correspondent admittance matrix non-existent'); 12 | else 13 | y(1,1) = 1/y(1,1); 14 | y(1,2) = -y(1,2)/y(1,1); 15 | y(2,1) = y(2,1)/y(1,1); 16 | y(2,2) = y(2,2) - y(1,2)*y(2,1)/y(1,1); 17 | end; -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/run_ct_params.m: -------------------------------------------------------------------------------- 1 | % script run_ct_params 2 | % 3 | % A script for testing and using the class ct_param 4 | % NOT FINISHED 5 | % 6 | % Author: John Paden 7 | % 8 | % See also: ct_param.m 9 | 10 | 11 | global obj; 12 | if ~isempty(obj) 13 | delete(obj); 14 | end 15 | fn = ct_filename_param('accum_param_2018_Antarctica_TObas.xls') 16 | obj = ct_params(fn); 17 | 18 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/g2y.m: -------------------------------------------------------------------------------- 1 | function y = g2y(g); 2 | 3 | % Y = g2y(G) 4 | % 5 | % Hybrid G to Admittance transformation 6 | % only for 2-by-2 matrices 7 | % 8 | % martie 26 9 | 10 | if g(2,2) == 0 11 | disp('correspondent admittance matrix non-existent'); 12 | else 13 | y(1,1) = -g(2,1)/g(2,2); 14 | y(1,2) = 1/g(2,2); 15 | y(2,1) = g(1,1) - g(1,2)*g(2,1)/g(2,2); 16 | y(2,2) = g(1,2)/g(2,2); 17 | end; -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/g2z.m: -------------------------------------------------------------------------------- 1 | function z = g2z(g); 2 | 3 | % Z = g2z(G) 4 | % 5 | % Hybrid G to Impedance transformation 6 | % only for 2-by-2 matrices 7 | % 8 | % martie 27 9 | 10 | if g(1,1) == 0 11 | disp('correspondent admittance matrix non-existent'); 12 | else 13 | z(1,1) = 1/g(1,1); 14 | z(1,2) = -g(1,2)/g(1,1); 15 | z(2,1) = g(2,1)/g(1,1); 16 | z(2,2) = g(2,2) - g(1,2)*g(2,1)/g(1,1); 17 | end; -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/h2y.m: -------------------------------------------------------------------------------- 1 | function y = h2y(h); 2 | 3 | % Y = h2y(H) 4 | % 5 | % Hybrid to Admittance transformation 6 | % only for 2-by-2 matrices 7 | % 8 | % martie 27 9 | 10 | if h(1,1) == 0 11 | disp('correspondent admittance matrix non-existent'); 12 | else 13 | y(1,1) = 1/h(1,1); 14 | y(1,2) = -h(1,2)/h(1,1); 15 | y(2,1) = h(2,1)/h(1,1); 16 | y(2,2) = h(2,2) - h(1,2)*h(2,1)/h(1,1); 17 | end; -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/h2z.m: -------------------------------------------------------------------------------- 1 | function z = h2z(h); 2 | 3 | % Z = h2z(H) 4 | % 5 | % Hybrid to Admittance transformation 6 | % only for 2-by-2 matrices 7 | % 8 | % martie 27 9 | 10 | if h(2,2) == 0 11 | disp('correspondent admittance matrix non-existent'); 12 | else 13 | z(1,1) = h(1,1) - h(1,2)*h(2,1)/h(2,2); 14 | z(1,2) = h(1,2)/h(2,2); 15 | z(2,1) = -h(2,1)/h(2,2); 16 | z(2,2) = 1/h(2,2); 17 | end; -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/y2g.m: -------------------------------------------------------------------------------- 1 | function g = y2g(y); 2 | 3 | % G = y2g(Y) 4 | % 5 | % Admittance to Hybrid G transformation 6 | % only for 2-by-2 matrices 7 | % 8 | % martie 26 9 | 10 | if y(2,2) == 0 11 | disp('correspondent admittance matrix non-existent'); 12 | else 13 | g(1,1) = y(1,1) - y(1,2)*y(2,1)/y(2,2); 14 | g(1,2) = y(1,2)/y(2,2); 15 | g(2,1) = -y(2,1)/y(2,2); 16 | g(2,2) = 1/y(2,2); 17 | end; -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/z2g.m: -------------------------------------------------------------------------------- 1 | function g = z2g(z); 2 | 3 | % G = z2g(Z) 4 | % 5 | % Impedance to Hybrid G transformation 6 | % only for 2-by-2 matrices 7 | % 8 | % martie 27 9 | 10 | if z(1,1) == 0 11 | disp('correspondent admittance matrix non-existent'); 12 | else 13 | g(1,1) = 1/z(1,1); 14 | g(1,2) = -z(1,2)/z(1,1); 15 | g(2,1) = z(2,1)/z(1,1); 16 | g(2,2) = z(2,2) - z(1,2)*z(2,1)/z(1,1); 17 | end; -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/z2h.m: -------------------------------------------------------------------------------- 1 | function h = z2h(z); 2 | 3 | % H = z2h(Z) 4 | % 5 | % Admittance to Hybrid transformation 6 | % only for 2-by-2 matrices 7 | % 8 | % martie 27 9 | 10 | if z(2,2) == 0 11 | disp('correspondent admittance matrix non-existent'); 12 | else 13 | h(1,1) = z(1,1) - z(1,2)*z(2,1)/z(2,2); 14 | h(1,2) = z(1,2)/z(2,2); 15 | h(2,1) = -z(2,1)/z(2,2); 16 | h(2,2) = 1/z(2,2); 17 | end; -------------------------------------------------------------------------------- /cresis-toolbox/utility/hanning.m: -------------------------------------------------------------------------------- 1 | function H = hanning(N) 2 | % H = hanning(N) 3 | % 4 | % Returns N-point Hanning window. Replaces signal processing toolbox 5 | % function. 6 | 7 | if ~rem(N,2) 8 | % Even length 9 | H = .5*(1 - cos(2*pi*(1:N/2)'/(N+1))); 10 | H = [H; H(end:-1:1)]; 11 | else 12 | % Odd length 13 | H = .5*(1 - cos(2*pi*(1:(N+1)/2)'/(N+1))); 14 | H = [H; H(end-1:-1:1)]; 15 | end 16 | 17 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/key_release.m: -------------------------------------------------------------------------------- 1 | function key_release(obj,src,event) 2 | % key_release(obj,src,event) 3 | % 4 | % Support function for echowin class. 5 | 6 | modifiers = get(event.Source,'CurrentModifier'); 7 | obj.shift_pressed = ismember('shift', modifiers); % true/false 8 | obj.control_pressed = ismember('control', modifiers); % true/false 9 | obj.alt_pressed = ismember('alt', modifiers); % true/false -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@mapwin/open_crossover_echowin.m: -------------------------------------------------------------------------------- 1 | function open_crossover_echowin(obj,source,event) 2 | % mapwin.open_crossover_echowin(obj,source,event) 3 | 4 | % Set the currently selected frame 5 | obj.map.sel = source.get_crossover(); 6 | 7 | % Force to open new window 8 | set(obj.top_panel.picker_windowPM,'Value',1); 9 | 10 | % Load the currently selected frame 11 | loadPB_callback(obj); 12 | 13 | end 14 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@prefwin/flightlinesPM_callback.m: -------------------------------------------------------------------------------- 1 | function flightlinesPM_callback(obj,status,event) 2 | 3 | temp = get(obj.h_gui.flightlinesPM,'String'); 4 | 5 | flightline = temp{get(obj.h_gui.flightlinesPM,'Value')}; 6 | 7 | if strcmpi(flightline,'Connect to OPS') 8 | if obj.ops_connect() 9 | set(obj.h_gui.flightlinesPM,'Value',1); 10 | return; 11 | end 12 | end 13 | 14 | obj.season_update(); 15 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/remove_document.m: -------------------------------------------------------------------------------- 1 | function remove_document(obj, h_doc) 2 | % remove_document(obj, h_doc) 3 | % 4 | % Member function of undo_stack. Removes the specified document from 5 | % the undo stack list 6 | 7 | for idx = 1:length(obj.doc_list) 8 | if obj.doc_list{idx} == h_doc; 9 | obj.doc_list = obj.doc_list([1:idx-1 idx+1:end]); 10 | return 11 | end 12 | end 13 | 14 | return 15 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/get_parent_figure.m: -------------------------------------------------------------------------------- 1 | function handle = get_parent_figure(handle) 2 | % handle = get_parent_figure(handle) 3 | % 4 | % Recurses through the parents of the handle passed in and finds the first 5 | % parent that is a figure or returns [] if no parents are of type figure. 6 | 7 | while ~isempty(handle) & ~strcmp('figure', get(handle,'type')) 8 | handle = get(handle,'parent'); 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool/key_press.m: -------------------------------------------------------------------------------- 1 | function key_press(obj,src,event) 2 | 3 | if ~isempty(event.Key) 4 | switch event.Key 5 | 6 | case 'f1' 7 | % print out help for this tool 8 | fprintf('--------------------%s Tool Help--------------------\n\n',obj.tool_name); 9 | fprintf('%s',obj.help_string); 10 | case 'p' 11 | obj.close_win(); 12 | end 13 | 14 | end 15 | 16 | return -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/run_C3D_RNN_Python.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | module unload python/2.7.9 3 | module unload gcc/4.9.3 4 | module load gcc/7.4.0 5 | module load anaconda3/5.2.0 6 | source activate tensorflow_env 7 | unset MKL_NUM_THREADS 8 | #python3 convert_mat_to_npy.py --mat_dir $1 --npy_dir $2 9 | #echo "Done converting MAT file to NPY." 10 | python3 run_C3D_RNN.py --data_root $3 --c3d_pth $4 --rnn_pth $5 --output_dir $6 --frms $7 -------------------------------------------------------------------------------- /cresis-toolbox/processing/change_static_param_frm.m: -------------------------------------------------------------------------------- 1 | function change_static_param_frm(old_filename, new_filename, frm_str) 2 | 3 | if ~ischar(frm_str) 4 | error('Frames Input has to be a character with comma separated values. Please try again!'); 5 | end 6 | 7 | frms = cellfun(@str2num,strsplit(frm_str,',')); 8 | 9 | load(old_filename,'static_param'); 10 | static_param.cmd.frms = frms; 11 | save(new_filename,'static_param'); -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@ascopewin/ascopeLB_callback.m: -------------------------------------------------------------------------------- 1 | function ascopeLB_callback(obj,source,event) 2 | % ascopeLB_callback(obj,source,event) 3 | 4 | % Ensure focus stays on figure to prevent hotkeys registering with this 5 | % uicontrol. 6 | % uicontrol(obj.right_panel.status_panel.statusText); 7 | 8 | val = get(source,'Value'); 9 | 10 | obj.ascope.selected(:)=false; 11 | obj.ascope.selected(val)=true; 12 | 13 | obj.plot_update(); 14 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@mapwin/key_release.m: -------------------------------------------------------------------------------- 1 | function key_release(obj,src,event) 2 | % mapwin.key_release(obj,src,event) 3 | % 4 | % Support function for mapwin class. 5 | 6 | modifiers = get(event.Source,'CurrentModifier'); 7 | obj.shift_pressed = ismember('shift', modifiers); % true/false 8 | obj.control_pressed = ismember('control', modifiers); % true/false 9 | obj.alt_pressed = ismember('alt', modifiers); % true/false 10 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/delete_figures.m: -------------------------------------------------------------------------------- 1 | function delete_figures(max_fig_num) 2 | % delete_figures(max_fig_num) 3 | % 4 | % Convenience function to delete all figures. This is useful when figures 5 | % have on close callbacks or have visible set of "off". 6 | 7 | if ~exist('max_fig_num','var') 8 | max_fig_num = 10000; 9 | end 10 | 11 | for delete_figures_idx = 1:max_fig_num 12 | try 13 | delete(delete_figures_idx); 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /python/crossover-test-suite/postgres-conn.sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "vbox" : { 3 | "dbname": "ops", 4 | "user": "postgres", 5 | "password": "postgres", 6 | "host": "192.168.0.110", 7 | "port": 4326 8 | }, 9 | "ops0": { 10 | "dbname": "ops", 11 | "user": "postgres", 12 | "password": "postgres", 13 | "host": "192.168.0.110", 14 | "port": 4326 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/close_win.m: -------------------------------------------------------------------------------- 1 | function close_win(obj,varargin) 2 | % close_win(obj,varargin) 3 | % 4 | % We don't delete the object or close the figure here, that is done in the 5 | % parent classes close function which is called when we notify close_window. 6 | 7 | cancel_operation = obj.undo_stack_modified_check(); 8 | 9 | if ~cancel_operation 10 | % Delete the map preferences window 11 | notify(obj,'close_window'); 12 | end 13 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/attach_document.m: -------------------------------------------------------------------------------- 1 | function cmds_list = attach_echowin(obj,h_doc) 2 | % cmds_list = attach_echowin(obj, h_doc) 3 | % 4 | % Member function of undo_stack. Attaches the specified document to 5 | % the undo stack list. Returns a list of commands that need to be 6 | % executed with the implied cmds_direction of 'redo'. 7 | 8 | obj.doc_list{end+1} = h_doc; 9 | 10 | cmds_list = obj.stack(1:obj.pointer); 11 | 12 | end 13 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/ct_whos.m: -------------------------------------------------------------------------------- 1 | function size_bytes = ct_whos(field) 2 | % size_bytes = ct_whos(field) 3 | % 4 | % Convenience function to get the size in bytes of a variable. Useful in 5 | % general to save a couple of lines of code. 6 | % 7 | % Example: 8 | % S.A = ones(1,3); 9 | % S.B = ones(4,4); 10 | % ct_whos(S) 11 | % ct_whos(S.A) 12 | % ct_whos(S.B) 13 | % 14 | % Author: John Paden 15 | 16 | s = whos('field'); 17 | size_bytes = s.bytes; 18 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/robust_cmd.m: -------------------------------------------------------------------------------- 1 | function [success] = robust_cmd(cmd,num_attempts) 2 | 3 | success = false; 4 | attempt = 1; 5 | while attempt <= num_attempts 6 | try 7 | evalin('caller',cmd); 8 | success = true; 9 | return 10 | catch ME 11 | ME.getReport 12 | cmd 13 | warning('cmd failed on attempt %d of %d: %s', attempt, num_attempts, cmd); 14 | pause(10); 15 | end 16 | attempt = attempt + 1; 17 | end 18 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/s2z.m: -------------------------------------------------------------------------------- 1 | function z = s2z(s); 2 | 3 | % Z = s2z(S) 4 | % 5 | % Scattering to Impedance transformation 6 | % S, Z are matrices of size [P,P,F], 7 | % where P is the number of ports, F the number of frequencies 8 | % 9 | % z = (I+s) * inv(I-s) 10 | % 11 | % ver 0.0 original 31.03.1998 12 | % ver 0.1 +freq 11.01.2003 13 | 14 | I = diag(ones(1, size(s,2))); 15 | 16 | for i=1:size(s,3) 17 | z(:,:,i) = (I+s(:,:,i)) * inv(I-s(:,:,i)); 18 | end; -------------------------------------------------------------------------------- /cresis-toolbox/utility/empty_struct_element.m: -------------------------------------------------------------------------------- 1 | function struct_out = empty_struct_element(struct_in) 2 | 3 | field_names = fieldnames(struct_in); 4 | 5 | for f = 1:length(field_names) 6 | 7 | field_name = field_names{f}; 8 | 9 | if isstruct(struct_in(1).(field_name)) 10 | struct_out.(field_name) = empty_struct_element(struct_in(1).(field_name)); 11 | else 12 | struct_out.(field_name) = []; 13 | end 14 | 15 | end 16 | 17 | end -------------------------------------------------------------------------------- /cresis-toolbox/utility/nansum.m: -------------------------------------------------------------------------------- 1 | function A = nansum(A,dim) 2 | % A = nansum(A,dim) 3 | % 4 | % Replacement function for Matlab nansum function since it requires a 5 | % toolbox that people often do not have. 6 | 7 | if ~exist('dim','var') 8 | sizeA = size(A); 9 | if any(sizeA > 1) 10 | dim = find(sizeA>1,1); 11 | else 12 | dim = 1; 13 | end 14 | end 15 | 16 | % Take the mean over all non-NaN 17 | A(isnan(A)) = 0; 18 | A = sum(A,dim); 19 | 20 | end 21 | -------------------------------------------------------------------------------- /cresis-toolbox/missions/default_radar_params_2018_Kansas_Vapor55.m: -------------------------------------------------------------------------------- 1 | function [param,defaults] = default_radar_params_2018_Kansas_Vapor55 2 | % [param,defaults] = default_radar_params_2018_Kansas_Vapor55 3 | % 4 | % Snow9: 2018_Kansas_Vapor55 5 | % 6 | % Creates base "param" struct 7 | % Creates defaults cell array for each type of radar setting 8 | % 9 | % Author: John Paden 10 | 11 | param.season_name = '2018_Kansas_Vapor55'; 12 | param.radar_name = 'snow9'; 13 | 14 | return; 15 | -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/+parameter_tuning/+helper_functions/set_detect_data.m: -------------------------------------------------------------------------------- 1 | function [ detect_data ] = set_detect_data( img_data, det_params, idx ) 2 | %SET_DETECT_DATA Summary of this function goes here 3 | % Detailed explanation goes here 4 | 5 | detect_data = img_data.img(:,:, idx); 6 | detect_data(detect_data > det_params.threshold) = det_params.threshold; 7 | detect_data = fir_dec(detect_data.',hanning(3).'/3,1).'; % what's this? just curious. 8 | 9 | end 10 | 11 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/campCentury_bedrock.m: -------------------------------------------------------------------------------- 1 | % Anthony J. Gow and Debra A. Meese, "Nature of basal debris in the GISP2 and 2 | % Byrd ice cores and its relevance to bed processes," Annals of Glaciology, vol. 3 | % 22, 1996, pp 134-140. 4 | % 5 | % Herron, S. and C. C. Langway, "The debris-laden ice at the bottom of the 6 | % Greenland ice sheet," Journal of Glaciology, vol. 23, no. 89, 1979, pp. 7 | % 193-207. 8 | 9 | 15.7 m of debris-laden ice 10 | bedrock composed of frozen till-like material 11 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/epoch_to_datenum.m: -------------------------------------------------------------------------------- 1 | function time = epoch_to_datenum(time) 2 | % time = epoch_to_datenum(time) 3 | % 4 | % Convert from C library seconds since Jan 1, 1970 epoch to Matlab's 5 | % datenum. 6 | % 7 | % Author: John Paden 8 | % 9 | % See also epoch_to_datenum.m, datenum_to_epoch.m, epoch_to_gps_sow.m, 10 | % epoch_to_sod.m, sod_to_epoch.m, gps_sow_to_epoch.m, utc_leap_seconds.m, 11 | % gps_to_utc.m, utc_to_gps.m 12 | 13 | time = datenum(1970,1,1,0,0,time); 14 | 15 | return; 16 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/yaxisPM_callback.m: -------------------------------------------------------------------------------- 1 | function yaxisPM_callback(obj,hObj,event) 2 | 3 | % Ensure focus stays on figure to prevent hotkeys registering with this 4 | % uicontrol. 5 | uicontrol(obj.right_panel.status_panel.statusText); 6 | 7 | % Replot image 8 | obj.plot_echogram(obj.eg.image_gps_time(1),obj.eg.image_gps_time(end),-inf,inf); 9 | obj.plot_layers(); 10 | obj.plot_crossovers(); 11 | obj.plot_cursors(); 12 | 13 | %% Set layer and cross over visibility 14 | obj.set_visibility(); 15 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/grip_bedrock.m: -------------------------------------------------------------------------------- 1 | % Anthony J. Gow and Debra A. Meese, "Nature of basal debris in the GISP2 and 2 | % Byrd ice cores and its relevance to bed processes," Annals of Glaciology, vol. 3 | % 22, 1996, pp 134-140. 4 | % 5 | 6 | 3022.5 m to 3028.5+ m: silty ice 7 | drilling terminated permaturely (exact bed location unknown) 8 | 9 | Sediment is 0.06 to 0.30% of total weight 10 | 11 | Basal silty ice at summit originated from ground-ice, possibly in a marshy 12 | environment. 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/freq_nz.m: -------------------------------------------------------------------------------- 1 | function freq = freq_nz(freq,fs,nz) 2 | % freq = freq_nz(freq,fs,nz) 3 | % 4 | % Function for handling undersampling by knowing which nyquist zone the is 5 | % sampled in. 6 | % 7 | % Example: 8 | % fs = 10; 9 | % f_ddc = 13; 10 | % nz = 2; 11 | % freq = -5:0.1:4.9; 12 | % plot(freq,freq_nz(freq_alias(freq+f_ddc,fs),fs,nz),'.'); grid on; 13 | % 14 | % See also: freq_alias, freq_nz 15 | % 16 | % Author: John Paden 17 | 18 | freq = freq + (2*(freq>=0)-1)*(-1)^nz*round(nz/2)*fs; 19 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/ct_sgolayfilt.m: -------------------------------------------------------------------------------- 1 | function y=ct_sgolayfilt(X,K,F) 2 | % y=ct_sgolayfilt(X,K,F) 3 | % 4 | % Wrapper function for sgolayfilt to handle arbitrary input data lengths. 5 | % 6 | % X is assumed to be a vector 7 | % K is assumed to be a scalar 8 | % F is assumed to be a scalar 9 | % 10 | % Y is assumed to match X is size 11 | 12 | if isempty(X) 13 | y=[]; 14 | return; 15 | end 16 | 17 | F = min(2*floor((length(X)-1)/2)+1,2*floor((F-1)/2)+1); 18 | K = min(F-1,K); 19 | 20 | y=sgolayfilt(X,K,F); 21 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/a2y.m: -------------------------------------------------------------------------------- 1 | function y = a2y(A); 2 | 3 | % Y = a2y(ABCD) 4 | % 5 | % ABCD to Admittance transformation 6 | % only for 2x2 matrices 7 | 8 | [n,i] = min(abs(A(1,2,:))); 9 | epsilon = 1e-11; 10 | while n <= epsilon 11 | y(1,2,i) = y(1,2,i)+rand*epsilon; 12 | [n,i] = min(abs(A(1,2,:))); 13 | end; 14 | 15 | d = A(1,1,:).*A(2,2,:) - A(1,2,:).*A(2,1,:); 16 | 17 | y(1,1,:) = A(2,2,:)./A(1,2,:); 18 | y(1,2,:) = -d./A(1,2,:); 19 | y(2,1,:) = -1./A(1,2,:); 20 | y(2,2,:) = A(1,1,:)./A(1,2,:); 21 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/g2a.m: -------------------------------------------------------------------------------- 1 | function A = g2a(g); 2 | 3 | % ABCD = g2a(G) 4 | % 5 | % Hybrid G to ABCD transformation 6 | % only for 2x2 matrices 7 | 8 | 9 | [n,i] = min(abs(g(2,1,:))); 10 | epsilon = 1e-14; 11 | while n <= epsilon 12 | g(2,1,i) = g(2,1,i)+rand*epsilon; 13 | [n,i] = min(abs(g(2,1,:))); 14 | end; 15 | 16 | d = g(1,1,:) .* g(2,2,:) - g(1,2,:) .* g(2,1,:); 17 | 18 | A(1,1,:) = 1./g(2,1,:); 19 | A(1,2,:) = g(2,2,:)./g(2,1,:); 20 | A(2,1,:) = g(1,1,:)./g(2,1,:); 21 | A(2,2,:) = d./g(2,1,:); 22 | 23 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/y2a.m: -------------------------------------------------------------------------------- 1 | function A = y2a(y); 2 | 3 | % ABCD = y2a(Y) 4 | % 5 | % Admittance to ABCD transformation 6 | % only for 2x2xN matrices 7 | 8 | % v1.1 - 03.02.2005 freq added 9 | 10 | d = y(1,1,:).*y(2,2,:) - y(1,2,:).*y(2,1,:); 11 | 12 | for i=1:size(y,3) 13 | while abs(y(2,1,i)) < 1e-8 14 | y(2,1,i) = y(2,1,i)*(1+rand*1e-8); 15 | end; 16 | end; 17 | 18 | 19 | A(1,1,:) = -y(2,2,:)./y(2,1,:); 20 | A(1,2,:) = -1./y(2,1,:); 21 | A(2,1,:) = -d./y(2,1,:); 22 | A(2,2,:) = -y(1,1,:)./y(2,1,:); 23 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/trajectory_turn_radius.m: -------------------------------------------------------------------------------- 1 | function radius = trajectory_turn_radius(speed,bank_angle) 2 | % radius = trajectory_turn_radius(speed,bank_angle) 3 | % 4 | % Minimum turn radius for an aircraft for a given speed and bank angle. 5 | % 6 | % speed: matrix of speed (m/s) 7 | % bank_angle: matrix of bank angles (radians) corresponding to speeds 8 | % 9 | % radius: matrix of minimum turn radius corresponding to inputs 10 | % 11 | % Author: John Paden 12 | 13 | g = 9.80665; 14 | 15 | radius = speed.^2 ./ (g*tan(bank_angle)); 16 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/robust_save.m: -------------------------------------------------------------------------------- 1 | function [status,result] = robust_save(fn,varargin) 2 | 3 | status = -1; 4 | while status ~= 0 5 | try 6 | evalin('caller',[sprintf('save(''%s''',fn),sprintf(',''%s''',varargin{:}),');']); 7 | catch ME 8 | ME.getReport 9 | fn 10 | warning('save call failed'); 11 | keyboard 12 | end 13 | try 14 | load(fn) 15 | status = 0; 16 | catch ME 17 | ME.getReport 18 | fn 19 | warning('load call failed'); 20 | keyboard 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/z2a.m: -------------------------------------------------------------------------------- 1 | function A = z2a(z,epsilon); 2 | 3 | % ABCD = z2a(Z,epsilon) 4 | % 5 | % Impedance to ABCD transformation 6 | % only for 2x2 matrices 7 | 8 | if nargin < 2 epsilon = 1e-10; end; 9 | 10 | d = z(1,1,:).*z(2,2,:) - z(1,2,:).*z(2,1,:); 11 | 12 | for i=1:size(z,3) 13 | while abs(z(2,1,i)) < epsilon 14 | z(2,1,i) = z(2,1,i)*(1+rand*epsilon); 15 | end; 16 | end; 17 | 18 | A(1,1,:) = z(1,1,:)./z(2,1,:); 19 | A(1,2,:) = d./z(2,1,:); 20 | A(2,1,:) = 1./z(2,1,:); 21 | A(2,2,:) = z(2,2,:)./z(2,1,:); 22 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/crossoverPB_callback.m: -------------------------------------------------------------------------------- 1 | function crossoverPB_callback(obj,hObj,event) 2 | % crossoverPB_callback(obj,hObj,event) 3 | % 4 | % Shows the cross over window 5 | 6 | % Ensure focus stays on figure to prevent hotkeys registering with this 7 | % uicontrol. 8 | uicontrol(obj.right_panel.status_panel.statusText); 9 | 10 | if ~obj.crossovers.en 11 | obj.crossovers.en = true; 12 | obj.load_crossovers(); 13 | obj.crossovers.gui.visibility_toggle(true); 14 | end 15 | 16 | obj.crossovers.gui.figure_visibility_toggle(true); 17 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/create_task_debug.m: -------------------------------------------------------------------------------- 1 | function create_task_debug(ctrl) 2 | % create_task_debug(ctrl) 3 | % 4 | % This function can be run when the "ctrl" variable exists that create_task.m 5 | % uses. It prints out debug information for each job 6 | % 7 | % Recommendation: 8 | % global gCtrl; 9 | % gCtrl = ctrl; 10 | % create_task_debug(gCtrl); 11 | % 12 | % Author: John Paden 13 | 14 | for job_idx = 1:length(ctrl.jobs) 15 | if ishandle(ctrl.jobs{job_idx}.job) 16 | get(ctrl.jobs{job_idx}.job) 17 | end 18 | end 19 | 20 | return; 21 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/y2s.m: -------------------------------------------------------------------------------- 1 | function s = y2s(y) 2 | % S = y2s(Y) 3 | % 4 | % Admittance to Scattering transformation 5 | % for square matrices at multiple frequencies 6 | % 7 | % s = inv(I+y) * (I-y) 8 | % ver 0.0 original 31.03.1998 9 | % ver 0.1 +freq 27.09.2002 10 | % ver 0.2 +octave supp. 01.06.2005 11 | 12 | if size(size(y),2) > 2 13 | nF = size(y,3); 14 | else nF = 1; 15 | end; 16 | 17 | I = diag(ones(1, size(y,2))); 18 | 19 | 20 | for i=1:nF 21 | s(:,:,i) = inv(I+y(:,:,i)) * (I-y(:,:,i)); 22 | end; 23 | -------------------------------------------------------------------------------- /cresis-toolbox/missions/run_preprocess_settings_HERC.m: -------------------------------------------------------------------------------- 1 | % script run_preprocess_HERC.m 2 | % 3 | % Support script for run_preprocess.m 4 | 5 | param.config.default = []; 6 | 7 | %% HERC MCORDS6 GROUND 8 | cur_idx = length(param.config.default)+1; 9 | param.config.default{cur_idx} = default_radar_params_2019_Antarctica_Ground_rds(); 10 | param.config.base_dir{cur_idx} = '/data/'; 11 | param.config.config_folder_names{cur_idx} = '20190920'; 12 | param.config.board_folder_names{cur_idx} = '20190920/%b'; 13 | param.config.date_strs{cur_idx} = '20190920'; 14 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/perm_profile.m: -------------------------------------------------------------------------------- 1 | function eps_r = perm_profile(h,time,mode,er) 2 | 3 | if strcmpi(mode,'constant') 4 | air_ice_idx = find(time >= h,1); 5 | if isempty(air_ice_idx) 6 | % all air 7 | eps_r = ones(length(time),1)*1; 8 | else 9 | eps_r = [ones(air_ice_idx,1)*1; ones(length(time)-air_ice_idx,1)*er]; 10 | end 11 | elseif strcmpi(mode,'real') 12 | % FILL THIS IN 13 | elseif strcmpi(mode,'complex') 14 | % FILL THIS IN 15 | else 16 | error('Unsupported:Mode','Unsupported mode') 17 | end 18 | 19 | return -------------------------------------------------------------------------------- /cresis-toolbox/gps/datenum_to_epoch.m: -------------------------------------------------------------------------------- 1 | function time = datenum_to_epoch(time) 2 | % time = datenum_to_epoch(time) 3 | % 4 | % Convert from Matlab's datenum to C library seconds since Jan 1, 1970 5 | % epoch (we call this "epoch" time). 6 | % 7 | % Author: John Paden 8 | % 9 | % See also epoch_to_datenum.m, datenum_to_epoch.m, epoch_to_gps_sow.m, 10 | % epoch_to_sod.m, sod_to_epoch.m, gps_sow_to_epoch.m, utc_leap_seconds.m, 11 | % gps_to_utc.m, utc_to_gps.m 12 | 13 | epoch = datenum(1970,1,1,0,0,0); 14 | 15 | time = (time - epoch)*86400; 16 | 17 | return; 18 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/run_all_frames_check.m: -------------------------------------------------------------------------------- 1 | % script run_all_frames_check 2 | % 3 | % Script for running records check on many seasons at once. 4 | % 5 | % Author: John Paden 6 | % 7 | % See also: check_data_products, frames_check, gps_check, records_check 8 | % run_all_frames_check, run_all_gps_check, run_all_records_check 9 | 10 | run_all; 11 | 12 | for param_fns_idx = 1:length(param_fns) 13 | param_fn = param_fns{param_fns_idx}; 14 | param = regexp(param_fn,'(?\w+)_param_(?\w+)','names'); 15 | frames_check(param); 16 | end 17 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@ascopewin/button_down.m: -------------------------------------------------------------------------------- 1 | function button_down(obj,h_obj,event) 2 | [x,y,but] = get_mouse_info(obj.h_fig,obj.h_axes); 3 | 4 | % Make sure that click is on the right side panel 5 | mouse_pos = get(obj.h_fig,'CurrentPoint'); 6 | 7 | % Check to make sure mouse clicked inside of obj.h_axes 8 | % Since extends the full y-length, just check to the right of minimum x 9 | uipanel_pos = get(obj.left_panel.handle,'Position'); 10 | if mouse_pos(1) <= uipanel_pos(1) 11 | return 12 | end 13 | 14 | obj.zoom_mode_x = x; 15 | obj.zoom_mode_y = y; 16 | rbbox; 17 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/imagewin_fn_callback.m: -------------------------------------------------------------------------------- 1 | function [fn,comment] = imagewin_fn_callback(obj,fn) 2 | % [fn,comment] = echowin.imagewin_fn_callback(obj,fn) 3 | % 4 | % Support function for imb.echowin class. When the save or open buttons 5 | % are used on the image params (imagewin class), this function is called 6 | % to give the default filename. 7 | % 8 | 9 | fn_dir = fileparts(fn); 10 | 11 | fn = fullfile(fn_dir, sprintf('Data_%s_%03d_%03d.png', ... 12 | obj.eg.cur_sel.day_seg, obj.eg.frms(1), obj.eg.frms(end))); 13 | comment = ''; 14 | 15 | return; 16 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/run_all_records_check.m: -------------------------------------------------------------------------------- 1 | % script run_all_records_check 2 | % 3 | % Script for running records check on many seasons at once. 4 | % 5 | % Author: John Paden 6 | % 7 | % See also: check_data_products, frames_check, gps_check, records_check 8 | % run_all_frames_check, run_all_gps_check, run_all_records_check 9 | 10 | run_all; 11 | 12 | for param_fns_idx = 1:length(param_fns) 13 | param_fn = param_fns{param_fns_idx}; 14 | param = regexp(param_fn,'(?\w+)_param_(?\w+)','names'); 15 | records_check(param); 16 | end 17 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/getNASettings.m: -------------------------------------------------------------------------------- 1 | function NA = getNASettings(obj) 2 | % obj is gpib object already opened 3 | 4 | format long; format compact; 5 | 6 | % 8722C 7 | 8 | fprintf(obj,'SWET?;'); 9 | NA.sweepTime = fscanf(obj,'%f'); 10 | fprintf(obj,'POIN?;'); 11 | NA.numOfPoints = fscanf(obj,'%f'); 12 | fprintf(obj,'STAR?;'); 13 | NA.startFreq = fscanf(obj,'%f'); 14 | fprintf(obj,'STOP?;'); 15 | NA.stopFreq = fscanf(obj,'%f'); 16 | fprintf(obj,'IFBW?;'); 17 | NA.ifBW= fscanf(obj,'%f'); 18 | fprintf(obj,'POWE?;'); 19 | NA.power = fscanf(obj,'%f'); 20 | 21 | return; 22 | -------------------------------------------------------------------------------- /cresis-toolbox/missions/run_preprocess_settings_DOME.m: -------------------------------------------------------------------------------- 1 | % script run_preprocess_DOME.m 2 | % 3 | % Support script for run_preprocess.m 4 | 5 | param.config.default = []; 6 | 7 | %% DOME MCORDS6 GROUND 8 | cur_idx = length(param.config.default)+1; 9 | param.config.default{cur_idx} = default_radar_params_2018_Antarctica_Ground_rds(); 10 | param.config.base_dir{cur_idx} = '/data/'; 11 | param.config.config_folder_names{cur_idx} = '20181014'; 12 | param.config.board_folder_names{cur_idx} = '20181014/%b'; 13 | param.config.date_strs{cur_idx} = '20181014'; 14 | 15 | return; 16 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_quality/create_ui.m: -------------------------------------------------------------------------------- 1 | function create_ui(obj) 2 | 3 | %set(obj.h_fig,'DockControls','off') 4 | %set(obj.h_fig,'NumberTitle','off'); 5 | % if strcmpi(class(obj.h_fig),'double') 6 | % set(obj.h_fig,'Name',sprintf('%d: %s tool parameters', obj.h_fig, obj.tool_name_title)); 7 | % else 8 | % set(obj.h_fig,'Name',sprintf('%d: %s tool parameters', obj.h_fig.Number, obj.tool_name_title)); 9 | % end 10 | %set(obj.h_fig,'ToolBar','none'); 11 | %set(obj.h_fig,'MenuBar','none'); 12 | %set(obj.h_fig,'CloseRequestFcn',@obj.close_win); 13 | 14 | return 15 | 16 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/run_all_gps_check.m: -------------------------------------------------------------------------------- 1 | % script run_all_frames_check 2 | % 3 | % Script for running records check on many seasons at once. 4 | % 5 | % Author: John Paden 6 | % 7 | % See also: check_data_products, frames_check, gps_check, records_check 8 | % gps_load, gps_create 9 | % run_all_frames_check, run_all_gps_check, run_all_records_check 10 | 11 | run_all; 12 | 13 | for param_fns_idx = 1:length(param_fns) 14 | param_fn = param_fns{param_fns_idx}; 15 | param = regexp(param_fn,'(?\w+)_param_(?\w+)','names'); 16 | gps_check(param); 17 | end 18 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/table/table_resize.m: -------------------------------------------------------------------------------- 1 | function table_resize(hObject, eventdata, handles) 2 | % table_resize(hObject, eventdata, handles) 3 | % 4 | % Part of table_* container functions. table_draw is the user interface to 5 | % the container functions. All other functions should not be called 6 | % directly. 7 | % 8 | % Resize event handler for table container. 9 | % 10 | % Author: John Paden 11 | % 12 | % See also: table_draw, table_pos, table_resize, table_size 13 | 14 | [hObject,figure] = gcbo; 15 | 16 | table = get(hObject,'UserData'); 17 | 18 | table_draw(table); 19 | -------------------------------------------------------------------------------- /cresis-toolbox/missions/run_preprocess_settings_2022_Greenland_P3.m: -------------------------------------------------------------------------------- 1 | % script run_preprocess_2022_Greenland_P3.m 2 | % 3 | % Support script for run_preprocess.m 4 | 5 | param.config.default = []; 6 | 7 | %% HERC MCORDS6 GROUND 8 | cur_idx = length(param.config.default)+1; 9 | param.config.default{cur_idx} = default_radar_params_2022_Greenland_P3_snow(); 10 | param.config.base_dir{cur_idx} = '/mnt/data/'; 11 | param.config.config_folder_names{cur_idx} = '20220419/'; 12 | param.config.board_folder_names{cur_idx} = '20220419/%b'; 13 | param.config.date_strs{cur_idx} = '20220419'; 14 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/gen_kx.m: -------------------------------------------------------------------------------- 1 | function [kx dkx] = gen_kx(x, Nx) 2 | % [kx dkx] = gen_kx(x, Nx) 3 | % 4 | % Generates wavenumber, kx, axis from x. Assumes x is uniformly sampled. 5 | % Nx is optional, positive integer, that specifies the number of points 6 | % to generate rather than the default number of points = length(x). 7 | 8 | if ~exist('Nx','var') || isempty(Nx) 9 | Nx = length(x); 10 | end 11 | 12 | dx = (x(end) - x(1)) / (length(x)-1); 13 | X = Nx*dx; 14 | dkx = 2*pi/X; 15 | kx = dkx * ifftshift(-floor(Nx/2) : floor((Nx-1)/2)); 16 | 17 | return -------------------------------------------------------------------------------- /cresis-toolbox/gps/gps_interp1.m: -------------------------------------------------------------------------------- 1 | function yq = gps_interp1(xi,yi,xq,varargin) 2 | % yq = gps_interp1(xi,yi,xq,varargin) 3 | % 4 | % Interpolates heading and longitude properly through 2*pi wraps. 5 | % 6 | % The data is assumed to be in radians! 7 | % 8 | % Examples: 9 | % gps.lon = gps_interp1(old_gps_time, gps.lon/180*pi, new_gps_time)*180/pi; 10 | % gps.heading = gps_interp1(old_gps_time, gps.heading, new_gps_time); 11 | 12 | yi_x = cos(yi); 13 | yi_y = sin(yi); 14 | yq_x = interp1(xi, yi_x, xq, varargin{:}); 15 | yq_y = interp1(xi, yi_y, xq, varargin{:}); 16 | yq = atan2(yq_y,yq_x); 17 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/awg_sinc_correction.m: -------------------------------------------------------------------------------- 1 | function corr = sinc_correction(freq, fs, max_f, correction) 2 | 3 | freq(freq>max_f) = max_f; 4 | 5 | correction.power = -correction.power; 6 | correction.power = correction.power - max(interp1(correction.freq,correction.power,max_f,'linear','extrap')); 7 | 8 | if 0 9 | % Debug/test 10 | plot(freq,interp1(correction.freq,correction.power,freq,'linear','extrap')); 11 | keyboard 12 | end 13 | 14 | corr = sinc(max_f/fs) ./ sinc(freq/fs) .* 10.^(interp1(correction.freq,correction.power,freq,'linear','extrap')/20); 15 | 16 | return; 17 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/er_to_extinction.m: -------------------------------------------------------------------------------- 1 | function alpha = er_to_extinction(freq,er) 2 | 3 | % For e0 and u0 4 | physical_constants; 5 | 6 | w = 2*pi*freq; 7 | 8 | % gamma is the propagation constant 9 | gamma = j*sqrt(-j*w.*u0.*(j*w.*er(1,:)*e0)); 10 | 11 | % alpha is the attenuation constant 12 | alpha = real(gamma); 13 | 14 | 15 | return; 16 | 17 | er = iceCond(273.15+[-10 0],0.917,195e6,2e-5,0.22,273.15-15); 18 | freq = 195e6; 19 | 20 | alpha = er_to_extinction(freq,er); 21 | 22 | two_way_loss_per_km_dB = lp(exp(-4*alpha*1000)) 23 | 24 | round(15./lp(exp(-4*alpha*1000))*1000) 25 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/frameCM_callback.m: -------------------------------------------------------------------------------- 1 | function frameCM_callback(obj,hObj,event) 2 | % echowin.frameCM_callback(obj,hObj,event) 3 | % 4 | % Copies to clipboard the currently selected frame. 5 | 6 | % Ensure focus stays on figure to prevent hotkeys registering with this 7 | % uicontrol. 8 | uicontrol(obj.right_panel.status_panel.statusText); 9 | 10 | cur_sel = get(obj.left_panel.frameLB,'Value'); 11 | frame_list = get(obj.left_panel.frameLB,'String'); 12 | try 13 | str = frame_list{cur_sel}; 14 | catch 15 | str = ''; 16 | end 17 | if ~isempty(str) 18 | clipboard('copy',str); 19 | end 20 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonlab/examples/example1.json: -------------------------------------------------------------------------------- 1 | { 2 | "firstName": "John", 3 | "lastName": "Smith", 4 | "age": 25, 5 | "address": 6 | { 7 | "streetAddress": "21 2nd Street", 8 | "city": "New York", 9 | "state": "NY", 10 | "postalCode": "10021" 11 | }, 12 | "phoneNumber": 13 | [ 14 | { 15 | "type": "home", 16 | "number": "212 555-1234" 17 | }, 18 | { 19 | "type": "fax", 20 | "number": "646 555-4567" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/run_google_map.m: -------------------------------------------------------------------------------- 1 | global gGoogle; 2 | try 3 | delete(gGoogle); 4 | end 5 | 6 | gGoogle = google_map('AIzaSyCNexiP6WcIda8ZEa2MnwznWrGotDoLu0w'); 7 | % global gRadar; gGoogle = google_map(gRadar.ops.google_map_api_key); 8 | 9 | % [A,x_axis,y_axis] = gGoogle.request_google_map(10,23,10,23); 10 | 11 | % [A,x_axis,y_axis] = gGoogle.request_google_map(125,131,90,95); 12 | [A,x_axis,y_axis] = gGoogle.greenland(); 13 | % [A,x_axis,y_axis] = gGoogle.antarctica(); 14 | 15 | % [A,x_axis,y_axis] = gGoogle.request_google_map(0,256,0,256); 16 | 17 | figure(1); clf; 18 | imagesc(x_axis,y_axis,A) 19 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/nanmean.m: -------------------------------------------------------------------------------- 1 | function Amean = nanmean(A,dim) 2 | % Amean = nanmean(A,dim) 3 | % 4 | % Replacement function for Matlab nanmean function since it requires a 5 | % toolbox that people often do not have. 6 | 7 | if ~exist('dim','var') 8 | sizeA = size(A); 9 | if any(sizeA > 1) 10 | dim = find(sizeA>1,1); 11 | else 12 | dim = 1; 13 | end 14 | end 15 | 16 | % Count the number of non-NaN values 17 | Nnonnan = sum(~isnan(A),dim); 18 | Nnonnan(Nnonnan==0) = NaN; 19 | 20 | % Take the mean over all non-NaN 21 | A(isnan(A)) = 0; 22 | Amean = sum(A,dim) ./ Nnonnan; 23 | 24 | end 25 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/push.m: -------------------------------------------------------------------------------- 1 | 2 | function push(obj,cmds) 3 | % Pushes a set of commands onto the stack 4 | 5 | obj.last_pointer = obj.pointer; 6 | obj.pointer = obj.pointer + 1; 7 | obj.stack{obj.pointer} = cmds; 8 | 9 | % Since the stack may contain cmds for indices > obj.pointer (e.g. because 10 | % the user chose to undo some commands and then pushed this command), we 11 | % must remove these commands from the stack. 12 | obj.stack = obj.stack(1:obj.pointer); 13 | 14 | % Synch all the documents that are linked to current undo_stack 15 | notify(obj,'synchronize_event'); 16 | 17 | end -------------------------------------------------------------------------------- /cresis-toolbox/utility/chebwin.m: -------------------------------------------------------------------------------- 1 | function H = chebwin(N, R) 2 | % H = chebwin(N, R) 3 | % 4 | % Returns N-point chebwin with sidelobe attenuation of R. Replaces Matlab's 5 | % signal processing toolbox chebwin function. 6 | 7 | N1 = N - 1; 8 | 9 | alpha = cosh(acosh(10.^(R/20))/N1); 10 | 11 | m = (0:N1-1).'; 12 | 13 | Am = alpha*cos(pi*m/N1); 14 | 15 | H = zeros(N1,1); 16 | mask = abs(Am)<=1; 17 | H(mask) = cos(N1*acos(Am(mask))); 18 | H(~mask) = cosh(N1*acosh(Am(~mask))); 19 | H(2:2:end) = -1*H(2:2:end); 20 | 21 | H = real(ifft(H)); 22 | H(1) = H(1)/2; 23 | H(end+1) = H(1); 24 | 25 | H = H ./ max(H); 26 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/ct_saveas.m: -------------------------------------------------------------------------------- 1 | function ct_saveas(fig,fn,varargin) 2 | % ct_saveas(fig,fn,varargin) 3 | % 4 | % Function calls saveas, but adds a creation function callback to force the 5 | % "Visible" property to "on" when the figure is opened. This is useful when 6 | % creating invisible figures and saving them. 7 | 8 | fn_dir = fileparts(fn); 9 | if ~exist(fn_dir,'dir') 10 | mkdir(fn_dir); 11 | end 12 | 13 | % Set the create creation function to force the visibility to on when 14 | % opening. 15 | try 16 | set(fig, 'CreateFcn', 'set(gcbo,''Visible'',''on'')'); 17 | end 18 | saveas(fig,fn,varargin{:}); 19 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/relative_rec_num_to_file_idx_vector.m: -------------------------------------------------------------------------------- 1 | function file_idx = relative_rec_num_to_file_idx_vector(recs,relative_rec_num) 2 | % file_idx = relative_rec_num_to_file_idx_vector(recs,relative_rec_num) 3 | % 4 | % Support function for calls to load_mcords_data, load_mcords2_data, etc 5 | 6 | file_idx = zeros(size(recs)); 7 | 8 | cur_file_idx = 1; 9 | for rec_idx = 1:length(recs) 10 | while cur_file_idx+1 <= length(relative_rec_num) ... 11 | && relative_rec_num(cur_file_idx+1) <= recs(rec_idx) 12 | cur_file_idx = cur_file_idx + 1; 13 | end 14 | file_idx(rec_idx) = cur_file_idx; 15 | end 16 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/plot_cursors.m: -------------------------------------------------------------------------------- 1 | function plot_cursors(obj) 2 | % echowin.plot_cursors(obj) 3 | % 4 | % (Re)draws the cursor in the echogram window. Called by shift clicking in the 5 | % echogram window as well as when shift clicking on the map positions the 6 | % cursor within the limits of an echogram window currently opened. 7 | 8 | % modify existing cursor 9 | if isempty(obj.cursor.gps_time) 10 | set(obj.cursor.h,{'XData','YData'},{[],[]}); 11 | else 12 | [~,rline] = min(abs(obj.eg.image_gps_time - obj.cursor.gps_time)); 13 | obj.update_cursor(obj.eg.image_xaxis(rline),NaN,true); 14 | end 15 | 16 | end 17 | -------------------------------------------------------------------------------- /cresis-toolbox/missions/run_preprocess_settings_BAS_RDS.m: -------------------------------------------------------------------------------- 1 | % script run_preprocess_BAS_RDS.m 2 | % 3 | % Support script for run_preprocess.m 4 | 5 | param.config.default = []; 6 | 7 | %% PASIN RDS 8 | cur_idx = length(param.config.default)+1; 9 | param.config.default{cur_idx} = default_radar_params_2017_Antarctica_TObas_rds(); 10 | param.config.base_dir{cur_idx} = '/cresis/snfs1/data/MCoRDS/BAS/'; 11 | param.config.config_folder_names{cur_idx} = '20170122'; 12 | param.config.board_folder_names{cur_idx} = '20170122'; 13 | param.config.date_strs{cur_idx} = '20170122'; 14 | param.config.regexp{cur_idx} = '.*[0-9].mat'; 15 | 16 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/xcorr_noedge.m: -------------------------------------------------------------------------------- 1 | function [C,lags] = xcorr_noedge(A,B,MAXLAG) 2 | % [C,lags] = xcorr_noedge(A,B,MAXLAG) 3 | % 4 | % Removes edge effects by taking a subset of the total dataset. 5 | % A and B must be vectors. 6 | % 7 | % Useful when you have two long vectors that you are just correlating 8 | % a short portion of. MAY NOT WORK CORRECTLY... NEEDS WORK! 9 | % 10 | % Author: ? 11 | 12 | lags = -MAXLAG:MAXLAG; 13 | C = zeros(size(lags)); 14 | for lag_idx = 1:length(lags) 15 | lag = lags(lag_idx); 16 | C(lag_idx) = dot(A(1+MAXLAG:end-MAXLAG),B(1+MAXLAG+lag:end-MAXLAG+lag)); 17 | end 18 | 19 | return; 20 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/analysis_task_stats_max.m: -------------------------------------------------------------------------------- 1 | function [val_idx] = analysis_task_stats_max(param,cmd,data,start_bin,stop_bin) 2 | % [val_idx] = analysis_task_stats_max(param,cmd,data,start_bin,stop_bin) 3 | % 4 | % Max function for use with analysis task command "statistics" that allows 5 | % the maximum value and the index of the maximum value to be returned. This 6 | % function uses nanmax. 7 | % 8 | % Author: John Paden 9 | % 10 | % See also analysis.m 11 | 12 | val_idx = zeros(2,size(data,2)); 13 | for rline = 1:size(data,2) 14 | [val_idx(1,rline),val_idx(2,rline)] = nanmax(data(start_bin(rline):stop_bin(rline),rline)); 15 | end 16 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool/create_ui.m: -------------------------------------------------------------------------------- 1 | function create_ui(obj) 2 | 3 | set(obj.h_fig,'DockControls','off') 4 | set(obj.h_fig,'NumberTitle','off'); 5 | set(obj.h_fig,'Units','Normalized'); 6 | if strcmpi(class(obj.h_fig),'double') 7 | set(obj.h_fig,'Name',sprintf('%d: %s tool parameters', obj.h_fig, obj.tool_name_title)); 8 | else 9 | set(obj.h_fig,'Name',sprintf('%d: %s tool parameters', obj.h_fig.Number, obj.tool_name_title)); 10 | end 11 | set(obj.h_fig,'ToolBar','none'); 12 | set(obj.h_fig,'MenuBar','none'); 13 | set(obj.h_fig,'CloseRequestFcn',@obj.close_win); 14 | set(obj.h_fig,'KeyPressFcn',@obj.key_press); 15 | 16 | return 17 | 18 | -------------------------------------------------------------------------------- /cresis-toolbox/missions/run_preprocess_settings_2022_Greenland_Ground.m: -------------------------------------------------------------------------------- 1 | % script run_preprocess_2022_Greenland_Ground.m 2 | % 3 | % Support script for run_preprocess.m 4 | % 5 | % Preprocess setup script for 2022_Greenland_Ground. 6 | 7 | param.config.default = []; 8 | 9 | %% ACCUM3 SINGLE DAY 10 | cur_idx = length(param.config.default)+1; 11 | param.config.default{cur_idx} = default_radar_params_2022_Greenland_Ground_accum(); 12 | param.config.base_dir{cur_idx} = '/data/'; 13 | param.config.config_folder_names{cur_idx} = '20220524'; 14 | param.config.board_folder_names{cur_idx} = '20220524/%b'; 15 | param.config.date_strs{cur_idx} = '20220524'; 16 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/tukeywin_trim.m: -------------------------------------------------------------------------------- 1 | function W = tukeywin_trim(N,R) 2 | % W = tukeywin_trim(N,R) 3 | % 4 | % Wrapper function to Tukey Window (tukeywin) function that removes 5 | % outer zeros. 6 | % 7 | % For example: 8 | % tukeywin(7,0.5) 9 | % ans = 10 | % 0 11 | % 0.7500 12 | % 1.0000 13 | % 1.0000 14 | % 1.0000 15 | % 0.7500 16 | % 0 17 | % tukeywin_trim(5,0.5) 18 | % ans = 19 | % 0.7500 20 | % 1.0000 21 | % 1.0000 22 | % 1.0000 23 | % 0.7500 24 | 25 | if R == 0 26 | W = tukeywin(N,R); 27 | else 28 | W = tukeywin(N+2,R); 29 | W = W(2:end-1); 30 | end 31 | 32 | return; 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /cresis-toolbox-torque/mccExcludedFiles.log 2 | /cresis-toolbox-torque/readme.txt 3 | /cresis-toolbox-torque/requiredMCRProducts.txt 4 | /cresis-toolbox-torque/run_worker_task.sh 5 | /cresis-toolbox-torque/worker_task 6 | /cresis-toolbox/cluster/mccExcludedFiles.log 7 | /cresis-toolbox/cluster/readme.txt 8 | /cresis-toolbox/cluster/requiredMCRProducts.txt 9 | /cresis-toolbox/cluster/run_cluster_job.sh 10 | /cresis-toolbox/cluster/cluster_job 11 | *~ 12 | **/.venv/ 13 | python/crossover-test-suite/postgres-conn.json 14 | **/__pycache__/ 15 | *.pyc 16 | python/crossover-test-suite/data 17 | python/crossover-test-suite/maps 18 | matplotlib_tools.py 19 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/get_save_cmds.m: -------------------------------------------------------------------------------- 1 | function cmds_list = get_save_cmds(obj,remove_cmds) 2 | % cmds_list = get_save_cmds(obj,remove_cmds) 3 | % 4 | % This command returns all the commands that need to be saved. Removes 5 | % the saved commands if remove_commands set to true. 6 | % 7 | % cmds_list = cell vector of commands 8 | % cmds_direction is assumed to be 'redo' 9 | 10 | cmds_list = obj.stack(1:obj.pointer); 11 | 12 | if remove_cmds 13 | obj.stack = obj.stack(obj.pointer+1:end); 14 | if isempty(obj.stack) 15 | obj.pointer = 0; 16 | else 17 | obj.pointer = 1; 18 | end 19 | obj.last_pointer = NaN; 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /cresis-toolbox/+sim/doa_plot_estimates.m: -------------------------------------------------------------------------------- 1 | function doa_plot_estimates(param,results) 2 | 3 | haxis_list = []; 4 | for method = param.method.list 5 | for src_idx = 1:size(param.monte.DOA,2) 6 | h_fig = 100*src_idx + method; 7 | figure(h_fig); clf; 8 | haxis_list(end+1) = axes('Parent',h_fig); 9 | hold(haxis_list(end),'on'); 10 | imagesc([],[],results.theta_est{method}(:,:,src_idx)*180/pi,'parent',haxis_list(end)); 11 | h_color = colorbar; 12 | set(get(h_color,'YLabel'),'String','Theta ( \circ )'); 13 | xlabel('Test') 14 | ylabel('Run') 15 | axis tight; 16 | end 17 | end 18 | linkaxes(haxis_list,'xy'); 19 | 20 | return 21 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/utc_to_gps.m: -------------------------------------------------------------------------------- 1 | function gps_time = utc_to_gps(utc_time) 2 | % gps_time = utc_to_gps(utc_time) 3 | % 4 | % Converts from ANSI-C UTC time to ANSI-C GPS time. In other words, leap 5 | % seconds are removed. 6 | % 7 | % Example: 8 | % gps_time = utc_to_gps(utc_time); 9 | % 10 | % Author: John Paden 11 | % 12 | % See also epoch_to_datenum.m, datenum_to_epoch.m, epoch_to_gps_sow.m, 13 | % epoch_to_sod.m, sod_to_epoch.m, gps_sow_to_epoch.m, utc_leap_seconds.m, 14 | % gps_to_utc.m, utc_to_gps.m 15 | 16 | if isempty(utc_time) 17 | gps_time = []; 18 | else 19 | gps_time = utc_time + utc_leap_seconds(utc_time(1)); 20 | end 21 | 22 | return; 23 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/gps_to_utc.m: -------------------------------------------------------------------------------- 1 | function utc_time = gps_to_utc(gps_time) 2 | % utc_time = gps_to_utc(gps_time) 3 | % 4 | % Converts from ANSI-C GPS time to ANSI-C UTC time. In other words, leap 5 | % seconds are inserted. 6 | % 7 | % Example: 8 | % utc_time = gps_to_utc(gps_time); 9 | % 10 | % Author: John Paden 11 | % 12 | % See also epoch_to_datenum.m, datenum_to_epoch.m, epoch_to_gps_sow.m, 13 | % epoch_to_sod.m, sod_to_epoch.m, gps_sow_to_epoch.m, utc_leap_seconds.m, 14 | % gps_to_utc.m, utc_to_gps.m 15 | 16 | 17 | if isempty(gps_time) 18 | utc_time = []; 19 | else 20 | utc_time = gps_time - utc_leap_seconds(gps_time(1)); 21 | end 22 | 23 | return; 24 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/a2s4.m: -------------------------------------------------------------------------------- 1 | function s = a2s4(A); 2 | 3 | % S = a2s4(ABCD) 4 | % 5 | % ABCD to Scattering transformation 6 | % only for N-by-4 matrix 7 | 8 | for i = 1:size(A,1) 9 | d(i) = A(i, 1) + A(i, 2) + A(i, 3) + A(i, 4); 10 | while abs(d(i)) < 1e-8 11 | fckindex = 1+round(rand*3); 12 | A(i, fckindex) = A(i, fckindex)*(1+rand*1e-8); 13 | d(i) = A(i, 1) + A(i, 2) + A(i, 3) + A(i, 4); 14 | end; 15 | end; 16 | 17 | d = rot90(d, 3); 18 | 19 | s(:, 1) = (A(:, 1) + A(:, 2) - A(:, 3) - A(:, 4))./d; 20 | s(:, 2) = 2*(A(:, 1).*A(:, 4) - A(:, 2).*A(:, 3))./d; 21 | s(:, 3) = 2./d; 22 | s(:, 4) = (- A(:, 1) + A(:, 2) - A(:, 3) + A(:, 4))./d; 23 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/nanmedian.m: -------------------------------------------------------------------------------- 1 | function Amed = nanmedian(A,dim) 2 | % Amed = nanmedian(A,dim) 3 | % 4 | % Replacement function for Matlab nanmedian function since it requires a 5 | % toolbox that people often do not have. 6 | 7 | if ~exist('dim','var') 8 | sizeA = size(A); 9 | if any(sizeA > 1) 10 | dim = find(sizeA>1,1); 11 | else 12 | dim = 1; 13 | end 14 | end 15 | 16 | sizeAmed = size(A); 17 | sizeAmed(dim) = 1; 18 | Amed = zeros(sizeAmed,class(A)); 19 | 20 | A = permute(A,[dim 1:dim-1 dim+1:ndims(A)]); 21 | sizeA = size(A); 22 | 23 | for n = 1:prod(sizeA(2:end)) 24 | vals = A(:,n); 25 | Amed(n) = median(vals(~isnan(vals))); 26 | end 27 | -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/+parameter_tuning/+helper_functions/compute_errors.m: -------------------------------------------------------------------------------- 1 | function [ stats_struct ] = compute_errors( stats_struct ) 2 | % compute the average rmse, average error, and median (of the median 3 | % error) for each set of parameters applied to the test (the set of frames we've choosed) 4 | 5 | % input: 6 | % stats_struct: a structure used for statistics purposes (after 7 | % hyperparameters tests) 8 | stats_struct.rmse = sqrt(nanmean(stats_struct.total_diff(:).^2)); 9 | stats_struct.mean_difference = nanmean(stats_struct.total_diff(:)); 10 | stats_struct.median_difference = nanmedian(stats_struct.total_diff(:)); 11 | 12 | end 13 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/table/table_pos.m: -------------------------------------------------------------------------------- 1 | function pos = table_pos(table, row, col, in_pos, height) 2 | % pos = table_pos(table, row, col, in_pos) 3 | % 4 | % Part of table_* container functions. table_draw is the user interface to 5 | % the container functions. All other functions should not be called 6 | % directly. 7 | % 8 | % Convert from natural units to Matlab units. Support function for table_draw.m. 9 | % 10 | % Author: John Paden 11 | % 12 | % See also: table_draw, table_pos, table_resize, table_size 13 | 14 | pos(1) = table.offset(1)+table.width_margin(row,col)+in_pos(1); 15 | pos(2) = -table.offset(2)+table.height_margin(row,col)+table.size(2)-in_pos(2)-height; 16 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/zoom_figure_setup.m: -------------------------------------------------------------------------------- 1 | function zoom_figure_setup(h_fig, figure_name) 2 | % zoom_figure_setup(h_fig) 3 | % 4 | % Initialization for zoom figure. 5 | % 6 | % See also: zoom_arrow.m, zoom_button_motion.m, zoom_button_scroll.m, 7 | % zoom_button_up.m, zoom_figure_setup.m, zoom_setup.m 8 | 9 | 10 | set(h_fig,'DockControls','off') 11 | set(h_fig,'NumberTitle','off'); 12 | if strcmpi(class(h_fig),'double') 13 | set(h_fig,'Name',sprintf('%d: %s',h_fig, figure_name)); 14 | else 15 | set(h_fig,'Name',sprintf('%d: %s',h_fig.Number, figure_name)); 16 | end 17 | set(h_fig,'ToolBar','none'); 18 | set(h_fig,'MenuBar','none'); 19 | 20 | zoom_setup(h_fig); 21 | end -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/s2a4.m: -------------------------------------------------------------------------------- 1 | function a = s2a4(S); 2 | 3 | % ABCD = s2a4(S) 4 | % 5 | % Scattering to ABCD transformation 6 | % only for N-by-4 matrix 7 | 8 | for i = 1:size(S,1) 9 | d(i) = 2 * S(i, 3); 10 | while abs(d(i)) < 1e-8 11 | fckindex = 1+round(rand*3); 12 | S(i, 3) = S(i, 3)*(1+rand*1e-8); 13 | d(i) = 2* S(i, 3); 14 | end; 15 | end; 16 | 17 | d = rot90(d, 3); 18 | 19 | a(:, 1) = ((1 + S(:, 1)).*(1 - S(:, 4)) + S(:,2).* S(:, 3))./d; 20 | a(:, 2) = ((1 + S(:, 1)).*(1 + S(:, 4)) - S(:,2).* S(:, 3))./d; 21 | a(:, 3) = ((1 - S(:, 1)).*(1 - S(:, 4)) - S(:,2).* S(:, 3))./d; 22 | a(:, 4) = ((1 - S(:, 1)).*(1 + S(:, 4)) + S(:,2).* S(:, 3))./d; -------------------------------------------------------------------------------- /cresis-toolbox/rss/arena_create_waveform.m: -------------------------------------------------------------------------------- 1 | % script arena_create_waveform 2 | % 3 | % Creates a waveform file for an arena arbitrary waveform generator/DAC. 4 | % This is just a file with N double values in it. Waveform full scale 5 | % is +/- 1.0 (double). 6 | 7 | out_fn = 'C:\Temp\test_waveform.bin'; 8 | fs = 2480e6; 9 | Tpd = 200e-6; 10 | Nt = round(Tpd*fs); 11 | f0 = (2e9+20e9)/16 12 | f1 = (4e9+20e9)/16 13 | BW = (f1 - f0) 14 | K = -BW/Tpd 15 | 16 | dt = 1/fs; 17 | time = dt*(0:Nt-1).'; 18 | 19 | wf = 0.5*tukeywin(Nt,0) .* cos(2*pi*(fs-f0)*time + pi*K*time.^2); 20 | 21 | fid = fopen(out_fn,'w'); 22 | fwrite(fid,wf,'double'); 23 | fclose(fid); 24 | 25 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/s2y4.m: -------------------------------------------------------------------------------- 1 | function y = s2y4(S); 2 | 3 | % Y = s2y4(S) 4 | % 5 | % Scattering to Admittance transformation 6 | % only for N-by-4 matrices 7 | 8 | for i = 1:size(S,1) 9 | d(i) = (1 + S(i, 1)).*(1 + S(i, 4)) - S(i,2).* S(i, 3); 10 | while abs(d(i)) < 1e-7 11 | fckindex = 1+round(rand*3); 12 | S(i, fckindex) = S(i, fckindex)*(1+rand*1e-8); 13 | d(i) = (1 + S(i, 1)).*(1 + S(i, 4)) - S(i,2).* S(i, 3); 14 | end; 15 | end; 16 | 17 | d = rot90(d, 3); 18 | 19 | y(:, 1) = ((1 - S(:, 1)).*(1 + S(:, 4)) + S(:,2).* S(:, 3))./d; 20 | y(:, 2) = -2 * S(:,2)./d; 21 | y(:, 3) = -2 * S(:,3)./d; 22 | y(:, 4) = ((1 + S(:, 1)).*(1 - S(:, 4)) + S(:,2).* S(:, 3))./d; -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@undo_stack/get_synchronize_cmds.m: -------------------------------------------------------------------------------- 1 | function [cmds_list,cmds_direction] = get_synchronize_cmds(obj) 2 | % [cmds_list,cmds_direction] = get_synchronize_cmds(obj) 3 | % 4 | % This command should be called by each document when a synchronize event 5 | % occurs so that each document can execute the cmds. 6 | % 7 | % cmds_list = cell vector of commands 8 | % cmds_direction = 'undo' or 'redo' 9 | 10 | if obj.pointer > obj.last_pointer 11 | cmds_direction = 'redo'; 12 | cmds_list = obj.stack(obj.last_pointer+1:obj.pointer); 13 | else 14 | cmds_direction = 'undo'; 15 | cmds_list = obj.stack(obj.last_pointer:-1:obj.pointer+1); 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/SImage.h: -------------------------------------------------------------------------------- 1 | #ifndef __SIMAGE_H__ 2 | #define __SIMAGE_H__ 3 | 4 | #include "DTwoDimArray.h" 5 | #include 6 | 7 | // A very simple image class. 8 | // 9 | class SDoublePlane : public _DTwoDimArray 10 | { 11 | public: 12 | SDoublePlane() { } 13 | SDoublePlane(int _rows, int _cols) : _DTwoDimArray(_rows, _cols) 14 | { 15 | // be nice and initialize plane to all 0's 16 | memset(data_ptr(), 0, sizeof(double) * rows() * cols()); 17 | } 18 | 19 | SDoublePlane(int _rows, int _cols, double *ptr) : _DTwoDimArray(_rows, _cols, ptr) 20 | { 21 | } 22 | 23 | 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/y2s4.m: -------------------------------------------------------------------------------- 1 | function s = y2s4(y); 2 | 3 | % S = y2s4(Y) 4 | % 5 | % Admittance to Scattering transformation 6 | % only for N-by-4 matrix 7 | 8 | for i = 1:size(y,1) 9 | d(i) = (1 + y(i, 1)).*(1 + y(i, 4)) - y(i,2).* y(i, 3); 10 | while abs(d(i)) < 1e-10 11 | fckindex = 1+round(rand*3); 12 | y(i, fckindex) = y(i, fckindex)*(1+rand*1e-11); 13 | d(i) = (1 + y(i, 1)).*(1 + y(i, 4)) - y(i,2).* y(i, 3); 14 | end; 15 | end; 16 | 17 | d = rot90(d, 3); 18 | 19 | s(:, 1) = ((1 - y(:, 1)) .* (1 + y(:, 4)) + y(:,2).* y(:, 3))./d; 20 | s(:, 2) = -2* y(:,2)./d; 21 | s(:, 3) = -2* y(:,3)./d; 22 | s(:, 4) = ((1 + y(:, 1)) .* (1 - y(:, 4)) + y(:,2).* y(:, 3))./d; -------------------------------------------------------------------------------- /cresis-toolbox/+hfrds/strip_hdr.m: -------------------------------------------------------------------------------- 1 | function result = strip_hdr(fin,fout) 2 | 3 | %rewind the files 4 | fseek(fin,0,-1); 5 | fseek(fout,0,-1); 6 | 7 | %find first file sync 8 | data = fread(fin,10000,'uint8'); 9 | hdr_loc = hfrds.get_hdr_loc(data); 10 | 11 | %read header 12 | [hdr,check] = hfrds.get_hdr(fin,hdr_loc(1)-1); 13 | 14 | %continue reading new data 15 | i=0; 16 | while(check), 17 | %write hdr data to a file 18 | hfrds.write_hdr(fout,hdr); 19 | i=i+1; epri = hdr.epri; 20 | %read next header 21 | [hdr,check] = hfrds.next_hdr(fin,hdr); 22 | %make sure epri is counting by ones (report error if not) 23 | if (hdr.epri-epri) ~= 1, check=0; end; 24 | end; 25 | 26 | result = i; 27 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@ascopewin/button_motion.m: -------------------------------------------------------------------------------- 1 | function button_motion(obj,src,event) 2 | % button_motion(obj,src, event) 3 | % 4 | % Called by ascopewin when mouse cursor is moved. Handles tracking mouse position 5 | % and mouse cursor changing when outside of axes 6 | 7 | mouse_pos = get(obj.h_fig,'CurrentPoint'); 8 | uipanel_pos = get(obj.right_panel.handle,'Position'); 9 | % check if inside status bar 10 | status_pos = get(obj.right_panel.status_panel.handle,'Position'); 11 | status_h = status_pos(4); 12 | if mouse_pos(1) < uipanel_pos(1) || mouse_pos(2) < status_h 13 | set(obj.h_fig,'Pointer','Arrow'); 14 | return; 15 | elseif obj.zoom_mode 16 | set(obj.h_fig,'Pointer','custom'); 17 | end 18 | -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/+parameter_tuning/+helper_functions/create_folders.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | folders_to_create = {'../../../../tuning_results', ... 4 | '../../../../tuning_results/grid_search_viterbi_3D',... 5 | '../../../../tuning_results/grid_search_viterbi_2D',... 6 | '../../../../tuning_results/grid_search_trws_3D',... 7 | '../../../../tuning_results/random_search_viterbi_3D',... 8 | '../../../../tuning_results/random_search_viterbi_2D',... 9 | '../../../../tuning_results/random_search_trws_3D' 10 | }; 11 | 12 | 13 | for idx = 1:length(folders_to_create) 14 | if exist(folders_to_create{idx}, 'dir') 15 | continue; 16 | else 17 | mkdir(folders_to_create{idx}); 18 | end 19 | end -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/cmds_synchronize.m: -------------------------------------------------------------------------------- 1 | function cmds_synchronize(obj,varargin) 2 | % cmds_synchronize(obj,varargin) 3 | % 4 | % Listener to undo stack synchronize_event 5 | 6 | % Get the list of commands from the undo stack that need to be run to 7 | % synchronize the echowin 8 | [cmds_list,cmds_direction] = obj.undo_stack.get_synchronize_cmds(); 9 | 10 | % Execute the commands 11 | obj.cmds_execute(cmds_list,cmds_direction); 12 | 13 | % Check to see if any modifications have been done relative to the last 14 | % save. 15 | if obj.undo_stack.ismodified() 16 | set(obj.left_panel.savePB,'String','(S)ave Layer*'); 17 | else 18 | set(obj.left_panel.savePB,'String','(S)ave Layer'); 19 | end 20 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/mle_compute_cost.m: -------------------------------------------------------------------------------- 1 | function L = mle_compute_cost(A,Rxx) 2 | % L = mle_compute_cost(A, Rxx) 3 | % 4 | % This function is meant to be replace by a mex function, 5 | % mle_compute_cost.mexa64. 6 | % 7 | % Inputs: 8 | % A = Nc x Nsig matrix of steering vectors, 9 | % Rxx = Nc x Nc sample covariance matrix 10 | % 11 | % Outputs: 12 | % L = real valued cost of a Theta solution leading to the A matrix 13 | % based on the likelihood function 14 | % 15 | % See also: array_proc.m, mle_initialize.m, mle_cost_function.m 16 | % ========================================================================= 17 | 18 | 19 | Pa = A * inv(A'*A) * A'; 20 | L = abs(trace(Pa*Rxx)); 21 | 22 | end -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/status_text_copy_callback.m: -------------------------------------------------------------------------------- 1 | function status_text_copy(obj,source,event) 2 | % echowin.status_text_copy(obj,source,event) 3 | % 4 | % Copies the status text to the clipboard 5 | 6 | % Used to copy status text: 7 | %str = get(obj.right_panel.status_panel.statusText,'String'); 8 | 9 | if ~isempty(obj.cursor.gps_time) 10 | % Determine which frame the cursor is in 11 | cur_frm = find(obj.cursor.gps_time >= obj.eg.start_gps_time,1,'last'); 12 | if isempty(cur_frm) 13 | cur_frm = 1; 14 | end 15 | 16 | status_str = status_text_cursor(obj); 17 | 18 | str = sprintf('%s_%03d: %s', obj.eg.cur_sel.day_seg, cur_frm, status_str); 19 | 20 | clipboard('copy',str); 21 | end 22 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonlab/examples/example4.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "sample" : { 4 | "rho" : 1 5 | } 6 | }, 7 | { 8 | "sample" : { 9 | "rho" : 2 10 | } 11 | }, 12 | [ 13 | { 14 | "_ArrayType_" : "double", 15 | "_ArraySize_" : [1,2], 16 | "_ArrayData_" : [1,0] 17 | }, 18 | { 19 | "_ArrayType_" : "double", 20 | "_ArraySize_" : [1,2], 21 | "_ArrayData_" : [1,1] 22 | }, 23 | { 24 | "_ArrayType_" : "double", 25 | "_ArraySize_" : [1,2], 26 | "_ArrayData_" : [1,2] 27 | } 28 | ], 29 | [ 30 | "Paper", 31 | "Scissors", 32 | "Stone" 33 | ] 34 | ] 35 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/tukeywin_cont.m: -------------------------------------------------------------------------------- 1 | function H = tukeywin_cont(L,r) 2 | % H = tukeywin_cont(L,r) 3 | % 4 | % Continuous form of Matlab's tukey window 5 | % 6 | % H is window 7 | % L is -0.5 to 0.5 returns nonzero H (zero outside this range) 8 | % r is 0 to 1 (0 = boxcar, 1 = hann) 9 | % 10 | % Example: 11 | % tukeywin_cont(linspace(-0.5,0.5,101),0.5) 12 | % tukeywin(101,0.5).' 13 | 14 | if nargin < 2 15 | r = 0.5; 16 | end 17 | 18 | L = L+0.5; 19 | r = r/2; 20 | 21 | H = zeros(size(L)); 22 | 23 | H(0 <= L & L <= r) = 0.5*(1 + cos(pi*(L(0 <= L & L <= r)/r - 1))); 24 | 25 | H(1-r <= L & L <= 1) = 0.5*(1 + cos(pi*(L(1-r <= L & L <= 1)/r - 2/r + 1))); 26 | 27 | H(r <= L & L <= 1-r) = 1; 28 | 29 | 30 | end 31 | -------------------------------------------------------------------------------- /cresis-toolbox/+hfrds/get_hdr_loc.m: -------------------------------------------------------------------------------- 1 | function hdr_loc = get_hdr_loc(data) 2 | 3 | index0 = find(data == hex2dec('AA')); 4 | index1 = find(data(index0+1) == hex2dec('AA')); 5 | index1 = index0(index1)+1; 6 | index2 = find(data(index1+1) == hex2dec('55')); 7 | index2 = index1(index2)+1; 8 | index3 = find(data(index2+1) == hex2dec('55')); 9 | index3 = index2(index3)+1; 10 | index4 = find(data(index3+1) == hex2dec('AA')); 11 | index4 = index3(index4)+1; 12 | index5 = find(data(index4+1) == hex2dec('AA')); 13 | index5 = index4(index5)+1; 14 | %index6 = find(data(index5+1) == hex2dec('55')); 15 | %index6 = index5(index6)+1; 16 | %index7 = find(data(index6+1) == hex2dec('55')); 17 | %index7 = index6(index7)+1; 18 | hdr_loc = index5-5; 19 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/remove_variable.m: -------------------------------------------------------------------------------- 1 | % Script: remove_variable.m 2 | % 3 | % Removes a specific set of variables from a list of files 4 | 5 | %% User Settings 6 | fns = get_filenames('/cresis/snfs1/dataproducts/public/data/accum/2013_Greenland_P3/CSARP_qlook','Data_','','.mat',struct('recursive',1)); 7 | 8 | variables_to_remove = {'Depth'} 9 | 10 | %% Automated Section 11 | for fn_idx = 1:length(fns) 12 | fprintf('%s\n', fns{fn_idx}); 13 | for var_idx = 1:length(variables_to_remove) 14 | status = remove_variable_support(fns{fn_idx},variables_to_remove{var_idx}); 15 | if status ~= 0 16 | fprintf(' remove_variable_support failed to delete variable (%d)\n', status); 17 | end 18 | end 19 | end 20 | 21 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/array_proc_methods.m: -------------------------------------------------------------------------------- 1 | % script array_proc_methods 2 | % 3 | % Script with the integer equivalents of each method 4 | % 5 | % See also: array_proc.m, sim.doa.m, array_proc_methods.m, 6 | % array_proc_method_str.m, array_proc_method_strs.m 7 | % 8 | % Author: John Paden 9 | 10 | STANDARD_METHOD = 0; 11 | MVDR_METHOD = 1; 12 | MVDR_ROBUST_METHOD = 2; 13 | MUSIC_METHOD = 3; 14 | EIG_METHOD = 4; 15 | RISR_METHOD = 5; 16 | GEONULL_METHOD = 6; 17 | GSLC_METHOD = 7; 18 | DOA_METHOD_THRESHOLD = 2^16; 19 | MUSIC_DOA_METHOD = 2^16 + 3; 20 | MLE_METHOD = 2^16 + 7; 21 | DCM_METHOD = 2^16 + 8; 22 | PF_METHOD = 2^16 + 9; 23 | WBMLE_METHOD = 2^16 + 10; 24 | SNAPSHOT_METHOD_THRESHOLD = 2^17; 25 | SNAPSHOT_METHOD = 2^17 + 1; 26 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonlab/examples/example2.json: -------------------------------------------------------------------------------- 1 | { 2 | "glossary": { 3 | "title": "example glossary", 4 | "GlossDiv": { 5 | "title": "S", 6 | "GlossList": { 7 | "GlossEntry": { 8 | "ID": "SGML", 9 | "SortAs": "SGML", 10 | "GlossTerm": "Standard Generalized Markup Language", 11 | "Acronym": "SGML", 12 | "Abbrev": "ISO 8879:1986", 13 | "GlossDef": { 14 | "para": "A meta-markup language, used to create markup languages such as DocBook.", 15 | "GlossSeeAlso": ["GML", "XML"] 16 | }, 17 | "GlossSee": "markup" 18 | } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/nanstd.m: -------------------------------------------------------------------------------- 1 | function Astd = nanstd(A,ignore,dim) 2 | % Astd = nanstd(A,ignore,dim) 3 | % 4 | % Replacement function for Matlab nanstd function since it requires a 5 | % toolbox that people often do not have. 6 | 7 | if ~exist('dim','var') 8 | sizeA = size(A); 9 | if any(sizeA > 1) 10 | dim = find(sizeA>1,1); 11 | else 12 | dim = 1; 13 | end 14 | end 15 | 16 | A = permute(A,[dim 1:dim-1 dim+1:ndims(A)]); 17 | sizeA = size(A); 18 | 19 | sizeAstd = size(A); 20 | sizeAstd(1) = 1; 21 | Astd = zeros(sizeAstd,class(A)); 22 | 23 | for n = 1:prod(sizeA(2:end)) 24 | vals = A(:,n); 25 | Astd(1,n) = std(vals(~isnan(vals))); 26 | end 27 | 28 | Astd = permute(Astd,[2:dim 1 dim+1:ndims(A)]); 29 | 30 | end 31 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@ascopewin/button_up.m: -------------------------------------------------------------------------------- 1 | function button_up(obj,h_obj,event) 2 | [x,y,but] = get_mouse_info(obj.h_fig,obj.h_axes); 3 | 4 | % Make sure that click is on the right side panel 5 | mouse_pos = get(obj.h_fig,'CurrentPoint'); 6 | 7 | % Check to make sure mouse clicked inside of obj.h_axes 8 | % Since extends the full y-length, just check to the right of minimum x 9 | uipanel_pos = get(obj.left_panel.handle,'Position'); 10 | if mouse_pos(1) <= uipanel_pos(1) 11 | return 12 | end 13 | 14 | xlims = obj.xlims; xlims = sort(xlims([1 end])); 15 | ylims = obj.ylims; ylims = sort(ylims([1 end])); 16 | zoom_button_up(x,y,but,struct('x',obj.zoom_mode_x,'y',obj.zoom_mode_y, ... 17 | 'h_axes',obj.h_axes,'xlims',xlims,'ylims',ylims)); 18 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/putNASettings.m: -------------------------------------------------------------------------------- 1 | function putNASettings(NA) 2 | % obj is gpib object already opened 3 | % 4 | % Typical usage: 5 | % getNAdata(1,1); 6 | % putNAsettings(NA) 7 | % putNAcal(NA.calArray) 8 | 9 | format long; format compact; 10 | 11 | % 8722C 12 | 13 | global obj; 14 | obj = gpib('ni',0,16); 15 | set(obj,'InputBufferSize',2*1601*8); 16 | set(obj,'Timeout',100); 17 | 18 | fopen(obj); 19 | fprintf(obj,sprintf('POIN %.0d;',NA.numOfPoints)); 20 | fprintf(obj,sprintf('STAR %.12d;',NA.startFreq)); 21 | fprintf(obj,sprintf('STOP %.12d;',NA.stopFreq)); 22 | fprintf(obj,sprintf('IFBW %.0d;',NA.ifBW)); 23 | fprintf(obj,sprintf('POWE %.2d;',NA.power)); 24 | fprintf(obj,sprintf('SWET %.12d;')); 25 | 26 | fclose(obj); 27 | 28 | return; 29 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/run_get_segment_file_list.m: -------------------------------------------------------------------------------- 1 | % script run_get_segment_file_list 2 | % 3 | % Runs get_segment_file_list which is usually called from records_create.m 4 | % This script shows how all the raw data files for a whole season can be 5 | % listed. 6 | % 7 | % Author: John Paden 8 | % 9 | % See also: get_frame_id, get_raw_files.m, get_segment_file_list.m, 10 | % run_get_segment_file_list.m 11 | 12 | params = read_param_xls('H:/scripts/ct_params/rds_param_2016_Greenland_TOdtu.xls'); 13 | 14 | for param_idx = 1:length(params) 15 | param = params(param_idx); 16 | [base_dir,adc_folder_name,fns,file_idxs] = get_segment_file_list(param,1,true); 17 | fprintf('%s\t%d\t%d\n', param.day_seg, file_idxs([1 end])) 18 | end 19 | 20 | return; 21 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/layerLB_str.m: -------------------------------------------------------------------------------- 1 | function layerLB_str(obj,keep_value) 2 | 3 | if exist('keep_value','var') || isempty(keep_value) 4 | keep_value = false; 5 | end 6 | 7 | if ~keep_value 8 | set(obj.left_panel.layerLB,'Value',[]); 9 | end 10 | LB_strings = cell(1,length(obj.eg.layers.lyr_name)); 11 | for idx = 1:length(obj.eg.layers.lyr_name) 12 | name = sprintf(obj.eg.layers.lyr_name{idx},idx); 13 | if obj.eg.layers.visible_layers(idx) 14 | LB_strings{idx} = sprintf('(%d) %s:%s',idx,obj.eg.layers.lyr_group_name{idx},name); 15 | else 16 | LB_strings{idx} = sprintf('(%d) %s:%s',idx,obj.eg.layers.lyr_group_name{idx},name); 17 | end 18 | end 19 | set(obj.left_panel.layerLB,'String',LB_strings); 20 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/sidelobe_mask.m: -------------------------------------------------------------------------------- 1 | function mask = sidelobe_mask(data, sl_rows, sl) 2 | % mask = sidelobe_mask(data, sl_rows, sl) 3 | % 4 | % A = single(randn(10)); 5 | % mask = sidelobe_mask_mex(A,int32([-2:2]),single(ones(1,5))) 6 | % mask = sidelobe_mask(A,int32([-2:2]),single(ones(1,5))) 7 | % 8 | % Author: John Paden 9 | 10 | mask = false(size(data)); 11 | num_rows = size(data,1); 12 | num_cols = size(data,2); 13 | 14 | for col = 1:num_cols 15 | for row = 1:num_rows 16 | for sl_rows_idx = 1:length(sl_rows) 17 | cur_row = row+sl_rows(sl_rows_idx); 18 | if cur_row >= 1 && cur_row <= num_rows && data(cur_row,col)+sl(sl_rows_idx) < data(row,col) 19 | mask(cur_row,col) = true; 20 | end 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/cmds_set_undo_stack_after_draw.m: -------------------------------------------------------------------------------- 1 | function cmds_set_undo_stack_after_draw(obj,cmds_list) 2 | % cmds_set_undo_stack_after_draw(obj,cmds_list) 3 | % 4 | % Run commands from cmds_set_undo_stack and updates save button. 5 | % 6 | % cmds_list: list of commands to be run with cmds_execute 7 | 8 | % Since there may be commands in the undo stack already, we will run these 9 | % commands so that the new echowin is synced up with the stack. 10 | obj.cmds_execute(cmds_list,'redo'); 11 | 12 | % Check to see if any modifications have been done relative to the last 13 | % save. 14 | if obj.undo_stack.ismodified() 15 | set(obj.left_panel.savePB,'String','(S)ave Layer*'); 16 | else 17 | set(obj.left_panel.savePB,'String','(S)ave Layer'); 18 | end 19 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/soil.m: -------------------------------------------------------------------------------- 1 | function soil(mv) 2 | % 3 | % Moisture (volume fraction) 4 | % 5 | % Author: John Paden 6 | % 7 | % See also brine.m, sea_ice.m, rock.m, salt_water.m, soil.m, water.m 8 | % and salinity_to_normality.m, salinity_to_volume_fraction.m 9 | 10 | format compact; format long; 11 | if (ispc) 12 | path(path,'P:\prism\radar\radarSimulator\'); 13 | else 14 | path(path,'/projects/prism/radar/radarSimulator/'); 15 | end 16 | 17 | physicalConstants; 18 | 19 | er = 3 - j*0.05; 20 | er = 2.7 - j*0.022*2.7*1.5; 21 | er = 2.6 - j*0.015*2.6*1.5; 22 | er = 2.8 - j*0.035*2.8*1.5 23 | f = 210e6; 24 | w = 2*pi*f; 25 | 26 | gamma = j*w*sqrt(u0*e0*er); 27 | alpha = real(gamma); 28 | 29 | penetrationDepth = 1./alpha 30 | 31 | return; 32 | 33 | 34 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/z2s4.m: -------------------------------------------------------------------------------- 1 | function s = z2s4(z); 2 | 3 | % S = z2s4(Z) 4 | % 5 | % Impedance to Scattering transformation 6 | % only for N-by-4 matrix 7 | 8 | size(z, 1) 9 | for i = 1:size(z,1) 10 | d(i) = (1 + z(i, 1)).*(1 + z(i, 4)) - z(i,2).* z(i, 3) 11 | while abs(d(i)) < 1e-10 12 | fckindex = 1+round(rand*3); 13 | z(i, fckindex) = z(i, fckindex)*(1+rand*1e-10); 14 | d(i) = (1 + z(i, 1)).*(1 + z(i, 4)) - z(i,2).* z(i, 3); 15 | end; 16 | end; 17 | 18 | d = rot90(d, 3); 19 | 20 | % at this point the 1+Z matrix should be non-singular 21 | 22 | s(:, 1) = ((z(:, 1) - 1) .* (z(:, 4) + 1) - z(:,2).* z(:, 3))./d; 23 | s(:, 2) = 2* z(:,2)./d; 24 | s(:, 3) = 2* z(:,3)./d; 25 | s(:, 4) = ((z(:, 1) + 1) .* (z(:, 4) - 1) - z(:,2).* z(:, 3))./d; -------------------------------------------------------------------------------- /cresis-toolbox/icards/onesided_window.m: -------------------------------------------------------------------------------- 1 | function [ window_matrix ] = onesided_window( td_window,td_window_side,data_size ) 2 | % this function is to create a one-sieded window to avoid big value at the begining or 3 | % the end of records 4 | % td_window=a full window we use 5 | % td_window_side='begin' or 'end' 6 | 7 | window_single=td_window; 8 | if strcmpi(td_window_side,'begin') 9 | window_onesided=[window_single(1:floor(length(window_single)/2));ones(data_size(1,1)-floor(length(window_single)/2),1)]; 10 | else 11 | window_onesided=[ones(data_size(1,1)-floor(length(window_single)/2),1);window_single(end-floor(length(window_single)/2)+1:end)]; 12 | end 13 | 14 | window_matrix=repmat(window_onesided,1,data_size(1,2)); 15 | 16 | end 17 | 18 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/ct_frame_latex.m: -------------------------------------------------------------------------------- 1 | function frame_str_latex = ct_frame_latex(frame_str) 2 | % 3 | % Converts a frame string to a form that works well with tex and latex. 4 | % 5 | % frame_str: string containing the frame ID (e.g. '20141210_02_003') 6 | % 7 | % frame_str_latex: string with underscores 8 | % 9 | % Example: 10 | % frame_str = '20141210_02_003'; 11 | % title(ct_frame_latex(frame_str)); 12 | % title(sprintf('%s: Echogram', ct_frame_latex(frame_str))); 13 | % 14 | % Author: John Paden 15 | 16 | frame_str_latex = ''; 17 | 18 | for idx = 1:length(frame_str) 19 | if frame_str(idx) ~= '_' 20 | frame_str_latex(end+1) = frame_str(idx); 21 | else 22 | frame_str_latex(end+(1:2)) = ['\' frame_str(idx)]; 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/robust_rmdir.m: -------------------------------------------------------------------------------- 1 | function robust_rmdir(fn_dir) 2 | 3 | status = -1; 4 | cluster_attempts = 0; 5 | while status ~= 0 6 | try 7 | if exist(fn_dir,'dir') 8 | rmdir(fn_dir,'s'); 9 | end 10 | status = 0; 11 | catch ME 12 | warning('rmdir failed'); 13 | cluster_attempts = cluster_attempts + 1; 14 | pause(3); 15 | if cluster_attempts > 2 16 | warning('rmdir failed repeatedly. There is probably a permission or file system issue. The directory may need to be moved manually to prevent problems with the processing. Usually the directory can be deleted at some later time once the file system issues are resolved. The directory is:\n %s', fn_dir); 17 | status = 0; 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /cresis-toolbox/icards/icards_get_available.m: -------------------------------------------------------------------------------- 1 | function [A] = get_available(filename) 2 | % function [A] = get_available(filename) 3 | % 4 | % this function returns a matrix that describes the data in 'filename' 5 | % returns an empty matrix if the file doesn't contain any data. (I can't think of 6 | % an instance where this would happen) 7 | 8 | A = zeros(3,0); 9 | 10 | fid=fopen (filename,'r'); 11 | if fid==-1 12 | disp('Could not open file'); 13 | return 14 | end 15 | 16 | fseek(fid,64,'cof'); 17 | 18 | while 1 19 | [temp num] = fread(fid,3,'int32'); 20 | if num ~= 3 % reached the end of the file 21 | fclose(fid); 22 | A = A'; 23 | return 24 | end 25 | A=[A temp]; 26 | fseek(fid,temp(2)*temp(3),'cof'); 27 | end 28 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/ct_fileparts.m: -------------------------------------------------------------------------------- 1 | function [pathstr, name, ext] = ct_fileparts(file) 2 | 3 | file_ispc = ~isempty(regexpi(file,'[\:\\]')); 4 | 5 | if ispc && file_ispc || ~ispc && ~file_ispc 6 | [pathstr, name, ext] = fileparts(file); 7 | return 8 | elseif ispc && ~file_ispc 9 | fn_parts = regexp(file,'\/'); 10 | else 11 | fn_parts = regexp(file,'\\'); 12 | end 13 | 14 | % Cut out directory 15 | if ~isempty(fn_parts) 16 | pathstr = file(1:fn_parts(end)-1); 17 | file = file(fn_parts(end)+1:end); 18 | else 19 | pathstr = ''; 20 | end 21 | 22 | % Split name and extension 23 | period_idx = find(file=='.',1,'last'); 24 | if ~isempty(period_idx) 25 | ext = file(period_idx:end); 26 | name = file(1:period_idx-1); 27 | else 28 | ext = ''; 29 | name = file; 30 | end 31 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/sort_clicks.m: -------------------------------------------------------------------------------- 1 | % ===================================================================== 2 | % Support function for finding min and max x/y coords from init/final click 3 | % Also ensures that mins/maxes don't exceed current axis limits 4 | % ===================================================================== 5 | function [x_min x_max y_min y_max] = sort_clicks(x_ext,y_ext,xi,yi,xf,yf) 6 | 7 | x_min = min(xi,xf); 8 | if x_min < x_ext(1) 9 | x_min = x_ext(1); 10 | end 11 | x_max = max(xi,xf); 12 | if x_max > x_ext(end) 13 | x_max = x_ext(end); 14 | end 15 | y_min = min(yi,yf); 16 | if y_min < y_ext(1) 17 | y_min = y_ext(1); 18 | end 19 | y_max = max(yi,yf); 20 | if y_max > y_ext(end) 21 | y_max = y_ext(end); 22 | end 23 | 24 | return; 25 | -------------------------------------------------------------------------------- /cresis-toolbox/gis/repair_frame.m: -------------------------------------------------------------------------------- 1 | function frm = repair_frame(yyyymmdd,segment,frame) 2 | % 3 | % Repair FRAME from YYYYMMDD,SEGMENT,FRAME 4 | % 5 | % [frm] = repair_frame(yyyymmdd,segment,frame) 6 | % 7 | % yyyymmdd = YYYYMMDD variable (1:8) of FRAME 8 | % segment = SEG variable (9:10) of FRAME 9 | % frame = FRM variable (11:end) of FRAME 10 | % 11 | % Example: 12 | % 13 | % yyyymmdd = '20110511'; 14 | % segment = '01'; 15 | % frame = '001'; 16 | % 17 | % [FRAME] = repair_frame(yyyymmdd,segment,frame); 18 | % 19 | % FRAME = '2011051101001'; 20 | % 21 | % Author: Kyle Purdon 22 | 23 | % Pre-Allocate New Variable 24 | frm = cell(length(frame),1); 25 | 26 | % Fill New Variable 27 | for idx = 1:length(frame) 28 | frm{idx} = strcat(yyyymmdd{idx},segment{idx},frame{idx}); 29 | end 30 | end -------------------------------------------------------------------------------- /cresis-toolbox/gui/table/table_size.m: -------------------------------------------------------------------------------- 1 | function Tsize = table_size(table) 2 | % Tsize = table_size(table) 3 | % 4 | % Part of table_* container functions. table_draw is the user interface to 5 | % the container functions. All other functions should not be called 6 | % directly. 7 | % 8 | % Size of table's user interface control. Support function for table_draw.m. 9 | % 10 | % Author: John Paden 11 | % 12 | % See also: table_draw, table_pos, table_resize, table_size 13 | 14 | set(table.ui,'ResizeFcn',[]); 15 | set(table.ui,'Units','Points'); 16 | tmp = get(table.ui,'Position'); 17 | Tsize = tmp(3:4); 18 | 19 | % Strange and unexplained correction factor: 20 | %Tsize(2) = Tsize(2) * get(0,'ScreenPixelsPerInch')/72; 21 | 22 | set(table.ui,'Units','Normalized'); 23 | set(table.ui,'ResizeFcn',@table_resize); 24 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/s2t.m: -------------------------------------------------------------------------------- 1 | function t = s2t(s, epsilon); 2 | 3 | % T = s2t(S, EPSILON) 4 | % 5 | % Scattering to Transmission Transformation 6 | % 7 | % since 2 is the only allowed number of ports for a T-matrix, 8 | % S, T are matrices of size [2,2,F], 9 | % where F is the number of frequencies 10 | % 11 | % EPSILON is used to produce an approximation of the corresponding S-matrix 12 | % in exceptional cases 13 | % 14 | % 3-d version 4 nov 1999 15 | 16 | if nargin < 2 epsilon = 1e-14; end; 17 | [n,i] = min(abs(s(2,1,:))); 18 | while n <= epsilon 19 | s(2,1,i) = s(2,1,i)+rand*epsilon; 20 | [n,i] = min(abs(s(2,1,:))); 21 | end; 22 | 23 | t(1,1,:) = 1./s(2,1,:); 24 | t(1,2,:) = -s(2,2,:)./s(2,1,:); 25 | t(2,1,:) = s(1, 1,:)./s(2,1,:); 26 | t(2,2,:) = s(1, 2,:) - s(1, 1,:).*s(2,2,:)./s(2,1,:); -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/s2z4.m: -------------------------------------------------------------------------------- 1 | function z = s2z4(S); 2 | 3 | % Z = s2z4(S) 4 | % 5 | % Scattering to Impedance transformation 6 | % only for N-by-4 matrix 7 | 8 | %d = (1 - S(:, 1)).*(1 - S(:, 4)) - S(:,2).* S(:, 3); 9 | 10 | for i = 1:size(S,1) 11 | d(i) = (1 - S(i, 1)).*(1 - S(i, 4)) - S(i,2).* S(i, 3); 12 | while abs(d(i)) < 1e-8 13 | fckindex = 1+round(rand*3); 14 | S(i, fckindex) = S(i, fckindex)*(1+rand*1e-8); 15 | d(i) = (1 - S(i, 1)).*(1 - S(i, 4)) - S(i,2).* S(i, 3); 16 | end; 17 | end; 18 | 19 | d = rot90(d, 3); 20 | 21 | % at this point the I-S matrix should be non-singular 22 | 23 | z(:, 1) = ((1 + S(:, 1)).*(1 - S(:, 4)) + S(:,2).* S(:, 3))./d; 24 | z(:, 2) = 2* S(:,2)./d; 25 | z(:, 3) = 2* S(:,3)./d; 26 | z(:, 4) = ((1 - S(:, 1)).*(1 + S(:, 4)) + S(:,2).* S(:, 3))./d; -------------------------------------------------------------------------------- /cresis-toolbox/hardware/sbox/t2s.m: -------------------------------------------------------------------------------- 1 | function s = t2s(t, epsilon); 2 | 3 | % S = t2s(T, EPSILON) 4 | % 5 | % Transmission to Scaterring Transformation 6 | % 7 | % since 2 is the only allowed number of ports for a T-matrix, 8 | % S, T are matrices of size [2,2,F], 9 | % where F is the number of frequencies 10 | % 11 | % EPSILON is used to produce an approximation of the corresponding S-matrix 12 | % in exceptional cases 13 | % 14 | % 3-d version 4 nov 1999 15 | 16 | if nargin < 2 epsilon = 1e-14; end; 17 | [n,i] = min(abs(t(1,1,:))); 18 | while n <= epsilon 19 | t(1,1,i) = t(1,1,i)+rand*epsilon; 20 | [n,i] = min(abs(t(1,1,:))); 21 | end; 22 | 23 | s(1,1,:) = t(2,1,:)./t(1,1,:); 24 | s(1,2,:) = t(2,2,:) - t(1,2,:).*t(2,1,:) ./t(1,1,:); 25 | s(2,1,:) = 1./t(1,1,:); 26 | s(2,2,:) = -t(1,2,:) ./t(1,1,:); -------------------------------------------------------------------------------- /cresis-toolbox/icards/fname_info_icards.m: -------------------------------------------------------------------------------- 1 | function fname = fname_info_icards(fn) 2 | % fname = fname_info_icards(fn) 3 | % 4 | % Detects the type of ICARDS filename and then parses it. 5 | % 6 | % fn = ICARDS file name 7 | % 8 | % fname = structure containing each of the fields of the ICARDS 9 | % filename 10 | % 11 | % For example: may19_01.009 12 | % .name = may19_01 13 | % .file_idx = 009 14 | % 15 | % Example 16 | % fn = 'S:\data\ICARDS\2001\may19\may19_01.009'; 17 | % fname = fname_info_icards(fn) 18 | % 19 | % Author: John Paden 20 | % 21 | % See also datenum 22 | 23 | [path name ext] = fileparts(fn); 24 | fn = [name ext]; 25 | 26 | [fname.name fn] = strtok(fn,'.'); 27 | 28 | [fname.file_idx fn] = strtok(fn(2:end),'.'); 29 | fname.file_idx = str2double(fname.file_idx); 30 | 31 | return; 32 | -------------------------------------------------------------------------------- /cresis-toolbox/+utua_rds/syncnav.m: -------------------------------------------------------------------------------- 1 | function [ lat,lon,elev ] = syncnav( block,fname ) 2 | % Michael Christoffersen 3 | % May 2017 4 | % syncnav Uses the time in a block file to extract better location info 5 | times = block.time; 6 | s = zeros(1,length(block.time)); 7 | 8 | for i=1:length(block.time) 9 | t = times(i); 10 | t = split(t,'T'); 11 | t = t(2); 12 | t = split(t,':'); 13 | % 37 second to change from GPS to UTC 14 | s(i) = str2double(t(1))*60*60 + str2double(t(2))*60 + str2double(t(3))-37; 15 | end 16 | 17 | tdata = dlmread(fname,' ',1,0); 18 | lat = interp1(tdata(:,1),tdata(:,2),s); 19 | lon = interp1(tdata(:,1),tdata(:,3),s); 20 | elev = interp1(tdata(:,1),tdata(:,4),s); 21 | 22 | end 23 | 24 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_snake/left_click.m: -------------------------------------------------------------------------------- 1 | function cmds = left_click(obj,param) 2 | 3 | %% Get search range from tool param window 4 | rbin_range_str = get(obj.top_panel.manual_rangeTB,'String'); 5 | try 6 | % Assumes the value entered is a matlab expression that can be evaluated 7 | search_range = eval(sprintf('[%s]', rbin_range_str)); 8 | if length(search_range) == 1 9 | search_range = -search_range:search_range; 10 | else 11 | search_range = round(min(search_range)):round(max(search_range)); 12 | end 13 | catch ME 14 | warning('Search range parameter is not valid, using default range'); 15 | search_range = -5:5; 16 | end 17 | 18 | if isempty(search_range) 19 | search_range = -5:5; 20 | end 21 | 22 | param.search_range = search_range; 23 | cmds = insert_pnt(obj,param); 24 | 25 | return 26 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_interpolate/left_click.m: -------------------------------------------------------------------------------- 1 | function cmds = left_click(obj,param) 2 | 3 | %% Get search range from tool param window 4 | rbin_range_str = get(obj.panel.manual_rangeTB,'String'); 5 | try 6 | % Assumes the value entered is a matlab expression that can be evaluated 7 | search_range = eval(sprintf('[%s]', rbin_range_str)); 8 | if length(search_range) == 1 9 | search_range = -search_range:search_range; 10 | else 11 | search_range = round(min(search_range)):round(max(search_range)); 12 | end 13 | catch ME 14 | warning('Search range parameter is not valid, using default range'); 15 | search_range = -5:5; 16 | end 17 | 18 | if isempty(search_range) 19 | search_range = -5:5; 20 | end 21 | 22 | param.search_range = search_range; 23 | cmds = insert_pnt(obj,param); 24 | 25 | return 26 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_viterbi/left_click.m: -------------------------------------------------------------------------------- 1 | function cmds = left_click(obj,param) 2 | 3 | %% Get search range from tool param window 4 | rbin_range_str = get(obj.top_panel.insert_range_TE,'String'); 5 | try 6 | % Assumes the value entered is a matlab expression that can be evaluated 7 | search_range = eval(sprintf('[%s]', rbin_range_str)); 8 | if length(search_range) == 1 9 | search_range = -search_range:search_range; 10 | else 11 | search_range = round(min(search_range)):round(max(search_range)); 12 | end 13 | catch ME 14 | warning('Search range parameter is not valid, using default range'); 15 | search_range = -5:5; 16 | end 17 | 18 | if isempty(search_range) 19 | search_range = -5:5; 20 | end 21 | 22 | param.search_range = search_range; 23 | cmds = insert_pnt(obj,param); 24 | 25 | return 26 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@prefwin/layerSourcePM_callback.m: -------------------------------------------------------------------------------- 1 | function layerSourcePM_callback(obj,status,event) 2 | % layerSourcePM_callback(obj,status,event) 3 | % 4 | % Author: Anjali Pare 5 | 6 | temp = get(obj.h_gui.layerSourcePM,'String'); 7 | 8 | layer_source = temp{get(obj.h_gui.layerSourcePM,'Value')}; 9 | 10 | if strcmpi(layer_source,'Connect to OPS') 11 | if obj.ops_connect() 12 | set(obj.h_gui.layerSourcePM,'Value',1); 13 | return; 14 | end 15 | obj.season_update(); 16 | elseif strcmpi(layer_source,'OPS') 17 | set(obj.h_gui.layerDataSourcePM,'Enable','off'); 18 | obj.h_gui.h_layers.set_enable(true); 19 | obj.season_update(); 20 | elseif strcmpi(layer_source,'layerdata') 21 | set(obj.h_gui.layerDataSourcePM,'Enable','on'); 22 | obj.h_gui.h_layers.set_enable(false); 23 | end 24 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/get_filename.m: -------------------------------------------------------------------------------- 1 | function [filenames] = get_filename(filepath,filename_start,filename_middle,filename_end,varargin) 2 | % [filenames] = get_filename(filepath,filename_start,filename_middle,filename_end,varargin) 3 | % 4 | % Calls get_filenames, but only returns one matchign file and 5 | % array. 6 | % 7 | % Author: John Paden 8 | 9 | [filenames] = get_filenames(filepath,filename_start,filename_middle,filename_end,varargin{:}); 10 | 11 | if length(filenames) > 1 12 | for idx = 1:length(filenames) 13 | fprintf(' (%d) %s\n', idx, filenames{idx}); 14 | end 15 | idx = input('Choose a file: '); 16 | filenames = filenames{idx}; 17 | elseif length(filenames) == 1 18 | filenames = filenames{1}; 19 | else 20 | error('get_filename:no_file_found','No files found.'); 21 | end 22 | 23 | return 24 | 25 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonlab/examples/jsonlab_speedtest.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Benchmarking processing speed of savejson and loadjson 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | 5 | datalen=[1e3 1e4 1e5 1e6]; 6 | len=length(datalen); 7 | tsave=zeros(len,1); 8 | tload=zeros(len,1); 9 | for i=1:len 10 | tic; 11 | json=savejson('data',struct('d1',rand(datalen(i),3),'d2',rand(datalen(i),3)>0.5)); 12 | tsave(i)=toc; 13 | data=loadjson(json); 14 | tload(i)=toc-tsave(i); 15 | fprintf(1,'matrix size: %d\n',datalen(i)); 16 | end 17 | 18 | loglog(datalen,tsave,'o-',datalen,tload,'r*-'); 19 | legend('savejson runtime (s)','loadjson runtime (s)'); 20 | xlabel('array size'); 21 | ylabel('running time (s)'); 22 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/geodetic_to_utm.m: -------------------------------------------------------------------------------- 1 | function [east,north,mstruct] = geodetic_to_utm(lat,lon) 2 | % [east,north,mstruct] = geodetic_to_utm(lat,lon) 3 | % 4 | % Converts from geodetic latitude/longitude to UTM. Returns the 5 | % mstruct required to convert back and forth (mstruct.zone 6 | % gives the UTM zone). 7 | % 8 | % lat = size X array (deg) 9 | % lon = size X array (deg) 10 | % 11 | % east = size X array (m) 12 | % north = size X array (m) 13 | % 14 | % Authors: John Paden 15 | % 16 | % See also: minvtran.m, mfwdtran.m 17 | 18 | mstruct = defaultm('utm'); 19 | mstruct.zone = utmzone(lat,lon); 20 | mstruct = defaultm(mstruct); 21 | % geoid = utmgeoid(mstruct.zone); 22 | % mstruct.geoid = geoid(1,:); 23 | physical_constants; 24 | mstruct.geoid = WGS84.ellipsoid; 25 | 26 | [east,north] = mfwdtran(mstruct,lat,lon); 27 | 28 | return; 29 | -------------------------------------------------------------------------------- /cresis-toolbox/gis/split_frame.m: -------------------------------------------------------------------------------- 1 | function [yyyymmdd,segment,frame] = split_frame(frm) 2 | % 3 | % Split FRAME into YYYYMMDD,SEGMENT,FRAME 4 | % 5 | % [yyyymmdd,segment,frame] = split_frame(frm); 6 | % 7 | % frm = Standard FRAME variable (Cell) 8 | % 9 | % Example: 10 | % 11 | % FRAME = '2011051101001'; 12 | % 13 | % [yyyymmdd,segment,frame] = split_frame(FRAME); 14 | % 15 | % yyyymmdd = '20110511' 16 | % segment = '01' 17 | % frame = '001' 18 | % 19 | % Author: Kyle Purdon 20 | 21 | % Pre-Allocate New Variables 22 | yyyymmdd = cell(length(frm),1); 23 | segment = cell(length(frm),1); 24 | frame = cell(length(frm),1); 25 | 26 | % Fill New Variables 27 | for frm_idx = 1:length(frm) 28 | yyyymmdd{frm_idx} = frm{frm_idx}(1:8); 29 | segment{frm_idx} = frm{frm_idx}(9:10); 30 | frame{frm_idx} = frm{frm_idx}(11:end); 31 | end 32 | end -------------------------------------------------------------------------------- /cresis-toolbox/processing/records_aux_files_create.m: -------------------------------------------------------------------------------- 1 | function records_aux_files_create(records_fn,print_flag) 2 | % DEPRECATED 3 | % 4 | % records_aux_files_create(records_fn,print_flag) 5 | % 6 | % Creates the auxilliary files to the main records file. These files 7 | % are used by tasks running on the scheduler because they allow a much 8 | % smaller memory footprint to load (currently Matlab .mat files require 9 | % that entire variables be loaded rather than subsets). 10 | % 11 | % The auxilliary file is a NetCDF file. 12 | % 13 | % Examples: See bottom of file for example to create files in a batch. 14 | % 15 | % Author: John Paden 16 | % 17 | % See also: records_aux_files_create, records_aux_files_read, 18 | % records_create_sync 19 | 20 | error('This function is deprecated. Just use ct_save() since the NetCDF file is no longer used.'); 21 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/analysis_task_stats_kx.m: -------------------------------------------------------------------------------- 1 | function [data_kx] = analysis_task_stats_kx(param,cmd,data,start_bin,stop_bin) 2 | % [data_kx] = analysis_task_stats_kx(param,cmd,data,start_bin,stop_bin) 3 | % 4 | % Doppler/along-track wavenumber function for use with analysis task 5 | % command "statistics" that allows the Along-track kx wavenumber/Doppler 6 | % FFT to be averaged. 7 | % 8 | % Author: John Paden 9 | % 10 | % See also analysis.m 11 | 12 | data_kx = zeros(stop_bin(1)-start_bin(1)+1, cmd.kx); 13 | breaks = 1:cmd.kx:size(data,2); 14 | if size(data,2) - breaks(end) < cmd.kx 15 | % Remove incomplete end block 16 | breaks = breaks(end-1); 17 | end 18 | for break_idx = 1:length(breaks) 19 | data_kx = data_kx + abs(fft(data(start_bin(1):stop_bin(1), (break_idx-1)*cmd.kx + (1:cmd.kx)),[],2)).^2; 20 | end 21 | data_kx = data_kx / length(breaks); 22 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/interp1_robust.m: -------------------------------------------------------------------------------- 1 | function yi = interp1_robust(x,y,xi,varargin) 2 | % yi = interp1_robust(x,y,xi,varargin) 3 | % 4 | % Wrapper for interp1 that handles cases where x is empty or length 1. If 5 | % empty, NaN are returned. If length 1, then 'nearest' interpolation is 6 | % used. 7 | % 8 | % Examples: 9 | % interp1_robust([],[],[2.5 4]) 10 | % ans = 11 | % NaN NaN 12 | % interp1_robust([2],[5],[2.5 4]) 13 | % ans = 14 | % 5 5 15 | % interp1_robust([2 3],[5 6],[2.5 4],'linear','extrap') 16 | % ans = 17 | % 5.500000000000000 7.000000000000000 18 | % 19 | % Author: John Paden 20 | 21 | if isempty(x) 22 | yi = nan(size(xi)); 23 | elseif length(x) == 1 24 | yi = repmat(y,size(xi)); 25 | else 26 | if isempty(varargin) 27 | yi = interp1(x,y,xi); 28 | else 29 | yi = interp1(x,y,xi,varargin{:}); 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/gen_randn_wave.m: -------------------------------------------------------------------------------- 1 | function waveform = gen_randn_wave(N,corr_len,scale) 2 | % waveform = gen_randn_wave(N,corr_len,scale) 3 | % 4 | % Generates a real waveform from a Gaussian random process that is filtered 5 | % with a 3 dB bandwidth of 1/corr_length and is scaled by scale. Some 6 | % effort is taken to remove transients caused by the filtering process. 7 | % 8 | % N = number of samples in output waveform 9 | % corr_len = approx. correlation length of filter (used to compute the 10 | % filter's 3 dB bandwidth as 1/corr_len) 11 | % scale = output is scaled by this amount 12 | % 13 | % Author: John Paden 14 | 15 | [B_distort,A_distort] = butter(2,1/corr_len); 16 | Nt_distort = N + round(corr_len*2); 17 | waveform = filtfilt(B_distort,A_distort,scale*randn(Nt_distort,1)); 18 | waveform = waveform(1+round(corr_len*2):end); 19 | 20 | return; 21 | -------------------------------------------------------------------------------- /cresis-toolbox/display/lp.m: -------------------------------------------------------------------------------- 1 | function data = lp(data,method) 2 | % function data = lp(data,method) 3 | % 4 | % Log power plot 5 | % 6 | % data = n-d array of data 7 | % method = Optional scalar. 1 does 10*log10, 2 does 20*log10(abs()) 8 | % Default is: 9 | % If real data: 10 | % 10*log10(data) 11 | % If complex data: 12 | % 20*log10(abs(data)) 13 | % 14 | % imagesc(lp(data)); 15 | % 16 | % See also: inc_filt.m 17 | 18 | if ~exist('method','var') || isempty(method) 19 | if isreal(data) && all(data(~isnan(data)) >= 0) 20 | % Data is probably magnitude or power (real and non-negative) 21 | method = 1; 22 | else 23 | % Data is either real w/ negative values or complex 24 | method = 2; 25 | end 26 | end 27 | 28 | if method == 1 29 | data = 10*log10(abs(data)); 30 | else 31 | data = 20*log10(abs(data)); 32 | end 33 | 34 | return; 35 | 36 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/salinity_to_normality.m: -------------------------------------------------------------------------------- 1 | function normality = salinity_to_normality(salinity) 2 | % normality = salinity_to_normality(salinity) 3 | % 4 | % Returns normality given a salinity according to eqn E.20 in Ulaby, 5 | % Moore, Fung, Vol 3, Appendix E. 6 | % 7 | % salinity = salinity of the salt water solution 8 | % 9 | % Salinity is the total mass of solid salt in grams dissolved in one 10 | % kilogram of solution. Usually measured in parts per thousand on a weight 11 | % basis. 12 | % 13 | % Oceans have an average salinity of 32.54 parts per thousand. So 14 | % salinity = 0.03254. 15 | % 16 | % Author: John Paden 17 | % 18 | % See also brine.m, sea_ice.m, rock.m, salt_water.m, soil.m, water.m 19 | % and salinity_to_normality.m 20 | 21 | A = 0.9141; 22 | normality = A*salinity.*(1.707e-2 + 1.205e-5*salinity + 4.058e-9*salinity.^2); 23 | 24 | return; 25 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/geodetic_to_stereographic.m: -------------------------------------------------------------------------------- 1 | function [x,y,mstruct] = geodetic_to_stereographic(lat,lon,param) 2 | % [x,y,mstruct] = geodetic_to_stereographic(lat,lon,param) 3 | % 4 | % Converts from geodetic latitude/longitude to stereographic. Returns the 5 | % mstruct required to convert back and forth. 6 | % 7 | % lat = size X array (deg) 8 | % lon = size X array (deg) 9 | % 10 | % x = size X array (m) 11 | % y = size X array (m) 12 | % 13 | % Authors: John Paden 14 | % 15 | % See also: minvtran.m, mfwdtran.m 16 | 17 | mstruct = defaultm('ups'); 18 | if mean(lat(:)) > 0 19 | mstruct.zone = 'north'; 20 | else 21 | mstruct.zone = 'south'; 22 | end 23 | mstruct = defaultm(mstruct); 24 | mstruct.falsenorthing = 0; 25 | mstruct.falseeasting = 0; 26 | physical_constants; 27 | mstruct.geoid = WGS84.ellipsoid; 28 | 29 | [x,y] = mfwdtran(mstruct,lat,lon); 30 | 31 | return; 32 | -------------------------------------------------------------------------------- /cresis-toolbox/+utua_rds/fname_info_utua_rds.m: -------------------------------------------------------------------------------- 1 | function fname = fname_info_utua_rds(fn) 2 | % fname = fname_info_utua_rds(fn) 3 | % 4 | % Parses UTUA filename 5 | % 6 | % fn = UTUA RDS file name 7 | % 8 | % fname = structure containing each of the fields of the MCORDS 9 | % filename 10 | % 11 | % For example: 20180523-233532.tdms or 20180523-233532.mat 12 | % .datenum = time stamp converted to Matlab date number. Common 13 | % usage: "[year month day hour min sec] = datevec(fname.datenum)" 14 | % 15 | % Example 16 | % fn = 'E:\ct_tmp\headers\rds\2018_Alaska_SO\20180523\20180523-233532.mat'; 17 | % fname = utua_rds.fname_info_utua_rds(fn) 18 | % 19 | % Author: John Paden 20 | % 21 | % See also datenum 22 | 23 | [path name ext] = fileparts(fn); 24 | 25 | [day_str time_str] = strtok(name,'-'); 26 | 27 | fname.datenum = datenum([day_str time_str(2:end)],'yyyymmddHHMMSS'); 28 | -------------------------------------------------------------------------------- /cresis-toolbox/+sim/doa_nonlcon.m: -------------------------------------------------------------------------------- 1 | function [c,ceq] = doa_nonlcon(theta,theta_guard) 2 | % [c,ceq] = sim.doa_nonlcon(theta,theta_guard) 3 | % 4 | % Nonlinear constraint for DOA optimization. To be used with fmincon.m 5 | % 6 | % theta = vector of theta estimates (radians) 7 | % theta_guard = minimum distance between sources when optimizing 8 | % 9 | % c = nonlinear constraint that must satisfy <=0 10 | % ceq = nonlinear constraint that must satisfy == 0 11 | % 12 | % Author: John Paden, Theresa Stumpf 13 | % 14 | % See also: doa.m 15 | 16 | c = -1*ones(size(theta)); 17 | if length(theta) >= 2 18 | % If more than or equal to 2 sources, then enforce nonlinear constraint 19 | for theta_idx = 1:length(theta) 20 | c(theta_idx) = -(min(abs(theta(theta_idx) - theta([1:theta_idx-1 theta_idx+1:end]))) - theta_guard); 21 | end 22 | end 23 | 24 | ceq = zeros(size(theta)); 25 | 26 | end 27 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/monotonic_indexes.m: -------------------------------------------------------------------------------- 1 | function idxs = monotonic_indexes(A,strict) 2 | % idxs = monotonic_indexes(A,strict) 3 | % 4 | % idxs = monotonic_indexes([1 2 3 3 4 5],true) 5 | % idxs = monotonic_indexes([1 2 3 3 4 5],false) 6 | % idxs = monotonic_indexes([1 2 3 2 3 4 5],true) 7 | % idxs = monotonic_indexes([-inf 2 3 2 3 4 inf 5],true) 8 | % idxs = monotonic_indexes([NaN -inf 2 3 2 3 nan inf 5],true) 9 | 10 | mask = false(size(A)); 11 | cur_value = nan; 12 | if strict 13 | for idx = 1:length(A) 14 | if A(idx)>cur_value || ~isnan(A(idx)) && isnan(cur_value) 15 | cur_value = A(idx); 16 | mask(idx) = true; 17 | end 18 | end 19 | else 20 | for idx = 1:length(A) 21 | if A(idx)>=cur_value || ~isnan(A(idx)) && isnan(cur_value) 22 | cur_value = A(idx); 23 | mask(idx) = true; 24 | end 25 | end 26 | end 27 | idxs = find(mask); 28 | 29 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/doa_nonlcon.m: -------------------------------------------------------------------------------- 1 | function [c,ceq] = doa_nonlcon(theta,theta_guard) 2 | % [c,ceq] = sim.doa_nonlcon(theta,theta_guard) 3 | % 4 | % Nonlinear constraint for DOA optimization. To be used with fmincon.m 5 | % 6 | % theta = vector of theta estimates (radians) 7 | % theta_guard = minimum distance between sources when optimizing 8 | % 9 | % c = nonlinear constraint that must satisfy <=0 10 | % ceq = nonlinear constraint that must satisfy == 0 11 | % 12 | % Author: John Paden, Theresa Stumpf 13 | % 14 | % See also: doa.m 15 | 16 | c = -1*ones(size(theta)); 17 | if length(theta) >= 2 18 | % If more than or equal to 2 sources, then enforce nonlinear constraint 19 | for theta_idx = 1:length(theta) 20 | c(theta_idx) = -(min(abs(theta(theta_idx) - theta([1:theta_idx-1 theta_idx+1:end]))) - theta_guard); 21 | end 22 | end 23 | 24 | ceq = zeros(size(theta)); 25 | 26 | end 27 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/button_down.m: -------------------------------------------------------------------------------- 1 | function button_down(obj,src,event) 2 | % button_down(obj,src,event) 3 | % 4 | % Support function for echowin class. Called when a mouse button is pressed 5 | % when zoom mode is on and records click position and starts drawing the 6 | % rubber band. 7 | 8 | % Make sure that click is on the right side panel 9 | mouse_pos = get(obj.h_fig,'CurrentPoint'); 10 | uipanel_pos = get(obj.right_panel.handle,'Position'); 11 | if mouse_pos(1) < uipanel_pos(1) 12 | obj.click_x = []; 13 | obj.click_y = []; 14 | return 15 | end 16 | 17 | [x,y,but] = get_mouse_info(obj.h_fig,obj.h_axes); 18 | %fprintf('Echo Button Down: x = %.3f, y = %.3f, but = %d\n', x, y, but); 19 | obj.click_x = x; 20 | obj.click_y = y; 21 | 22 | if obj.alt_pressed || (obj.zoom_mode && but == 1) || (~obj.zoom_mode && but == 3) 23 | rbbox; % start drawing rubber band 24 | end 25 | 26 | return 27 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/noise_burst_removal.m: -------------------------------------------------------------------------------- 1 | noise_window = [3 1]; 2 | background_window = [11 51]; 3 | zero_window = [11 1]; 4 | threshold = 10^(13/10); 5 | 6 | for idx=1:size(data,3) 7 | 8 | background = fir_dec(abs(data(:,:,idx)).^2,ones(1,background_window(2))/background_window(2),1); 9 | background = fir_dec(background.',ones(1,background_window(1))/background_window(1),1).'; 10 | 11 | noise = fir_dec(abs(data(:,:,idx)).^2,ones(1,noise_window(2))/noise_window(2),1); 12 | noise = fir_dec(noise.',ones(1,noise_window(1))/noise_window(1),1).'; 13 | 14 | zero = noise > background*threshold; 15 | zero = fir_dec(zero,ones(1,zero_window(2))/zero_window(2),1); 16 | zero = fir_dec(zero.',ones(1,zero_window(1))/zero_window(1),1).'; 17 | zero(zero>0) = 1; 18 | 19 | fprintf('%.0f %.f\n', idx, sum(zero(:))); 20 | data(:,:,idx) = data(:,:,idx) .* ~zero; 21 | end 22 | 23 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/frame_id_comp.m: -------------------------------------------------------------------------------- 1 | function comp_result = frame_id_comp(frm_id1,frm_id2) 2 | % comp_result = frame_id_comp(frm_id1,frm_id2) 3 | % 4 | % Compares two frame IDs. Specifically built for building 5 | % binary searches of lists of sorted frame IDs. 6 | % 7 | % If frm_id1 is lower than frm_id2, then returns -1 8 | % If frm_id1 is equal to frm_id2, then returns 0 9 | % If frm_id1 is more than frm_id2, then returns 1 10 | % 11 | % Example: 12 | % frame_id_comp('20110316_01_000','20110406_02_392') 13 | % frame_id_comp('20110406_02_392','20110406_02_392') 14 | % frame_id_comp('20110406_02_392','20110316_01_000') 15 | % 16 | % Author: John Paden 17 | % 18 | % See also: picker.m (used by picker's binary search) 19 | 20 | comp = frm_id1 - frm_id2; 21 | diff_idx = find(comp~=0,1); 22 | if isempty(diff_idx) 23 | comp_result = 0; 24 | else 25 | comp_result = comp(diff_idx); 26 | end 27 | 28 | return; 29 | -------------------------------------------------------------------------------- /cresis-toolbox/+hfrds/write_hdr.m: -------------------------------------------------------------------------------- 1 | function bytes = write_hdr(fid,hdr) 2 | 3 | bytes=0; 4 | bytes=bytes+fwrite(fid,hdr.data_valid,'uint8'); 5 | bytes=bytes+2*fwrite(fid,hdr.fifo,'uint16'); 6 | bytes=bytes+4*fwrite(fid,hdr.epri,'uint32'); 7 | bytes=bytes+2*fwrite(fid,hdr.delay,'uint16'); 8 | bytes=bytes+fwrite(fid,hdr.gps,'uint8'); 9 | bytes=bytes+4*fwrite(fid,hdr.frac,'uint32'); 10 | bytes=bytes+2*fwrite(fid,hdr.pri,'uint16'); 11 | bytes=bytes+2*fwrite(fid,hdr.start,'uint16'); 12 | bytes=bytes+2*fwrite(fid,hdr.stop,'uint16'); 13 | bytes=bytes+2*fwrite(fid,hdr.words,'uint16'); 14 | bytes=bytes+fwrite(fid,hdr.bshft,'uint8'); 15 | bytes=bytes+fwrite(fid,hdr.dec,'uint8'); 16 | bytes=bytes+2*fwrite(fid,hdr.pre,'uint16'); 17 | bytes=bytes+4*fwrite(fid,hdr.nmea_frac,'uint32'); 18 | bytes=bytes+fwrite(fid,hdr.nmea,'uint8'); 19 | bytes=bytes+4*fwrite(fid,hdr.loc,'uint32'); 20 | bytes=bytes+4*fwrite(fid,hdr.next_loc,'uint32'); 21 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/@layerdata/callback_importPB.m: -------------------------------------------------------------------------------- 1 | function callback_importPB(obj,status,event) 2 | 3 | %% Get import directory 4 | % ========================================================================= 5 | folder_name = uigetdir(ct_filename_out(obj.param,obj.layerdata_source,[],1),'Choose layer data folder'); 6 | if isnumeric(folder_name) 7 | % User canceled in uigetdir 8 | return; 9 | end 10 | 11 | %% Load layers 12 | % ========================================================================= 13 | obj.gui_layers{end+1} = layerdata(obj.param,folder_name); 14 | obj.gui_layers{end}.check_layer_organizer(); 15 | obj.gui_layers{end}.check_all_frames(); 16 | 17 | %% Set auto-merge settings 18 | % ========================================================================= 19 | 20 | 21 | %% Update user interface 22 | % ========================================================================= 23 | obj.update_ui(); -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/run_plot_DEM.m: -------------------------------------------------------------------------------- 1 | % script run_plot_DEM 2 | % 3 | % Run script for tomo.plot_surf_geotiff 4 | % 5 | % Authors: Victor Berger, John Paden 6 | % 7 | % See also: plot_DEM.m 8 | 9 | param.radar_name = 'rds'; 10 | param.season_name = '2014_Greenland_P3'; 11 | param.DEM_source = 'DEM'; 12 | param.location = 'arctic'; 13 | param.day_seg = '20140401_03'; 14 | param.frm = 33; 15 | param.geotiff_fn = ct_filename_gis(param,fullfile('canada','Landsat-7','Canada_90m.tif')); 16 | 17 | global gRadar; 18 | 19 | % Input checking 20 | if exist('param_override','var') 21 | param_override = merge_structs(gRadar,param_override); 22 | else 23 | param_override = gRadar; 24 | end 25 | 26 | %% Automated section 27 | [fig_h, ax, cax] = tomo.plot_DEM(param,param_override, 'width', 800, 'height', 640,... 28 | 'crossover', 'on', 'title', 'on') 29 | 30 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonlab/examples/jsonlab_selftest.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Regression Test Unit of loadjson and savejson 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | 5 | for i=1:4 6 | fname=sprintf('example%d.json',i); 7 | if(exist(fname,'file')==0) break; end 8 | fprintf(1,'===============================================\n>> %s\n',fname); 9 | json=savejson('data',loadjson(fname)); 10 | fprintf(1,'%s\n',json); 11 | data=loadjson(json); 12 | end 13 | 14 | for i=1:4 15 | fname=sprintf('example%d.json',i); 16 | if(exist(fname,'file')==0) break; end 17 | fprintf(1,'===============================================\n>> %s\n',fname); 18 | json=saveubjson('data',loadjson(fname)); 19 | fprintf(1,'%s\n',json); 20 | data=loadubjson(json); 21 | savejson('',data) 22 | end 23 | -------------------------------------------------------------------------------- /cresis-toolbox/hardware/getNAcal.m: -------------------------------------------------------------------------------- 1 | function calArray = takeNAcal(obj,Sparam_flag) 2 | % calArray = takeNAcal(obj,Sparam_flag) 3 | % 4 | % obj is gpib object already opened 5 | % 6 | % Typical usage: 7 | % getNAdata(1,1); 8 | % putNAsettings(NA) 9 | % putNAcal(NA.calArray) 10 | 11 | % 8722C 12 | 13 | fprintf(obj,'FORM5;'); 14 | 15 | if Sparam_flag == 0 16 | total_cal_params = 12; 17 | else 18 | total_cal_params = 3; 19 | end 20 | 21 | for ind = 1:total_cal_params 22 | sprintf('OUTPCALC%02.0f;',ind); 23 | fprintf(obj,sprintf('OUTPCALC%02.0f;',ind)); 24 | char(fread(obj,2,'char')); 25 | len = fread(obj,1,'uint16')/8; 26 | if len == 0 27 | fprintf('Calibration not available\n'); 28 | calArray = []; 29 | return; 30 | end 31 | tmp = fread(obj,2*len,'float32'); 32 | tmp = reshape(tmp,[2 len]).'; 33 | calArray(:,ind) = tmp(:,1) + j*tmp(:,2); 34 | end 35 | 36 | return; 37 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/ni_xml_name_encode.m: -------------------------------------------------------------------------------- 1 | function name_enc = ni_xml_name_encode(name) 2 | % name_enc = ni_xml_name_encode(name) 3 | % 4 | % Letters and Numbers pass unencoded 5 | % All other letters are encoded as: 6 | % ZHH 7 | % where HH is the hexidecimal representation of the ASCII value for 8 | % that letter. 9 | % 10 | % Author: John Paden 11 | % 12 | % See also: print_ni_xml_object.m, ni_xml_name_decode.m, 13 | % ni_xml_name_encode.m, read_ni_xml_object.m, write_ni_xml_object.m 14 | 15 | name_enc = ''; 16 | out_idx = 0; 17 | for idx = 1:length(name) 18 | if (name(idx) >= 'A' && name(idx) <= 'Y') ... 19 | || (name(idx) >= 'a' && name(idx) <= 'z') 20 | out_idx = out_idx + 1; 21 | name_enc(out_idx) = name(idx); 22 | else 23 | out_idx = out_idx + 1; 24 | name_enc(out_idx:out_idx+2) = sprintf('Z%s', dec2hex(name(idx))); 25 | out_idx = out_idx + 2; 26 | end 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/convert_mat_version.m: -------------------------------------------------------------------------------- 1 | function convert_mat_version(fn,file_ver) 2 | % convert_mat_version(fn,file_ver) 3 | % 4 | % Convert mat files to specified version. Default file_ver is '-v7.3'. 5 | % fn can be a directory in which case all .mat files in that directory will 6 | % be converted. 7 | % 8 | % Example: 9 | % convert_mat_version('/cresis/snfs1/data/MCoRDS/BAS/20170122/'); 10 | 11 | if nargin < 2 12 | file_ver = '-v7.3'; 13 | end 14 | 15 | if exist(fn,'dir') 16 | fns = get_filenames(fn,'','','.mat',struct('recursive',true)); 17 | for fn_idx = 1:length(fns) 18 | fn = fns{fn_idx}; 19 | convert_mat_version(fn,file_ver) 20 | end 21 | return; 22 | end 23 | 24 | tmp = load(fn); 25 | fn_tmp = fullfile(tempdir,fn); 26 | fprintf('%s\n => %s\n', fn, fn_tmp); 27 | movefile(fn,fn_tmp); 28 | fprintf(' %s: %s\n', file_ver, fn); 29 | save(fn,file_ver,'-struct','tmp'); 30 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@mapwin/get_google_map.m: -------------------------------------------------------------------------------- 1 | % get_google_map returns a Google Static Map depending on the map_zone 2 | % selected and centered at the default lat lon set for the map_zone 3 | function A = get_google_map(obj) 4 | 5 | %% Setting default lat lon depending on the map_zone 6 | if strcmpi('arctic', obj.map_pref.settings.map_zone) 7 | c_lat = 73.82177; 8 | c_lon = -40.333279; 9 | zoom = 3; 10 | else 11 | % Antarctica 12 | c_lat = -73.381418; 13 | c_lon = -67.900671; 14 | zoom = 3; 15 | end 16 | 17 | % Creating a Picker Google Map object 18 | googleObj = imb.picker_google_map; 19 | 20 | % Requesting a Google Staic Map from the server 21 | googleObj = imb.request_google_map(googleObj, c_lat, c_lon, zoom); 22 | 23 | % Updating the map object 24 | obj.googleObj = googleObj; 25 | 26 | % Returning the Map 27 | A = obj.googleObj.A; 28 | end -------------------------------------------------------------------------------- /cresis-toolbox/utility/robust_system.m: -------------------------------------------------------------------------------- 1 | function [status,result] = robust_system(cmd) 2 | 3 | status = -1; 4 | attempts = 0; 5 | while status ~= 0 6 | try 7 | [status,result] = system(cmd); 8 | catch ME 9 | ME.getReport 10 | cmd 11 | warning('system call failed'); 12 | keyboard 13 | end 14 | if status ~= 0 15 | warning('%s\n FAILED %d %s', cmd, status, result); 16 | attempts = attempts + 1; 17 | delay_period = 3*2^(attempts-1); 18 | if delay_period > 120 19 | delay_period = 120; 20 | end 21 | fprintf(' Delaying %d seconds (%s)\n', delay_period, datestr(now)); 22 | pause(delay_period); 23 | if attempts > 10 24 | warning('There is potentially something wrong with the system command if it fails this many times. Look into it before running "dbcont". system command is:\n %s', cmd); 25 | keyboard; 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/xaxisPM_callback.m: -------------------------------------------------------------------------------- 1 | function xaxisPM_callback(obj,hObj,event) 2 | % echowin.xaxisPM_callback(obj,hObj,event) 3 | % 4 | % Callback for x-axis popup menu 5 | 6 | % Ensure focus stays on figure to prevent hotkeys registering with this 7 | % uicontrol. 8 | uicontrol(obj.right_panel.status_panel.statusText); 9 | 10 | cur_axis = axis(obj.h_axes); 11 | cur_xaxis_gps = interp1(obj.eg.image_xaxis,obj.eg.image_gps_time, ... 12 | cur_axis([1,2]),'linear','extrap'); 13 | 14 | obj.plot_echogram(obj.eg.image_gps_time(1),obj.eg.image_gps_time(end),-inf,inf); 15 | obj.plot_layers(); 16 | obj.plot_crossovers(); 17 | obj.plot_cursors(); 18 | 19 | %% Set layer and cross over visibility 20 | obj.set_visibility(); 21 | 22 | % apply original axis limits 23 | new_xlim = interp1(obj.eg.image_gps_time,obj.eg.image_xaxis,... 24 | cur_xaxis_gps,'linear','extrap'); 25 | xlim(obj.h_axes,new_xlim); 26 | ylim(obj.h_axes,cur_axis([3,4])); 27 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@picktool_interpolate/interpolate.m: -------------------------------------------------------------------------------- 1 | function [vals x_new] = interpolate(obj,x_old,y_old,x_new) 2 | % 3 | % Interpolate for picktool_enter 4 | % 5 | 6 | tool_idx = get(obj.panel.interp_mode_pdmenu,'Value'); 7 | 8 | if length(x_old) ~= length(unique(x_old)) 9 | % This is technically okay, but it is probably caused by a bug elsewhere 10 | % (i.e. generally we do not want to points with the same GPS time). 11 | % Type "dbcont" to continue. 12 | warning('Two points were found with exactly the same GPS time.'); 13 | [x_old unique_idxs] = unique(x_old); 14 | y_old = y_old(unique_idxs); 15 | end 16 | 17 | switch tool_idx 18 | case 1 % linear interpolate 19 | vals = interp1(x_old,y_old,x_new,'linear','extrap'); 20 | case 2 % spline interpolate 21 | vals = interp1(x_old,y_old,x_new,'spline','extrap'); 22 | case 3 % max track interpolate 23 | 24 | case 4 % leading edge track interpolate 25 | 26 | end -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/sourceLB_callback.m: -------------------------------------------------------------------------------- 1 | function sourceLB_callback(obj,hObj,event) 2 | 3 | % Ensure focus stays on figure to prevent hotkeys registering with this 4 | % uicontrol. 5 | uicontrol(obj.right_panel.status_panel.statusText); 6 | 7 | if strcmpi(get(obj.h_fig,'SelectionType'),'open') 8 | % Double click 9 | % - On a double click, the callback is called twice: once with 10 | % 'normal' SelectionType and then with 'open'. 11 | % - On double click, load the selection to the picking window 12 | 13 | cur_axis = axis(obj.h_axes); 14 | 15 | % Convert x_min, x_max to GPS time 16 | xlims = interp1(obj.eg.image_xaxis,obj.eg.image_gps_time,cur_axis(1:2),'linear','extrap'); 17 | 18 | % Draw data with new axis 19 | obj.redraw(xlims(1),xlims(2),cur_axis(3),cur_axis(4),struct('clipped',3)); 20 | 21 | else 22 | % Regular click 23 | %gCtrl.source.cur_src = get(hui.fig.ctrl_panel.sourceLB,'Value'); 24 | end 25 | -------------------------------------------------------------------------------- /cresis-toolbox/+hfrds/run_create_records.m: -------------------------------------------------------------------------------- 1 | % script hfrds.run_create_records 2 | % 3 | % Script for running hfrds.create_records (usually just used for debugging). 4 | % 5 | % Authors: John Paden 6 | % 7 | % See also: run_master.m, master.m, hfrds.run_create_records.m, hfrds.create_records.m 8 | 9 | % ===================================================================== 10 | % Debug Setup 11 | % ===================================================================== 12 | param = read_param_xls(ct_filename_param('rds_param_2016_Greenland_G1XB.xls'),'20160413_01'); 13 | 14 | clear('param_override'); 15 | dbstop if error 16 | param_override.sched.type = 'no scheduler'; 17 | param_override.sched.rerun_only = true; 18 | 19 | % Input checking 20 | global gRadar; 21 | if exist('param_override','var') 22 | param_override = merge_structs(gRadar,param_override); 23 | else 24 | param_override = gRadar; 25 | end 26 | 27 | hfrds.create_records(param,param_override); 28 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/get_mouse_info.m: -------------------------------------------------------------------------------- 1 | function [x,y,but] = get_mouse_info(h,h_axis) 2 | % [x,y,but] = get_mouse_info(h,h_axis) 3 | % 4 | % Gets information about the latest mouse/key event. 5 | % Useful for callback functions. 6 | % 7 | % h = figure where click happened (can be empty) 8 | % h_axis = axes where click happened 9 | % 10 | % x,y = position in axes 11 | % but = state of button press (not valid when h is empty or 12 | % when a mouse button was not pressed) 13 | 14 | % Get mouse position 15 | mouse_pos = get(h_axis,'CurrentPoint'); 16 | x = mouse_pos(1,1); 17 | y = mouse_pos(1,2); 18 | if ~isempty(h) 19 | % Get mouse button 20 | if strcmpi(get(h,'SelectionType'),'normal') 21 | but = 1; 22 | elseif strcmpi(get(h,'SelectionType'),'extend') 23 | but = 2; 24 | elseif strcmpi(get(h,'SelectionType'),'alt') 25 | but = 3; 26 | elseif strcmpi(get(h,'SelectionType'),'open') 27 | but = 4; 28 | end 29 | end 30 | 31 | return; 32 | 33 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@mapwin/check_limits.m: -------------------------------------------------------------------------------- 1 | function outside_limits = check_limits(obj,xaxis,yaxis,dir) 2 | % outside_limits = check_limits(obj,xaxis,yaxis,dir) 3 | % 4 | % Support function to make sure the current map view field's limits are 5 | % reasonably far away from the maximum x/y limits. 6 | % dir is a char with a value of either 'u', 'd', 'l', 'r' corresponding to 7 | % the direction of the map window's requested movement. 8 | 9 | x_extent = diff(xaxis); 10 | y_extent = diff(yaxis); 11 | 12 | switch dir 13 | case 'u' 14 | outside_limits = abs(diff([yaxis(end) obj.map.yaxis_default(end)])) <= y_extent*0.05; 15 | case 'd' 16 | outside_limits = abs(diff([yaxis(1) obj.map.yaxis_default(1)])) <= y_extent*0.05; 17 | case 'l' 18 | outside_limits = abs(diff([xaxis(1) obj.map.xaxis_default(1)])) <= x_extent*0.05; 19 | case 'r' 20 | outside_limits = abs(diff([xaxis(end) obj.map.xaxis_default(end)])) <= x_extent*0.05; 21 | end 22 | 23 | return; -------------------------------------------------------------------------------- /bash/watch_cpu_mem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TOTAL_MEM=`free | awk 'NR==2 {print $2}'` 4 | 5 | user=`whoami` 6 | LOG_FILE=/tmp/watch_cpu_mem.$USER.log 7 | 8 | while (( 1 )) 9 | do 10 | clear 11 | printf "Writing to file %s\n" $LOG_FILE 12 | ps -C MATLAB,hf3d,hfss,worker_task,java,httpd,postmaster,cluster_job -o "comm,user,rss,cputime,pid,pcpu" | awk -v total_mem=$TOTAL_MEM 'NR==1 {printf "%10s %10s %10s %10s %10s %10s %10s\n", $1, $2, $3, "%MEM", $4, $5, $6;} NR>1 {printf "%10s %10s %10.1f %10.0f%% %10s %10d %10.1f\n", $1, $2, $3/1024/1024, $3/total_mem*100, $4, $5, $6}' 13 | date >>$LOG_FILE 14 | ps -C MATLAB,hf3d,hfss,worker_task,java,httpd,postmaster,cluster_job -o "comm,user,rss,cputime,pid,pcpu" | awk -v total_mem=$TOTAL_MEM 'NR==1 {printf "%10s %10s %10s %10s %10s %10s %10s\n", $1, $2, $3, "%MEM", $4, $5, $6;} NR>1 {printf "%10s %10s %10.1f %10.0f%% %10s %10d %10.1f\n", $1, $2, $3/1024/1024, $3/total_mem*100, $4, $5, $6}' >>$LOG_FILE 15 | sleep 1 16 | done 17 | 18 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@prefwin/layers_callback_new.m: -------------------------------------------------------------------------------- 1 | function layers_callback_new(obj,status,event) 2 | % imb.prefwin.layers_callback_new(obj,status,event) 3 | % 4 | % Support function for layers_callback new layer dialog box 5 | 6 | h_children = get(get(status,'UserData'),'Children'); 7 | name = get(h_children(7),'String'); 8 | group = get(h_children(5),'String'); 9 | description = get(h_children(3),'String'); 10 | 11 | if ~isempty(name) 12 | % Get the system that is currently selected 13 | system_name = get(obj.h_gui.systemsLB,'String'); 14 | system_name = system_name{get(obj.h_gui.systemsLB,'Value')}; 15 | 16 | ops_param.properties.lyr_name = name; 17 | ops_param.properties.lyr_group_name = group; 18 | ops_param.properties.lyr_description = description; 19 | ops_param.properties.public = true; 20 | 21 | [status,data] = opsCreateLayer(system_name,ops_param); 22 | 23 | obj.layers_callback_refresh(); 24 | end 25 | 26 | uiresume(gcbf); 27 | 28 | end 29 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/find_modes.m: -------------------------------------------------------------------------------- 1 | function modes = find_modes(pdf,num_modes) 2 | % modes = find_modes(pdf,num_modes) 3 | % 4 | % Finds the modes of a pdf or waveform up to a maximum of num_modes. 5 | % The num_modes largest modes are returned. 6 | % 7 | % pdf = vector representing pdf or waveform 8 | % num_modes = positive integer 9 | % modes = the indices into the pdf vector 10 | % 11 | % Author: John Paden 12 | 13 | modes = []; 14 | upwards = true; 15 | pdf = [pdf(:); pdf(1)]; 16 | for idx = 2:length(pdf) 17 | if pdf(idx) < pdf(idx-1) && upwards 18 | modes = [modes, idx-1]; 19 | upwards = false; 20 | end 21 | if pdf(idx) > pdf(idx-1) && ~upwards 22 | upwards = true; 23 | end 24 | end 25 | [vals idxs] = sort(pdf(modes),'descend'); 26 | if length(idxs) < num_modes 27 | % Special case when not enough modes were found 28 | modes = modes([idxs ones(1,num_modes-length(idxs))]); 29 | else 30 | modes = modes(idxs(1:num_modes)); 31 | end 32 | 33 | return; 34 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/utility/opsUpdateMaterializedView.m: -------------------------------------------------------------------------------- 1 | function [status,message] = opsUpdateMaterializedView(update) 2 | 3 | % REFRESH MATERIALIZED VIEW xxx; on the database. 4 | % 5 | % Input: 6 | % update: (string) an SQL clause 'REFRESH MATERIALIZED VIEW xxx' 7 | % 8 | % Output: 9 | % status: (integer) 0:error 1:success 10 | 11 | % Author: Weibo Liu 12 | 13 | % INITIATE THE DATABASE TRANSACTION 14 | opsCmd; 15 | if gOps.profileCmd 16 | [jsonResponse,~] = opsUrlRead(strcat(gOps.serverUrl,'profile'),gOps.dbUser,gOps.dbPswd,... 17 | 'Post',{'query' update 'view' 'updateMaterializedView'}); 18 | else 19 | [jsonResponse,~] = opsUrlRead(strcat(gOps.serverUrl,'updateMaterializedView'),gOps.dbUser,gOps.dbPswd,... 20 | 'Post',{'query' update}); 21 | end 22 | 23 | % DECODE THE SERVER RESPONSE 24 | [status,decodedJson] = jsonResponseDecode(jsonResponse); 25 | 26 | % CREATE THE DATA OUPUT STRUCTURE OR MESSAGE 27 | message = decodedJson; 28 | return -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/read_param_xls_text.m: -------------------------------------------------------------------------------- 1 | function [out] = read_param_xls_text(row,col,num,txt) 2 | % [out] = read_param_xls_text(row,col,num,txt) 3 | % 4 | % Text Cell Read Function 5 | % 6 | % Support function for read_param_xls_* 7 | % 8 | % See also: ct_set_params, master, read_param_xls 9 | % 10 | % See also for spreadsheet cell loading: 11 | % read_param_xls_boolean.m, read_param_xls_general.m, 12 | % read_param_xls_text.m 13 | % 14 | % See also for worksheet loading: 15 | % read_param_xls_generic.m, read_param_xls_radar.m: 16 | % 17 | % See also for printing out spreadsheet to stdout: 18 | % read_param_xls_print, read_param_xls_print_headers.m 19 | 20 | if size(num,1) >= row && size(num,2) >= col && ~isnan(num(row,col)) 21 | error('Cell (%d,%d)/(%d,%s) must be text (use '' before the number)\n', row, col, row, 'A'+col-1); 22 | end 23 | if size(txt,1) < row || size(txt,2) < col 24 | out = ''; 25 | else 26 | out = txt{row,col}; 27 | end 28 | 29 | 30 | return 31 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/epoch_to_gps_sow.m: -------------------------------------------------------------------------------- 1 | function [sow,gps_week] = epoch_to_gps_sow(time) 2 | % [sow,gps_week] = epoch_to_gps_sow(time) 3 | % 4 | % Converts from seconds since the Jan 1, 1970 epoch to GPS seconds 5 | % of the week. The mod 1024 on GPS week is not done. 6 | % 7 | % time = seconds since Jan 1, 1970 epoch 8 | % 9 | % sow = GPS seconds of the week 10 | % gps_week = GPS week 11 | % 12 | % Author: John Paden 13 | % 14 | % See also epoch_to_datenum.m, datenum_to_epoch.m, epoch_to_gps_sow.m, 15 | % epoch_to_sod.m, sod_to_epoch.m, gps_sow_to_epoch.m, utc_leap_seconds.m, 16 | % gps_to_utc.m, utc_to_gps.m 17 | 18 | % GPS weeks started counting Jan 6, 1980 19 | start_GPS = datenum(1980,1,06); 20 | 21 | % Current time is: 22 | cur_GPS = epoch_to_datenum(time); 23 | 24 | gps_week = floor((cur_GPS-start_GPS)/7); 25 | 26 | % Find the beginning of the current GPS week 27 | ref_GPS = cur_GPS - mod(cur_GPS-start_GPS,7); 28 | 29 | sow = (cur_GPS-ref_GPS) * 86400; 30 | 31 | return; 32 | -------------------------------------------------------------------------------- /cresis-toolbox/+sim/sim.crosstrack_rmse.m: -------------------------------------------------------------------------------- 1 | function RMSE = crosstrack_rmse(param,results) 2 | % RMSE = sim.crosstrack_rmse(param,results) 3 | % 4 | % Compute root mean squared error (RMSE) for each source from sim.doa 5 | % param and results. 6 | % 7 | % RMSE(method,test index,source index) 8 | % 9 | % Author: John Paden, Theresa Stumpf 10 | % 11 | % See also: crosstrack.m, crosstrack_example.m 12 | 13 | RMSE = zeros(length(param.method.list),size(results.theta_est{param.method.list(1)},2), ... 14 | size(results.theta_est{param.method.list(1)},3)); 15 | 16 | for method_idx = 1:length(param.method.list) 17 | method = param.method.list(method_idx); 18 | for test_idx = 1:size(results.theta_est{method},2) 19 | for src_idx = 1:size(results.theta_est{method},3) 20 | RMSE(method_idx,test_idx,src_idx) ... 21 | = sqrt(mean(abs(results.theta_est{method}(:,test_idx,src_idx)*180/pi - param.monte.DOA(test_idx,src_idx)).^2)); 22 | end 23 | end 24 | end 25 | 26 | return 27 | -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/+parameter_tuning/+helper_functions/compute_hit_ratios.m: -------------------------------------------------------------------------------- 1 | function [ stats_struct ] = compute_hit_ratios( stats_struct ) 2 | % compute the hit ratios: how much the errors (predicted value vs. ground 3 | % truth) are within certain numbers (e.g. 5 or 10 or 15 or ...) 4 | 5 | % input: 6 | % stats_struct: a structure used for statistics purposes (after 7 | % hyperparameters tests) 8 | 9 | dl = length(stats_struct.total_diff); 10 | hit_ratios = [0 5 10 15 20 25]; 11 | 12 | ratios = []; 13 | 14 | for i = hit_ratios 15 | if i == 0 16 | less_than_x = stats_struct.total_diff(abs(stats_struct.total_diff) == i); 17 | else 18 | less_than_x = stats_struct.total_diff(abs(stats_struct.total_diff) < i); 19 | end 20 | hits = length(less_than_x); 21 | hit_ratio = hits/dl; 22 | ratios = [ratios hit_ratio]; 23 | end 24 | 25 | stats_struct.hit_ratios = ratios; 26 | end 27 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonWrapper.m: -------------------------------------------------------------------------------- 1 | function outData = jsonWrapper(data) 2 | % 3 | % outData = jsonWrapper(data) 4 | % 5 | % Wraps the loadjson output to match fromjson 6 | % 7 | % Input: 8 | % data: data from old json (loadjson) 9 | % 10 | % Output: 11 | % new_data: same as data, but in fromjson format. 12 | % 13 | % Author: Haiji Wang, Kyle W. Purdon 14 | 15 | if ischar(data) 16 | outData = cell(1,size(data,1)); 17 | for idx = 1:size(data,1) 18 | outData{idx} = data(idx,:); 19 | end 20 | elseif isnumeric(data) 21 | data = data.'; 22 | outData = cell(size(data)); 23 | for idx = 1:numel(data) 24 | outData{idx} = data(idx); 25 | end 26 | elseif iscell(data) 27 | if iscell(data{1}) 28 | outData = cell(size(data{1},2),size(data,2)); 29 | for result_idx = 1:size(data,2) 30 | for field_idx = 1:size(data{1},2) 31 | outData{field_idx,result_idx} = data{result_idx}{field_idx}; 32 | end 33 | end 34 | end 35 | end 36 | return; 37 | -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonlab/mergestruct.m: -------------------------------------------------------------------------------- 1 | function s=mergestruct(s1,s2) 2 | % 3 | % s=mergestruct(s1,s2) 4 | % 5 | % merge two struct objects into one 6 | % 7 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 8 | % date: 2012/12/22 9 | % 10 | % input: 11 | % s1,s2: a struct object, s1 and s2 can not be arrays 12 | % 13 | % output: 14 | % s: the merged struct object. fields in s1 and s2 will be combined in s. 15 | % 16 | % license: 17 | % BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details 18 | % 19 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 20 | % 21 | 22 | if(~isstruct(s1) || ~isstruct(s2)) 23 | error('input parameters contain non-struct'); 24 | end 25 | if(length(s1)>1 || length(s2)>1) 26 | error('can not merge struct arrays'); 27 | end 28 | fn=fieldnames(s2); 29 | s=s1; 30 | for i=1:length(fn) 31 | s=setfield(s,fn{i},getfield(s2,fn{i})); 32 | end 33 | 34 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/ni_xml_name_decode.m: -------------------------------------------------------------------------------- 1 | function name = ni_xml_name_decode(name_enc) 2 | % name = ni_xml_name_decode(name_enc) 3 | % 4 | % Letters and Numbers pass undecoded EXCEPT 'Z' 5 | % All other letters are decoded as: 6 | % ZHH 7 | % where HH is the hexidecimal representation of the ASCII value for 8 | % that letter. Therefore "Z20" gets decoded into a space character " ". 9 | % 10 | % Author: John Paden 11 | % 12 | % See also: print_ni_xml_object.m, ni_xml_name_decode.m, 13 | % ni_xml_name_encode.m, read_ni_xml_object.m, write_ni_xml_object.m 14 | 15 | name = ''; 16 | idx = 1; 17 | out_idx = 0; 18 | while idx <= length(name_enc) 19 | out_idx = out_idx + 1; 20 | if (name_enc(idx) >= 'A' && name_enc(idx) <= 'Y') ... 21 | || (name_enc(idx) >= 'a' && name_enc(idx) <= 'z') 22 | name(out_idx) = name_enc(idx); 23 | idx = idx + 1; 24 | else 25 | name(out_idx) = sprintf('%s', char(hex2dec(name_enc(idx+(1:2))))); 26 | idx = idx + 3; 27 | end 28 | end 29 | 30 | end 31 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/records_aux_files_read.m: -------------------------------------------------------------------------------- 1 | function [records] = records_aux_files_read(records_fn,recs) 2 | % DEPRECATED 3 | % 4 | % [records] = records_aux_files_read(records_fn,recs) 5 | % 6 | % Reads specific fields out of the auxilliary netcdf file for processing. 7 | % The netcdf file is used because subsets of variables can be loaded. 8 | % 9 | % recs = 2x1 vector [start record, stop record] 10 | % Set stop record to inf to read to end of file 11 | % "inf" can be used for start or stop record to mean last record 12 | % 13 | % Examples: 14 | % records_fn = '/cresis/projects/dev/csarp_support/records/kuband2/2012_Greenland_P3/records_20120421_01.mat'; 15 | % records = records_aux_files_read(records_fn,[1 4000]); 16 | % check = load(records_fn); 17 | % 18 | % Author: John Paden 19 | % 20 | % See also: records_aux_files_create, records_aux_files_read, 21 | % records_create_sync 22 | 23 | error('This function is deprecated. Use records_load.m instead because NetCDF file is no longer used.'); 24 | -------------------------------------------------------------------------------- /cresis-toolbox/utility/make_small_photos_for_blog.m: -------------------------------------------------------------------------------- 1 | fn_dir = 'C:\Users\dangermo\Documents\Travel\Antarctica_2013\BLOG\combined'; 2 | 3 | [tmp fn_dir_name] = fileparts(fn_dir); 4 | out_fn_dir = fullfile(fn_dir,sprintf('%s_lowres', fn_dir_name)); 5 | if ~exist(out_fn_dir,'dir') 6 | mkdir(out_fn_dir); 7 | end 8 | 9 | fns = get_filenames(fn_dir,'','','*.jpg'); 10 | 11 | max_file_size = 250e3; 12 | 13 | for idx = 1:length(fns) 14 | fn = fns{idx}; 15 | [tmp fn_name fn_ext] = fileparts(fn); 16 | out_fn = fullfile(out_fn_dir, [fn_name fn_ext]); 17 | fprintf('%s to %s\n', fn, out_fn); 18 | A = imread(fn); 19 | A = imresize(A,0.5); 20 | imagesc(A); 21 | axis equal; 22 | pause 23 | done = false; 24 | quality = 80; 25 | while ~done 26 | imwrite(A,out_fn,'Quality',quality); 27 | finfo = dir(out_fn); 28 | if finfo.bytes > max_file_size && quality > 0 29 | quality = quality - 1; 30 | else 31 | done = true; 32 | end 33 | end 34 | end 35 | 36 | return; 37 | -------------------------------------------------------------------------------- /cresis-toolbox/+sim/doa_rmse.m: -------------------------------------------------------------------------------- 1 | function RMSE = doa_rmse(param,results) 2 | % RMSE = sim.doa_rmse(param,results) 3 | % 4 | % Compute root mean squared error (RMSE) for each source from sim.doa 5 | % param and results. 6 | % 7 | % RMSE(method,test index,source index) 8 | % 9 | % Author: John Paden, Theresa Stumpf 10 | % 11 | % See also: doa.m, doa_example.m 12 | method_idx = 1:length(param.method.list); 13 | 14 | RMSE = zeros(length(method_idx),size(results.theta_est{method_idx(1)},2), ... 15 | size(results.theta_est{method_idx(1)},3)); 16 | 17 | for method_idx = 1:length(param.method.list) 18 | for test_idx = 1:size(results.theta_est{method_idx},2) 19 | for src_idx = 1:size(results.theta_est{method_idx},3) 20 | Err = abs(results.theta_est{method_idx}(:,test_idx,src_idx)*180/pi - param.monte.DOA(test_idx,src_idx)); 21 | sigma = std(Err(~isnan(Err))); 22 | Err(Err > inf*sigma) = 0; 23 | RMSE(method_idx,test_idx,src_idx) = sqrt(mean(abs(Err).^2)); 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/customverctrl.m: -------------------------------------------------------------------------------- 1 | function customverctrl(fileNames, arguments) 2 | 3 | action = arguments{strcmp('action',arguments(:,1)),2}; 4 | 5 | if ~strcmp(action,'checkin') 6 | return; 7 | end 8 | 9 | sys_cmd = sprintf('svn status %s', fileNames{1}) 10 | fprintf(' running %s\n', sys_cmd); 11 | [status,result] = system(sys_cmd); 12 | 13 | comments = arguments{strcmp('comments',arguments(:,1)),2}; 14 | if result(1) == '?' 15 | sys_cmd = sprintf('svn add %s', fileNames{1}) 16 | fprintf(' running %s\n', sys_cmd); 17 | [status,result] = system(sys_cmd); 18 | sys_cmd = sprintf('svn ci --message "%s" %s', comments, fileNames{1}) 19 | fprintf(' running %s\n', sys_cmd); 20 | system(sys_cmd); 21 | elseif result(1) == 'A' || result(1) == 'M' 22 | sys_cmd = sprintf('svn ci --message "%s" %s', comments, fileNames{1}) 23 | fprintf(' running %s\n', sys_cmd); 24 | system(sys_cmd); 25 | else 26 | fprintf('Does not need to be checked in:\n %s', result); 27 | end 28 | 29 | return 30 | 31 | -------------------------------------------------------------------------------- /cresis-toolbox/+tomo/+parameter_tuning/user_settings_trws_grid_3D.m: -------------------------------------------------------------------------------- 1 | %% data setup 2 | 3 | % Here, we select the source data and the reference (i.e. ground truth/manually 4 | % picked data) for the grid or random search we'd like to test on 5 | 6 | param.radar_name = 'rds'; 7 | param.season_name = '2014_Greenland_P3'; 8 | param.out_type = 'CSARP_post/music3D'; 9 | param.surfdata_source = 'CSARP_post/surfData'; 10 | bounds_relative = [3 2 0 0]; 11 | 12 | % Put the segment and frame in a "hash map" 13 | % The key is the segment 14 | % The values with respect to the key are the frames under that segment 15 | 16 | segments_and_frame = containers.Map; 17 | % segments_and_frame('20140325_06') = [1]; 18 | % segments_and_frame('20140325_07') = [5]; 19 | % segments_and_frame('20140401_03') = [33 34 35]; 20 | segments_and_frame('20140506_01') = [46]; 21 | 22 | %% parameter setup 23 | 24 | TRWS_param.correlation = [10 14 15]; 25 | TRWS_param.smooth_1 = [ 20 ]; 26 | TRWS_param.smooth_2 = [ 20 ]; 27 | TRWS_param.smooth_3 = [ 30 ]; -------------------------------------------------------------------------------- /cresis-toolbox/icards/create_records_icards_dealwithNaN.m: -------------------------------------------------------------------------------- 1 | function time_after=dealwithNaN(time_before) 2 | % This function is to fill those NaN time points. A NaN is replaced by its 3 | % previous time points. This will generate consequtive same time points 4 | % wihch will be dealt with time points interpolation in another function. If 5 | % a file contains only NaN time points, it will be regarded as invalid file 6 | % and ignored instead of data repair.This function is called by 7 | % create_records_icards.m. 8 | % Note: NaNs is filled and interpolated when creating records while it is 9 | % just masked out when creating GPS files (i.e. delete those NaN 10 | % points).---qishi 11 | if isnan(time_before(1))% fix the first time point if it is a NaN 12 | time_before(1)=time_before(find(~isnan(time_before),1)); 13 | end 14 | 15 | while any(isnan(time_before)) 16 | idx=find(isnan(time_before),1); 17 | time_before(idx)=time_before(idx-1); 18 | end 19 | 20 | time_after=time_before; 21 | 22 | end -------------------------------------------------------------------------------- /cresis-toolbox/hardware/putNAcal.m: -------------------------------------------------------------------------------- 1 | function putNAcal(calArray) 2 | % putNAcal(calArray) 3 | % 4 | % Typical usage: 5 | % getNAdata(1,1); 6 | % putNAsettings(NA) 7 | % putNAcal(NA.calArray) 8 | 9 | format long; format compact; 10 | 11 | % 8722C 12 | 13 | global obj; 14 | obj = gpib('ni',0,16); 15 | set(obj,'InputBufferSize',2*1601*8); 16 | set(obj,'OutputBufferSize',2*1601*8); 17 | set(obj,'Timeout',100); 18 | 19 | fopen(obj); 20 | 21 | fprintf(obj,'*IDN?'); 22 | idn = fscanf(obj) 23 | 24 | fprintf(obj,'FORM5;'); 25 | fprintf(obj,'CALIFUL2;'); 26 | for ind = 1:12 27 | set(obj,'EOIMode','off'); 28 | sprintf('INPUCALC%02.0f;',ind) 29 | fprintf(obj,sprintf('INPUCALC%02.0f;',ind)); 30 | fwrite(obj,'#A','schar') 31 | fwrite(obj,size(calArray,1)*8,'uint16') 32 | outData = reshape([real(calArray(:,ind))'; imag(calArray(:,ind))'],[size(calArray,1)*2 1]); 33 | set(obj,'EOIMode','on'); 34 | fwrite(obj,outData,'float32') 35 | end 36 | fprintf(obj,'SAVC;'); 37 | 38 | fclose(obj); 39 | 40 | return; 41 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/Debye.m: -------------------------------------------------------------------------------- 1 | %Returns dielectric of wet snow according to Hallikainen 2 | %freq = frequency in Hz 3 | %mv = % of liquid water content 4 | % roh = density in g/cc 5 | 6 | % mv=0:0.1:12; 7 | % f=6e9; 8 | % roh=0.3; 9 | % [er_r,er_i]=Debye(mv,freq,roh); 10 | % delta=er_r-1-1.832*roh; 11 | % figure(1); clf; 12 | % f1=plot(mv,delta,'k-'); 13 | % ylim([0,1.6]); 14 | % xlim([0.0,13]); 15 | % title('Debye-like model') 16 | % xlabel('Liquid water content, mv(%)'); 17 | % ylabel('Incrementa dielectric constant') 18 | % figure(2); clf; 19 | % f2=plot(mv,er_i,'k-'); 20 | % ylim([0,1.1]); 21 | % xlim([0.0,13]); 22 | % xlabel('Liquid water content, mv(%)'); 23 | % ylabel('Dielectric loss factor') 24 | % title('Debye-like model') 25 | %%Debye like model 26 | function [er_r,er_i]=Debye(mv,freq,roh) 27 | fo=9.07e9; 28 | A1=1; 29 | B1=0; 30 | A2=1; 31 | A=1+(1.83*roh)+(0.02*A1.*(mv.^1.015))+B1; 32 | B=0.073*A1; 33 | C=0.073*A2; 34 | er_r=A+B*mv.^1.31/(1+(freq/fo)^2); 35 | er_i=C*mv.^1.31*(freq/fo)/(1+(freq/fo)^2); 36 | return; 37 | -------------------------------------------------------------------------------- /cresis-toolbox/gps/missions/gps_create_2018_Antarctica_Ground_cpu_time.m: -------------------------------------------------------------------------------- 1 | function correction = gps_create_2018_antarctica_Ground_cpu_time(in_base_path) 2 | 3 | fns = get_filenames(fullfile(in_base_path,'CPU_TIME'),'cpu_time','','.csv',struct('recursive',true)); 4 | [gps_time,cpu_time] = read_cpu_time(fns); 5 | gps_time_origin = gps_time(round(end/2)); 6 | pp = polyfit(gps_time-gps_time_origin, gps_time-cpu_time, 5); 7 | 8 | correction.gps_time_min = min(gps_time); 9 | correction.gps_time_max = max(gps_time); 10 | correction.gps_time_origin = gps_time_origin; 11 | correction.pp = pp; 12 | 13 | if 0 14 | % Debug plots 15 | h_fig = figure; 16 | plot(gps_time-gps_time_origin, gps_time-cpu_time,'.'); 17 | hold on; 18 | grid on; 19 | plot(gps_time-gps_time_origin, polyval(pp, gps_time-gps_time_origin)); 20 | plot(gps_time-gps_time_origin, cpu_time + polyval(pp, cpu_time - gps_time_origin) - gps_time,'x'); 21 | xlabel('Relative GPS time (sec)'); 22 | ylabel('Drift (sec)'); 23 | set(h_fig,'UserData',pp) 24 | end 25 | -------------------------------------------------------------------------------- /cresis-toolbox/missions/run_preprocess_settings_AWI.m: -------------------------------------------------------------------------------- 1 | % script run_preprocess_settings_AWI.m 2 | % 3 | % Support script for run_preprocess.m 4 | 5 | param.config.default = []; 6 | 7 | %% MCORDS5 AWI UWB - SINGLE DAY 8 | cur_idx = length(param.config.default)+1; 9 | param.config.default{cur_idx} = @default_radar_params_2022_Greenland_Polar5_rds; 10 | param.config.base_dir{cur_idx} = 'G:\'; 11 | param.config.config_folder_names{cur_idx} = '20220603'; 12 | param.config.board_folder_names{cur_idx} = fullfile('20220603','%b'); 13 | param.config.date_str{cur_idx} = '20220603'; 14 | 15 | %% SNOW8 SINGLE DAY 16 | % cur_idx = length(param.config.default)+1; 17 | % param.config.default{cur_idx} = default_radar_params_2019_Arctic_Polar6_snow(); 18 | % param.config.base_dir{cur_idx} = '/work/ollie/ajutila/Data/mnt/HDD5/'; 19 | % param.config.config_folder_names{cur_idx} = fullfile('1903080101','UWBM'); 20 | % param.config.board_folder_names{cur_idx} = fullfile('1903080101','UWBM','%b'); 21 | % param.config.date_str{cur_idx} = '20190308'; 22 | -------------------------------------------------------------------------------- /bash/tape_small_file_archive_script.sh: -------------------------------------------------------------------------------- 1 | # small_file_archive_script.sh 2 | # Puts all small files (<1048576 bytes) contained in the current directory 3 | # into a tar file in the current directory. Also creates a text file with a 4 | # listing of all the small files. 5 | 6 | # CREATE SMALL FILE ARCHIVE SCRIPT 7 | echo "First and only input should be the filename prefix for the tar file and is usually the radar directory concatenated with the season name folder (e.g. MCoRDS_2018_Antarctica_DC8)" 8 | SEASON=$1 9 | # CREATE 1 MB FILLER FILE CALLED delete_this_zero_file 10 | dd if=/dev/zero bs=1 count=1048576 | tr '\0' '0' >delete_this_zero_file 11 | # CREATE A TEXT FILE CONTAINING PATH TO ALL THE SMALL FILES 12 | find ./ -type f -size -1048576c >$SEASON"_small_file_list.txt" 13 | # CREATE AN ARCHIVE OF ALL THE SMALL FILES PLUS THE ZERO FILE WHICH ENSURES THE TAR IS >=1 MB 14 | tar cf $SEASON"_small_file_archive.tar" delete_this_zero_file -T $SEASON"_small_file_list.txt" 15 | # DELETE THE 1 MB FILLER FILE 16 | rm delete_this_zero_file 17 | 18 | 19 | -------------------------------------------------------------------------------- /cresis-toolbox/+deconv/plot_ascope.m: -------------------------------------------------------------------------------- 1 | function plot_ascope(varargin) 2 | 3 | start_idx = -160; 4 | stop_idx = 40; 5 | h_fig = figure(1); 6 | clf(h_fig); 7 | legend_str = {}; 8 | h_axes = axes('parent',h_fig); 9 | for echo_idx = 1:2:length(varargin) 10 | for rline_idx = 1:length(varargin{echo_idx+1}) 11 | rline = varargin{echo_idx+1}(rline_idx); 12 | [max_val,max_idx] = max(lp(varargin{echo_idx}(:,rline))); 13 | bins = max_idx + (start_idx:stop_idx); 14 | echo_vals = nan(size(bins)); 15 | valid_bins = find(bins>=1 & bins<=size(varargin{echo_idx},1)); 16 | echo_vals(valid_bins) = varargin{echo_idx}(bins(valid_bins),rline); 17 | xaxis = start_idx + (0:length(bins)-1); 18 | h_plot = plot(xaxis,lp(echo_vals)-max_val,'parent',h_axes); 19 | hold(h_axes,'on'); 20 | grid(h_axes,'on'); 21 | legend_str{end+1} = sprintf('%d:%d', (echo_idx-1)/2+1, rline); 22 | end 23 | end 24 | legend(h_axes,legend_str,'location','best'); 25 | xlim(xaxis([1 end])); 26 | ylim([-80 0]); 27 | hold(h_axes,'off'); 28 | 29 | end 30 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/status_text_set.m: -------------------------------------------------------------------------------- 1 | function status_text_set(obj,str,type) 2 | % echowin.status_text_set(obj, dest, str, type) 3 | % 4 | % Prints status messages to the echowin obj's status bar. 5 | % str is the string to be printed 6 | % type specifies properties of the printing. 7 | % Recognized inputs are: 8 | % 'replace': Replace the status display's existing string with str 9 | % 'append': Append str to the status display's existing string 10 | % 11 | % Note that management of the mouseCoordText component of the status bar is 12 | % maintained separately by the button_motion mouse movement callback. 13 | % 14 | 15 | switch type 16 | case 'replace' 17 | set(obj.right_panel.status_panel.statusText,'String',str); 18 | case 'append' 19 | old_str = get(obj.right_panel.status_panel.statusText,'String'); 20 | set(obj.right_panel.status_panel.statusText,'String',strcat(old_str,str)); 21 | case 'default' 22 | set(obj.right_panel.status_panel.statusText,'String',str); 23 | end 24 | %drawnow; 25 | 26 | return; 27 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/coherentRefl.m: -------------------------------------------------------------------------------- 1 | function modRefl = coherentRefl(origRefl,k0,h,thetaInc) 2 | % modRefl = coherentRefl(origRefl,k0,h,thetaInc) 3 | % 4 | % origRefl: original power reflection coefficient 5 | % k0: wavenumber in incident medium 6 | % h: RMS height of surface 7 | % thetaInc: elevation incidence angle (rad) 8 | % 9 | % modRefl: modified reflection coeff for rough surface 10 | % 11 | % Coherent reflection coefficients for rough planar surface of infinite extent 12 | % 13 | % Reference: 14 | % Ruck, Barrick, Stuart, and Krichbaum, "Radar Cross Section Handbook Volume 2," 1970, pp. 700-701. 15 | % Ulaby, Moore, and Fung, "Microwave Remote Sensing," pp. 951. 16 | % 17 | % Original References 18 | % Ament, W. W., "Toward a theory of reflection by a rough surface," Proceedings IRE, vol. 41:142 (1953) 19 | % 20 | % Davies, H., "The reflection of electromagnetic waves from a rough surface," Proceedings of IEE (GB), V. 101, Part IV:209 1954. 21 | 22 | modRefl = origRefl.*exp(-2*(k0.*h.*cos(thetaInc)).^2); 23 | 24 | return; 25 | 26 | -------------------------------------------------------------------------------- /cresis-toolbox/+deconv/remove_bad_wfs.m: -------------------------------------------------------------------------------- 1 | % script deconv.remove_bad_wfs 2 | 3 | %% User Settings 4 | clear param; 5 | param.radar_name = 'snow'; 6 | % param.season_name = '2009_Greenland_P3'; 7 | % param.day_seg = '20090323_09'; 8 | % param.season_name = '2010_Greenland_DC8'; 9 | % param.day_seg = '20100323_09'; 10 | % param.season_name = '2011_Greenland_P3'; 11 | % param.day_seg = '20110415_01'; 12 | % param.season_name = '2012_Greenland_P3'; 13 | % param.day_seg = '20120315_03'; 14 | param.season_name = 'SEASON'; 15 | param.day_seg = 'DAY_SEG'; 16 | 17 | bad_wfs = [4]; 18 | 19 | spec_file_input_type = 'noise'; 20 | 21 | %% Automated Section 22 | 23 | fprintf('Loading %s\n', param.day_seg); 24 | fn_dir = fileparts(ct_filename_out(param,spec_file_input_type, '')); 25 | 26 | fn = fullfile(fn_dir,sprintf('deconv_%s.mat', param.day_seg)); 27 | 28 | final = load(fn); 29 | 30 | final.deconv_gps_time(bad_wfs) = NaN; 31 | 32 | fprintf('Type dbcont if you are sure you want to continue.\n'); 33 | keyboard 34 | save(fn,'-struct','final'); 35 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/records_create_save_workspace.m: -------------------------------------------------------------------------------- 1 | % script records_create_save_workspace 2 | % 3 | % Saves the workspace to a temporary location 4 | 5 | %% Save workspace in case there is a failure 6 | if isfield(param,'tmp_path') && ~isempty(param.tmp_path) 7 | fn = ct_filename_ct_tmp(param,'','records','workspace'); 8 | fn = [fn '.mat']; 9 | fprintf('Saving workspace %s (%s)\n', fn, datestr(now)); 10 | try 11 | [fn_path,name] = fileparts(fn); 12 | if ~exist(fn_path,'dir') 13 | mkdir(fn_path); 14 | end 15 | 16 | % Get a list of all variables 17 | allvars = whos; 18 | 19 | % Identify the variables that ARE NOT graphics handles. This uses a regular 20 | % expression on the class of each variable to check if it's a graphics object 21 | tosave = cellfun(@isempty, regexp({allvars.class}, '^matlab\.(ui|graphics)\.')); 22 | 23 | % Pass these variable names to save 24 | save(fn, allvars(tosave).name); 25 | catch 26 | fprintf(' Saving workspace failed\n'); 27 | end 28 | end -------------------------------------------------------------------------------- /cresis-toolbox/processing/reset_param_spreadsheet.m: -------------------------------------------------------------------------------- 1 | function reset_param_spreadsheet(param_fn) 2 | %% Opens a the specified Param sheet (param_fn) with columns: 3 | % Process 4 | % Vectors 5 | % Records 6 | % Frames 7 | % Get_Heights 8 | % Set to blank. 9 | % 10 | % INPUT: 11 | % param_fn: String, absolute filepath + filename to MS Excel 12 | % params spreadsheet(.xls). 13 | % 14 | % OUTPUT: 15 | % 16 | % 17 | % EXAMPLE: 18 | % param_fn = 'H:\scripts\params\mcords_param_2010_Greenland_DC8.xls'; 19 | % 20 | % reset_param_spreadsheet(param_fn); 21 | % 22 | % 23 | %% 24 | % Create connection to Excel 25 | Excel = actxserver('Excel.Application'); 26 | 27 | % Make the Excel window visible 28 | Excel.visible = 1; 29 | 30 | % Select sheet to operate on 31 | Workbook = Excel.Workbooks.Open(param_fn); 32 | Command_sheet = Workbook.Worksheets.Item('command'); 33 | 34 | % Specify range 35 | range = ['C6',':','G1000']; 36 | 37 | % Set specified range to '' 38 | Command_sheet.Range(range).Value = ''; 39 | 40 | 41 | -------------------------------------------------------------------------------- /cresis-toolbox/+utua_rds/syncnav_loop.m: -------------------------------------------------------------------------------- 1 | % Michael Christoffersen 2 | % May 2017 3 | % Wrapper for syncnav 4 | 5 | datadir = '/media/mchristo/blind-swamp-eel/paden/radar'; 6 | gpsdir = '/media/mchristo/blind-swamp-eel/paden/gps'; 7 | datafiles = dir(datadir); 8 | nfiles = length(datafiles); 9 | 10 | for i=1:nfiles 11 | dfname = datafiles(i).name; 12 | disp(dfname) 13 | if(~endsWith(dfname,'.mat')) 14 | continue 15 | end 16 | dfname = [datadir,'/',dfname]; 17 | load(dfname) 18 | 19 | ref = split(block.time(1),'T'); 20 | ref = ref(1); 21 | ref = split(ref,'-'); 22 | 23 | % Relies on specific directory structure here 24 | year = ref(1); 25 | month = ref(2); 26 | day = ref(3); 27 | gfname = [gpsdir,'/','18',char(month),char(day),'.pos']; 28 | 29 | [block.lat,block.lon,block.elev_air] = syncnav(block,gfname); 30 | block.gps_corrected = 1; 31 | save(dfname,'block'); 32 | end 33 | 34 | clear block day dfname gfname i month year ref datadir gpsdir datafiles nfiles 35 | -------------------------------------------------------------------------------- /cresis-toolbox/missions/run_preprocess_settings_VANILLA.m: -------------------------------------------------------------------------------- 1 | % script run_preprocess_VANILLA.m 2 | % 3 | % Support script for run_preprocess.m 4 | % 5 | % Preprocess setup script for 2021_Arctic_Vanilla. 6 | 7 | param.config.default = []; 8 | 9 | % Snow9 SINGLE DAY 10 | % cur_idx = length(param.config.default)+1; 11 | % param.config.default{cur_idx} = default_radar_params_2021_Arctic_Vanilla_snow(); 12 | % param.config.base_dir{cur_idx} = '/cresis/snfs1/data/SnowRadar/2021_Arctic_Vanilla/'; 13 | % param.config.config_folder_names{cur_idx} = '/20210414'; 14 | % param.config.board_folder_names{cur_idx} = '/20210414'; 15 | % param.config.date_strs{cur_idx} = '20210414'; 16 | 17 | cur_idx = length(param.config.default)+1; 18 | param.config.default{cur_idx} = default_radar_params_2021_Arctic_Vanilla_snow(); 19 | param.config.base_dir{cur_idx} = '/cresis/snfs1/data/SnowRadar/2021_Arctic_Vanilla/'; 20 | param.config.config_folder_names{cur_idx} = '/20210819/sysconfig'; 21 | param.config.board_folder_names{cur_idx} = '/20210819/data'; 22 | param.config.date_strs{cur_idx} = '20210819'; -------------------------------------------------------------------------------- /cresis-toolbox/mcrds/fname_info_mcrds.m: -------------------------------------------------------------------------------- 1 | function fname = fname_info_mcrds(fn) 2 | % fname = fname_info_mcrds(fn) 3 | % 4 | % Detects the type of MCRDS filename and then parses it. 5 | % 6 | % fn = MCRDS file name 7 | % 8 | % fname = structure containing each of the fields of the MCORDS 9 | % filename 10 | % 11 | % For example: data.20080730212231.0500.raw 12 | % .name = data 13 | % .file_idx = 500 14 | % .datenum = time stamp converted to Matlab date number. Common 15 | % usage: "[year month day hour min sec] = datevec(fname.datenum)" 16 | % 17 | % Example 18 | % fn = '/cresis/data1/MCRDS/2008_Greenland/data.20080730212231.0500.raw'; 19 | % fname = fname_info_mcrds(fn) 20 | % 21 | % Author: John Paden 22 | % 23 | % See also datenum 24 | 25 | [path name ext] = fileparts(fn); 26 | fn = [name ext]; 27 | 28 | [fname.name fn] = strtok(fn,'.'); 29 | 30 | [date_str fn] = strtok(fn,'.'); 31 | fname.datenum = datenum(date_str,'yyyymmddHHMMSS'); 32 | 33 | [fname.file_idx fn] = strtok(fn(2:end),'.'); 34 | fname.file_idx = str2double(fname.file_idx); 35 | 36 | return; 37 | -------------------------------------------------------------------------------- /cresis-toolbox/ct_support/read_param_xls_boolean.m: -------------------------------------------------------------------------------- 1 | function [out] = read_param_xls_boolean(row,col,num,txt) 2 | % [out] = read_param_xls_boolean(row,col,num,txt) 3 | % 4 | % Boolean Cell Read Function 5 | % 6 | % Support function for read_param_xls_* 7 | % 8 | % Author: John Paden, Brady Maasen 9 | % 10 | % See also: ct_set_params, master, read_param_xls 11 | % 12 | % See also for spreadsheet cell loading: 13 | % read_param_xls_boolean.m, read_param_xls_general.m, 14 | % read_param_xls_text.m 15 | % 16 | % See also for worksheet loading: 17 | % read_param_xls_generic.m, read_param_xls_radar.m: 18 | % 19 | % See also for printing out spreadsheet to stdout: 20 | % read_param_xls_print, read_param_xls_print_headers.m 21 | 22 | % 23 | % PRINT OUT XLS: read_param_xls_print 24 | 25 | if size(num,1) < row || size(num,2) < col || isnan(num(row,col)) 26 | if size(txt,1) < row || size(txt,2) < col || isempty(txt{row,col}) 27 | out = false; 28 | else 29 | out = logical(eval(txt{row,col})); 30 | end 31 | else 32 | out = logical(num(row,col)); 33 | end 34 | 35 | return 36 | -------------------------------------------------------------------------------- /cresis-toolbox/processing/sar_proc_task.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SAR_PROC_TASK_H_INCLUDED__ 3 | #define __SAR_PROC_TASK_H_INCLUDED__ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #include "mex.h" 14 | #include "mat.h" 15 | 16 | #define sqr(x) ((x)*(x)) 17 | 18 | const double C = 299792458.0003452; 19 | 20 | void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]); 21 | void sar_pixel_CMFR(double &out_real, double &out_imag, size_t pixel_idx, size_t *support_limits, double *angle_limits); 22 | void sar_pixel_RMFR(double &out_real, double &out_imag, size_t pixel_idx, size_t *support_limits, double *angle_limits); 23 | double interp(double * x_lims,double *y, size_t N, double xq); 24 | double getRefractionRange(size_t,size_t,double &); 25 | double getRange(size_t,size_t,double &); 26 | double getSurfaceIntersectionNewton(double,double,double); 27 | double getSurfaceIntersectionGolden(double,double,double); 28 | size_t getAlongTrackIdx(double &); 29 | 30 | #endif -------------------------------------------------------------------------------- /cresis-toolbox/OPS-MATLAB/conversion/jsonlab/jsonopt.m: -------------------------------------------------------------------------------- 1 | function val=jsonopt(key,default,varargin) 2 | % 3 | % val=jsonopt(key,default,optstruct) 4 | % 5 | % setting options based on a struct. The struct can be produced 6 | % by varargin2struct from a list of 'param','value' pairs 7 | % 8 | % authors:Qianqian Fang (fangq nmr.mgh.harvard.edu) 9 | % 10 | % $Id: loadjson.m 371 2012-06-20 12:43:06Z fangq $ 11 | % 12 | % input: 13 | % key: a string with which one look up a value from a struct 14 | % default: if the key does not exist, return default 15 | % optstruct: a struct where each sub-field is a key 16 | % 17 | % output: 18 | % val: if key exists, val=optstruct.key; otherwise val=default 19 | % 20 | % license: 21 | % BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details 22 | % 23 | % -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab) 24 | % 25 | 26 | val=default; 27 | if(nargin<=2) return; end 28 | opt=varargin{1}; 29 | if(isstruct(opt) && isfield(opt,key)) 30 | val=getfield(opt,key); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/gui_zoom.m: -------------------------------------------------------------------------------- 1 | function [clims] = fiddle(hf) 2 | 3 | set(hf,'WindowKeyPressFcn',@PT_WindowKeyPressFcn); 4 | 5 | function PT_WindowKeyPressFcn(hObj,event) 6 | 7 | chldrn = get(hObj,'Children'); 8 | if isempty(event.Character) 9 | event.Character = event.Key; 10 | end 11 | switch event.Character 12 | case 'z' 13 | zoom; 14 | case 'pageup' 15 | CLim = get(get(hObj,'CurrentAxes'),'CLim'); 16 | CLim(2) = CLim(2) + 3; 17 | set(get(hObj,'CurrentAxes'),'CLim',CLim); 18 | case 'pagedown' 19 | CLim = get(get(hObj,'CurrentAxes'),'CLim'); 20 | if CLim(2) - 3 > CLim(1) 21 | CLim(2) = CLim(2) - 3; 22 | set(get(hObj,'CurrentAxes'),'CLim',CLim); 23 | end 24 | case 'home' 25 | CLim = get(get(hObj,'CurrentAxes'),'CLim'); 26 | if CLim(1) + 3 < CLim(2) 27 | CLim(1) = CLim(1) + 3; 28 | set(get(hObj,'CurrentAxes'),'CLim',CLim); 29 | end 30 | case 'end' 31 | CLim = get(get(hObj,'CurrentAxes'),'CLim'); 32 | CLim(1) = CLim(1) - 3; 33 | set(get(hObj,'CurrentAxes'),'CLim',CLim); 34 | end 35 | 36 | return 37 | 38 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@echowin/savePB_callback.m: -------------------------------------------------------------------------------- 1 | function savePB_callback(obj,hObj,event) 2 | % savePB_callback(obj,hObj,event) 3 | 4 | % Ensure focus stays on figure to prevent hotkeys registering with this 5 | % uicontrol. 6 | uicontrol(obj.right_panel.status_panel.statusText); 7 | 8 | obj.status_text_set(sprintf('(%s) Saving...', datestr(now,'HH:MM:SS')),'replace'); 9 | drawnow; 10 | 11 | obj.busy_mode = true; 12 | set(obj.h_fig,'Pointer','watch'); 13 | drawnow; 14 | 15 | imb.save_undo_stack(obj.undo_stack); 16 | obj.eg.layers.saved.lyr_age = obj.eg.layers.lyr_age; 17 | obj.eg.layers.saved.lyr_age_source = obj.eg.layers.lyr_age_source; 18 | obj.eg.layers.saved.lyr_desc = obj.eg.layers.lyr_desc; 19 | obj.eg.layers.saved.lyr_group_name = obj.eg.layers.lyr_group_name; 20 | obj.eg.layers.saved.lyr_id = obj.eg.layers.lyr_id; 21 | obj.eg.layers.saved.lyr_name = obj.eg.layers.lyr_name; 22 | obj.eg.layers.saved.lyr_order = obj.eg.layers.lyr_order; 23 | 24 | set(obj.h_fig,'Pointer','Arrow'); 25 | obj.busy_mode = false; 26 | 27 | obj.status_text_set(sprintf('Done %s', datestr(now,'HH:MM:SS')),'append'); 28 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@mapwin/update_vector_layers.m: -------------------------------------------------------------------------------- 1 | function update_vector_layers(obj) 2 | % update_vector_layers(obj) 3 | % 4 | % Update vector graphics for mapwin map 5 | % 1. Draws red line for selected frame 6 | % obj.map.sel.X,obj.map.sel.Y 7 | % 2. Draws green lines associated with each echowin window 8 | % obj.draw_echowin_flightline() 9 | % 3. Draws cursors 10 | % obj.draw_cursors() 11 | % 12 | % Only plots flightlines if a selection has been made. 13 | 14 | selection_color = [1 0 0]; 15 | 16 | %------------------------------------------------------------------------ 17 | % Draw current selection 18 | set(obj.map_panel.h_cur_sel,{'XData','YData'},{obj.map.sel.X,obj.map.sel.Y}); 19 | 20 | %------------------------------------------------------------------------ 21 | % Update echowin flightlines 22 | for echowin_idx = 1:length(obj.echowin_list) 23 | obj.update_echowin_flightlines(obj.echowin_list(echowin_idx)); 24 | end 25 | 26 | %------------------------------------------------------------------------ 27 | % Update echowin cursors 28 | obj.update_cursors(); 29 | 30 | 31 | return 32 | -------------------------------------------------------------------------------- /cresis-toolbox/+sim/sar_example.m: -------------------------------------------------------------------------------- 1 | 2 | % Create trajectory and attitude (gps file, records file) 3 | % start point 4 | % sim.traj_linear.m linear path (length) or sim.traj_circ.m circular path (radius) 5 | % linear: heading and length, start and stop elevation, RMS variation, correlation length, sample rate 6 | 7 | 8 | % 9 | 10 | % Create targets 11 | % Line at nadir: start/stop elevation, RMS variation, correlation length, sample rate 12 | % Import DEM: filtering? 13 | % Surface generator (point target, factet) 14 | % Dielectric layer generator... thickness but also constrain variation so 15 | % random walk does not get out of control 16 | 17 | % Create simulated data (specify each waveform) 18 | % Loop over each phase center 19 | % ADC: bits, full scale, quantization power 20 | % Rx gain (time delay, phase shift, amplitude) 21 | % Sampling frequency, PRF 22 | % Echo/direct receive or deramp on receive 23 | % transmit array: transmit power, lever arms 24 | % Waveform (linear FM: start, stop, pulse duration, fast time window) 25 | % 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /cresis-toolbox/acords/load_time_acords.m: -------------------------------------------------------------------------------- 1 | function [TimeComputer TimeRadar] = load_time_acords(filename,Header) 2 | 3 | TimeComputer = []; 4 | TimeRadar = []; 5 | 6 | % OPEN FILE ========================================================== 7 | fid = fopen( filename ,'r'); 8 | status = fseek(fid,Header.IndexData,'bof'); 9 | 10 | % START READING TIMES ================================================ 11 | block_length = Header.IndexRecordStop(end,end); 12 | recordindex = 1; 13 | TimeComputer = []; 14 | TimeRadar = []; 15 | while recordindex <= Header.NumberRecords 16 | 17 | datatype = fread(fid,1,'int32'); %read datatype 18 | 19 | seconds = fread(fid,1,'int32'); 20 | useconds = fread(fid,1,'int32'); 21 | TimeComputer = [TimeComputer seconds+(1e-6*useconds)]; 22 | 23 | TimeRadar_temp = fread(fid,1,'int64'); 24 | TimeRadar = [TimeRadar TimeRadar_temp/10e6]; 25 | 26 | % Skip past DAQ error bytes and data 27 | status = fseek(fid,4+2*block_length,'cof'); 28 | 29 | recordindex = recordindex + 1; 30 | 31 | end 32 | 33 | fclose(fid); 34 | 35 | 36 | -------------------------------------------------------------------------------- /cresis-toolbox/gis/concatenate_thickness_files.m: -------------------------------------------------------------------------------- 1 | function concatenate_thickness_files(in_fns_dir,in_fns_name,out_fn,delim) 2 | % concatenate_thickness_files(in_fns_dir,in_fns_name,out_fn,delim) 3 | % 4 | % Concatenates txt/csv files specified by in_fns and saves them in the 5 | % out_fn. 6 | % 7 | % Example: 8 | % in_fns_dir = '/cresis/scratch2/mdce/mcords/2009_Antarctica_DC8/CSARP_post/csv/20091118_01' 9 | % in_fns_name = '*.csv' 10 | % out_fn = '/cresis/scratch2/mdce/mcords/2009_Antarctica_DC8/CSARP_post/csv/20091118_01.csv'; 11 | % concatenate_thickness_files(in_fns_dir,in_fns_name,out_fn,','); 12 | % 13 | % Author: Logan Smith, John Paden, Shashanka Jagarlapudi 14 | 15 | fns = get_filenames(in_fns_dir,in_fns_name,'',''); 16 | 17 | fprintf(' Creating CSV %s\n', out_fn); 18 | fid_out = fopen(out_fn,'w'); 19 | for fn_idx = 1:length(fns) 20 | fn = fns{fn_idx}; 21 | fid = fopen(fn); 22 | if fn_idx > 1 23 | fgets(fid); 24 | end 25 | buffer = fread(fid,inf,'char'); 26 | fclose(fid); 27 | fwrite(fid_out,buffer,'char'); 28 | end 29 | fclose(fid_out); 30 | 31 | return; 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /cresis-toolbox/em_model/drysnow.m: -------------------------------------------------------------------------------- 1 | function er_r = drysnow(ei,vi,roh_ds) 2 | % Permitivity of DrySnow using the 2 eqns on page 2062 MRS 3 | % figure 5 in the report 4 | % 5 | % roh_ds=0:0.01:1; 6 | % vi=roh_ds/0.916; 7 | % ei=3.15; 8 | % er_r = drysnow(ei,vi,roh_ds) 9 | % figure(3); clf; 10 | % f1=plot(roh_ds,er_r,'k-'); 11 | % xlabel('Snow Density (g cm^-3)'); 12 | % ylabel('Dry snow permittivity eds (real part)'); 13 | % 14 | % rho_ds = g/cm^3 with 0.916 g/cm^3 being solid ice 15 | 16 | N=3*vi*(ei-1); 17 | D=(2+ei)-(vi*(ei-1)); 18 | T=N/D; 19 | eds=1+T; 20 | r = find(roh_ds<=0.5); 21 | er_r(r)=(1+1.9*roh_ds(r)); 22 | r = find(roh_ds>=0.5); 23 | er_r(r)=(0.51+2.88*roh_ds(r)); 24 | % er_r(r)=(1+0.47*vi(r)).^3; 25 | 26 | % Another permitivity relation using only rho_ds from: 27 | % Ulaby, F. T., R. K. Moore, and A. K. Fung (1986), Microwave Remote Sensing: Active 28 | % and Passive, Vol. II { Radar Remote Sensing and Surface Scattering and Emission 29 | % Theory, Microwave Remote Sensing (Book 2), vol. 2, Artech House, 685 Canton Street, 30 | % Norwood, MA 02062. 31 | % er_r = (1 + 0.51*rho_ds).^3; 32 | 33 | return; 34 | -------------------------------------------------------------------------------- /cresis-toolbox/missions/default_radar_params_2016_Greenland_P3_mcords.m: -------------------------------------------------------------------------------- 1 | function [param,defaults] = default_radar_params_2016_Greenland_P3_mcords 2 | % [param,defaults] = default_radar_params_2016_Greenland_P3_mcords 3 | % 4 | % Creates base "param" struct 5 | % Creates defaults cell array 6 | % 7 | % Author: John Paden 8 | 9 | param.season_name = '2016_Greenland_P3'; 10 | param.radar_name = 'mcords5'; 11 | 12 | default.radar.fs = 125e6; 13 | default.radar.adc_bits = 14; 14 | default.radar.adc_full_scale = 2; 15 | default.radar.rx_paths = [1:15]; 16 | default.radar.wfs(1).chan_equal_dB = zeros(1,15); 17 | default.radar.wfs(1).chan_equal_deg = zeros(1,15); 18 | default.radar.wfs(1).chan_equal_Tsys = zeros(1,15); 19 | default.radar.noise_figure = 2; 20 | default.radar.rx_gain = 51.5; 21 | default.radar.adc_SNR_dB = 70; 22 | default.radar.Tadc_adjust = 0; 23 | 24 | default.noise_50ohm = zeros(1,15); 25 | 26 | default.Pt = (7*300) * sum(chebwin(7,30).^2)/7; 27 | 28 | default.Gt = 7*4; 29 | default.Ae = 2*0.468 * 0.468; 30 | 31 | default.system_loss_dB = 10.^(-5.88/10); 32 | 33 | defaults{1} = default; 34 | 35 | return; 36 | -------------------------------------------------------------------------------- /cresis-toolbox/gui/link_figures.m: -------------------------------------------------------------------------------- 1 | function [h_axes] = link_figures(h_fig,option) 2 | % [h_axes] = link_figures(h_fig,option) 3 | % 4 | % Function for conveniently linking all the axes of a set of figures. The 5 | % figures can be referenced by their double value (e.g. 1,2,3) or by their 6 | % Matlab object handle. 7 | % 8 | % h_fig: list of figures (either double array or Matlab figure objects 9 | % option: optional argument passed to linkaxes, default is 'xy' 10 | % 11 | % Author: John Paden 12 | % 13 | % See also: linkaxes.m 14 | 15 | if ~exist('h_fig','var') || isempty(h_fig) 16 | h_fig = get(0,'Children'); 17 | end 18 | if ~exist('option','var') || isempty(option) 19 | option = 'xy'; 20 | end 21 | 22 | % Get all the axes children of each figure that is passed in 23 | h_axes = []; 24 | for fig_idx = 1:length(h_fig) 25 | h_children = get(h_fig(fig_idx),'children'); 26 | for child_idx = 1:length(h_children) 27 | if isa(h_children(child_idx),'matlab.graphics.axis.Axes') 28 | h_axes(end+1) = h_children(child_idx); 29 | end 30 | end 31 | end 32 | 33 | % Link them all together 34 | linkaxes(h_axes,option); 35 | -------------------------------------------------------------------------------- /cresis-toolbox/+imb/@ascopewin/memory.m: -------------------------------------------------------------------------------- 1 | function memory(obj,vals) 2 | % memory(obj,vals) 3 | 4 | if strcmp(get(obj.h_fig,'visible'),'off') 5 | set(obj.h_fig,'visible','on'); 6 | figure(obj.h_fig); 7 | 8 | else 9 | if nargin == 1 10 | vals = find(~isnan(obj.ascope.echowin)); 11 | end 12 | for new_idx = vals 13 | if ~isnan(obj.ascope.echowin(new_idx)) 14 | ascope.echowin = NaN; 15 | ascope.sys = obj.ascope.sys{new_idx}; 16 | ascope.season_name = obj.ascope.season_name{new_idx}; 17 | ascope.frm_str = obj.ascope.frm_str{new_idx}; 18 | ascope.gps_time = obj.ascope.gps_time(new_idx); 19 | ascope.twtt = obj.ascope.twtt{new_idx}; 20 | ascope.data = obj.ascope.data{new_idx}; 21 | ascope.surf_twtt = obj.ascope.surf_twtt(new_idx); 22 | ascope.lat = obj.ascope.lat(new_idx); 23 | ascope.lon = obj.ascope.lon(new_idx); 24 | ascope.target_twtt = obj.ascope.target_twtt(new_idx); 25 | ascope.xlims = obj.ascope.xlims{new_idx}; 26 | ascope.ylims = obj.ascope.ylims{new_idx}; 27 | 28 | obj.update_ascope(ascope); 29 | end 30 | end 31 | end 32 | --------------------------------------------------------------------------------