PRO read_lvis1b, data, file=file, quiet=quiet ; ; IDL code to read in all LVIS Level-1B release files: ; v1.04, v1.05, v2.0.1, v2.0.2, v2.0.3 ; ; INPUT: ; ====== ; FILE: LVIS Level-1B .h5 file to read in; if this parameter is not present, a popup box ; will appear and offer to select a file with an .h5 extension ; ; OUTPUT: ; ======= ; DATA: data returned as a structure ; ; 2026-03-19 HGC ; Land, Vegetation, and Ice Sensor (LVIS) Team ; http://lvis.gsfc.nasa.gov/ ; ; EXAMPLE USAGE: ; read_lvis1b, data, file=lvis1b_file, /quiet ; ; Format for Facility v2.0.3 lvisf_level1b_data = { $ lfid: 0UL, $ ; LVIS file identification shotnumber: 0UL, $ ; Laser shot assigned during collection azimuth: 0.0, $ ; Azimuth angle of laser beam incidentangle: 0.0, $ ; Off-nadir angle of laser beam range: 0.0, $ ; Along-laser-beam distance from the instrument to the ground time: 0.0D, $ ; UTC decimal seconds of the day lon0: 0.0D, $ ; Longitude of the highest sample in the waveform lat0: 0.0D, $ ; Latitude of the highest sample in the waveform z0: 0.0, $ ; Elevation of the highest sample in the waveform lon1215: 0.0D, $ ; Longitude of the lowest sample in the waveform lat1215: 0.0D, $ ; Latitude of the lowest sample in the waveform z1215: 0.0, $ ; Elevation of the lowest sample in the waveform sigmean: 0.0, $ ; Signal mean noise level txwave: uintarr(128),$ ; Transmitted waveform (128 samples, 2 bytes per sample) rxwave: uintarr(1216) } ; Received waveform (1216 samples, 2 bytes per sample) ; Format for Classic v2.0.1 or v2.0.3 lvisc_level1b_data = { $ lfid: 0UL, $ ; LVIS file identification shotnumber: 0UL, $ ; Laser shot assigned during collection azimuth: 0.0, $ ; Azimuth angle of laser beam incidentangle: 0.0, $ ; Off-nadir angle of laser beam range: 0.0, $ ; Along-laser-beam distance from the instrument to the ground time: 0.0D, $ ; UTC decimal seconds of the day lon0: 0.0D, $ ; Longitude of the highest sample in the waveform lat0: 0.0D, $ ; Latitude of the highest sample in the waveform z0: 0.0, $ ; Elevation of the highest sample in the waveform lon1023: 0.0D, $ ; Longitude of the lowest sample in the waveform lat1023: 0.0D, $ ; Latitude of the lowest sample in the waveform z1023: 0.0, $ ; Elevation of the lowest sample in the waveform sigmean: 0.0, $ ; Signal mean noise level txwave: uintarr(128),$ ; Transmitted waveform (128 samples, 2 bytes per sample) rxwave: uintarr(1024) } ; Received waveform (1024 samples, 2 bytes per sample) ; Format for 2017 (first LVISF iteration) lvisf_level1b_data_v202 = { $ lfid: 0UL, $ ; LVIS file identification shotnumber: 0UL, $ ; Laser shot assigned during collection azimuth: 0.0, $ ; Azimuth angle of laser beam incidentangle: 0.0, $ ; Off-nadir angle of laser beam range: 0.0, $ ; Along-laser-beam distance from the instrument to the ground time: 0.0D, $ ; UTC decimal seconds of the day lon0: 0.0D, $ ; Longitude of the highest sample in the waveform lat0: 0.0D, $ ; Latitude of the highest sample in the waveform z0: 0.0, $ ; Elevation of the highest sample in the waveform lon1215: 0.0D, $ ; Longitude of the lowest sample in the waveform lat1215: 0.0D, $ ; Latitude of the lowest sample in the waveform z1215: 0.0, $ ; Elevation of the lowest sample in the waveform sigmean: 0.0, $ ; Signal mean noise level txwave: uintarr(256),$ ; Transmitted waveform (256 samples, 2 bytes per sample) rxwave: uintarr(1216) } ; Received waveform (1216 samples, 2 bytes per sample) ; Format for IceBridge v1.04 lvis_level1b_data_v104 = { $ lfid: 0UL, $ ; LVIS file identification shotnumber: 0UL, $ ; Laser shot assigned during collection azimuth: 0.0, $ ; Azimuth angle of laser beam incidentangle: 0.0, $ ; Off-nadir angle of laser beam range: 0.0, $ ; Along-laser-beam distance from the instrument to the ground time: 0.0D, $ ; UTC decimal seconds of the day lon0: 0.0D, $ ; Longitude of the highest sample in the waveform lat0: 0.0D, $ ; Latitude of the highest sample in the waveform z0: 0.0, $ ; Elevation of the highest sample in the waveform lon527: 0.0D, $ ; Longitude of the lowest sample in the waveform lat527: 0.0D, $ ; Latitude of the lowest sample in the waveform z527: 0.0, $ ; Elevation of the lowest sample in the waveform sigmean: 0.0, $ ; Signal mean noise level txwave: uintarr(120),$ ; Transmitted waveform (120 samples, 2 bytes per sample) rxwave: uintarr(528) } ; Received waveform (528 samples, 2 bytes per sample) ; Format for Classic v1.05 with rx432 lvis_level1b_data_v105 = { $ lfid: 0UL, $ ; LVIS file identification shotnumber: 0UL, $ ; Laser shot assigned during collection azimuth: 0.0, $ ; Azimuth angle of laser beam incidentangle: 0.0, $ ; Off-nadir angle of laser beam range: 0.0, $ ; Along-laser-beam distance from the instrument to the ground date: 0L, $ ; UTC Date of laser shot time: 0.0D, $ ; UTC decimal seconds of the day lon0: 0.0D, $ ; Longitude of the highest sample in the waveform lat0: 0.0D, $ ; Latitude of the highest sample in the waveform z0: 0.0, $ ; Elevation of the highest sample in the waveform lon431: 0.0D, $ ; Longitude of the lowest sample in the waveform lat431: 0.0D, $ ; Latitude of the lowest sample in the waveform z431: 0.0, $ ; Elevation of the lowest sample in the waveform sigmean: 0.0, $ ; Signal mean noise level txwave: uintarr(80), $ ; Transmitted waveform (80 samples, 2 bytes per sample) rxwave: uintarr(432) } ; Received waveform (432 samples, 2 bytes per sample) ; Format for Classic v1.05 with rx352 lvis_level1b_data_v105_rx352 = { $ lfid: 0UL, $ ; LVIS file identification shotnumber: 0UL, $ ; Laser shot assigned during collection azimuth: 0.0, $ ; Azimuth angle of laser beam incidentangle: 0.0, $ ; Off-nadir angle of laser beam range: 0.0, $ ; Along-laser-beam distance from the instrument to the ground date: 0L, $ ; UTC Date of laser shot time: 0.0D, $ ; UTC decimal seconds of the day lon0: 0.0D, $ ; Longitude of the highest sample in the waveform lat0: 0.0D, $ ; Latitude of the highest sample in the waveform z0: 0.0, $ ; Elevation of the highest sample in the waveform lon351: 0.0D, $ ; Longitude of the lowest sample in the waveform lat351: 0.0D, $ ; Latitude of the lowest sample in the waveform z351: 0.0, $ ; Elevation of the lowest sample in the waveform sigmean: 0.0, $ ; Signal mean noise level txwave: uintarr(80), $ ; Transmitted waveform (80 samples, 2 bytes per sample) rxwave: uintarr(352) } ; Received waveform (352 samples, 2 bytes per sample) ; select input file if keyword_set(file) then begin if (file_test(file) eq 1) then begin infile = file endif else begin infile = dialog_pickfile(/read, filter=['*.h5']) if (infile eq '') then begin print, 'File not found' RETURN endif endelse endif else begin infile = dialog_pickfile(/read, filter=['*.h5']) if (infile eq '') then begin print, 'File not found' RETURN endif endelse if not keyword_set(quiet) then print, 'Reading in LVIS LEVEL-1B file: ', infile hdf = h5_parse(infile, /read_data) numshots = hdf.lfid._nelements if (numshots le 0) then begin print, 'No shots found: hdf.lfid._nelements = ', numshots RETURN endif case 1 of (hdf.rxwave._dimensions)[0] eq 1216: begin ; v2 LVISF if (hdf.txwave._dimensions)[0] eq 128 $ then lvis_level1b_data=lvisf_level1b_data $ else lvis_level1b_data=lvisf_level1b_data_v202 if not keyword_set(quiet) then print, 'LDS v2 LVIS-Facility' data = replicate(lvis_level1b_data, hdf.lfid._nelements) data.lon1215 = hdf.lon1215._data data.lat1215 = hdf.lat1215._data data.z1215 = hdf.z1215._data end (hdf.rxwave._dimensions)[0] eq 1024: begin ; v2 LVISC if not keyword_set(quiet) then print, 'LDS v2 LVIS-Classic' data = replicate(lvisc_level1b_data, hdf.lfid._nelements) data.lon1023 = hdf.lon1023._data data.lat1023 = hdf.lat1023._data data.z1023 = hdf.z1023._data end (hdf.rxwave._dimensions)[0] eq 528: begin ; v1.04 if not keyword_set(quiet) then print, 'LDS v1.04: IceBridge 2009-2015' data = replicate(lvis_level1b_data_v104, hdf.lfid._nelements) data.lon527 = hdf.lon527._data data.lat527 = hdf.lat527._data data.z527 = hdf.z527._data end (hdf.rxwave._dimensions)[0] eq 432: begin ; v1.05 2003-2009 if not keyword_set(quiet) then print, 'LDS v1.05: Rereleases of 2003-2009 data' data = replicate(lvis_level1b_data_v105, hdf.lfid._nelements) data.date = hdf.date._data data.lon431 = hdf.lon431._data data.lat431 = hdf.lat431._data data.z431 = hdf.z431._data end (hdf.rxwave._dimensions)[0] eq 352: begin ; v1.05 1998-1999 if not keyword_set(quiet) then print, 'LDS v1.05: Rereleases of 1998-1999 data' data = replicate(lvis_level1b_data_v105_rx352, hdf.lfid._nelements) data.date = hdf.date._data data.lon351 = hdf.lon351._data data.lat351 = hdf.lat351._data data.z351 = hdf.z351._data end else: begin print, 'This file does not have the standard dimensions of any current LVIS Level-1B release:' print, 'Data structure: ' help, data, /str return end endcase data.lfid = hdf.lfid._data data.shotnumber = hdf.shotnumber._data data.azimuth = hdf.azimuth._data data.incidentangle = hdf.incidentangle._data data.range = hdf.range._data data.time = hdf.time._data data.lon0 = hdf.lon0._data data.lat0 = hdf.lat0._data data.z0 = hdf.z0._data data.sigmean = hdf.sigmean._data data.txwave = hdf.txwave._data data.rxwave = hdf.rxwave._data END