//h-----------------------------------------------------------------------------
//h .root/data_access/MEM_2dspectra.cdip
//h
//h Creates a 2D (dir/freq) energy spectra from a standard CDIP spectral
//h file using the Maximum Entropy Method (MEM).
//h
//h NOTE: This is ONE WAY to estimate a 2d spectrum from the buoy data.  
//h CDIP uses it because it makes narrow directional spectra for swell in the 
//h Pacific.
//h
//h
//h For information on the MEM estimator and its limitations, please see:
//h  Kuik et al, 
//h  A Method for the Routine Analysis of Pitch-and-Roll Buoy Wave Data
//h  http://journals.ametsoc.org/doi/abs/10.1175/1520-0485(1988)018%3C1020:AMFTRA%3E2.0.CO;2
//h
//h  Lygre & Krogstad,
//h  Maximum Entropy Estimation of the Directional Distribution in Ocean Wave Spectra
//h  http://journals.ametsoc.org/doi/abs/10.1175/1520-0485(1986)016%3C2052%3AMEEOTD%3E2.0.CO%3B2
//h  
//h  Ochoa & Delgado-Gonzalez,
//h  Pitfalls in the estimation of wind wave directional spectra by variational principles
//h  http://www.sciencedirect.com/science/article/pii/S014111870580025
//h
//h
//h By default the directions are grouped in 5-degree bins, and the
//h frequencies bands are the same as in the sp file. Values are given
//h in units of m*m/Hz/deg.
//h
//h Data is output as a matrix:                   +------Direction bands------>
//h   - First column is centered at 5 degrees;    |        72 columns
//h   - Last column is centered at 360 degrees;   |
//h   - First row is the lowest freq (.025 Hz     |
//h       for directional buoys);              Frequency bands
//h   - Last row is the highest freq (.58 Hz      |  64 rows for Mk3 buoys or
//h       for Mk3 buoys, 1.0 Hz for DWR4s);       |  100 rows for DWR4s
//h                                               |
//h                                               v
//h
//h Arguments: 1 - either a 3-digit station ID for the latest data, or a 
//h                  19-character sp filename.
//h            2 - optional; set to 'even' to get evenly spaced freq bands,
//h                  all with a bandwidth of 0.01Hz (0.03Hz-0.58Hz)
//h 
//h NOTE: This script is intended for single-file access and is limited to
//h  data from the past 7 days. Due to resource constraints, historic and bulk 
//h  requests must be directed to www@cdip.ucsd.edu.
//h 
//h Usage:
//h   http://cdip.ucsd.edu/data_access/MEM_2dspectra.cdip?{args}
//h   where {args} examples are:
//h     1. h                          -> returns this help
//h     2. 029                        -> MEM spectra for most recent 029 sp
//h     3. sp21501YYYYMMDDHHMM        -> MEM spectra for Stn 215 spectral file;
//h                                        YYYYMMDDHHMM must fall in last 7 days
//h     4. 106+even                   -> Latest 106 spectra, 0.01Hz bands
//h-----------------------------------------------------------------------------