The forum is locked.

The Ocean Color Forum has transitioned over to the Earthdata Forum (https://forum.earthdata.nasa.gov/). The information existing below will be retained for historical reference. Please sign into the Earthdata Forum for active user support.

Up Topic Frequently Asked Questions / Data Products & Algorithms FAQ / How do I convert SeaDAS bands to IDL arrays and vice versa? (locked)
- By mike Date 2009-08-03 14:22
How do I convert SeaDAS bands to IDL arrays and vice versa?

SeaDAS Band to IDL Array - Though SeaDAS has command-line functions for working with loaded bands (examples include mband_cmd, band_avg, band_diff, band_sum, mapimg), it is also possible to copy the data from a loaded band directly into an IDL array and then use IDL commands to manipulate the data. To create an array from a loaded band use the sdp_band_get function on the SeaDAS command-line or in a script. The sdp_raw2geo function is also useful for converting the array from raw to geophysical values. The following example checks to see if there is any valid data in a band whose missing values are less than zero:

   band_no = 1   ; loaded band number
   sdp_band_get, band_no, banddata   ; store 'raw data' into array banddata
   geodata = sdp_raw2geo(band_no, banddata)   ; convert 'raw data' to geophysical values
   if (max(geodata) gt 0) then begin
     ; use IDL commands here to manipulate the array
   endif



------

IDL Array to SeaDAS Band - The opposite of above. To get an IDL array into the SeaDAS bandlist use the sdp_add_band_entry command. A simple example where an array "qual" is populated with a quality flag and has the same geolocation as band 1:

   sdp_add_band_entry, qual, nav_band=1

You can also include units, bandname, etc.

Usage:  SDP_ADD_BAND_ENTRY, banddata, info_band=info_band, nav_band=nav_band, FILENAME=filename, PRODNAME=prodname, BANDNAME=i_bandname, si=i_si, scale_type=i_scale_type, units=i_units

(see file: $SEADAS/idl_lib/sdp_add_band_entry.pro)


-thanks to Stanford Ocean Biogeochemistry Lab for these tips
Up Topic Frequently Asked Questions / Data Products & Algorithms FAQ / How do I convert SeaDAS bands to IDL arrays and vice versa? (locked)