Home > atmlab > sensors > auramls_read_l2gp.m

auramls_read_l2gp

PURPOSE ^

------------------------------------------------------------------------

SYNOPSIS ^

function P = auramls_read_l2gp( filename )

DESCRIPTION ^

------------------------------------------------------------------------
 NAME:     auramls_read_l2gp

           Read L2GP hdf5-eos data from EOS-MLS. For info about
           the MLS data see the Level 2 data and quality description
           document available from the MLS web site at
                 http://mls.jpl.nasa.gov   

 FORMAT:   P = auramls_read_l2gp( filename )

 IN:       filename    full path to MLS L2GP file

 OUT:      P           L2GP structure. These fields are returned, with 
                       example on size:
                             L2GPVALUE: [47x3495 double]
                         L2GPPRECISION: [47x3495 double]
                               QUALITY: [3495x1 double]
                                STATUS: [3495x1 double]
                              LATITUDE: [3495x1 double]
                             LONGITUDE: [3495x1 double]
                           CHUNKNUMBER: [3495x1 double]
                                  TIME: [3495x1 double]
                        LOCALSOLARTIME: [3495x1 double]
                      SOLARZENITHANGLE: [3495x1 double]
                    ORBITGEODETICANGLE: [3495x1 double]
                      LINEOFSIGHTANGLE: [3495x1 double]
                              PRESSURE: [47x1 double]
------------------------------------------------------------------------

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

DOWNLOAD ^

auramls_read_l2gp.m

SOURCE CODE ^

0001 %------------------------------------------------------------------------
0002 % NAME:     auramls_read_l2gp
0003 %
0004 %           Read L2GP hdf5-eos data from EOS-MLS. For info about
0005 %           the MLS data see the Level 2 data and quality description
0006 %           document available from the MLS web site at
0007 %                 http://mls.jpl.nasa.gov
0008 %
0009 % FORMAT:   P = auramls_read_l2gp( filename )
0010 %
0011 % IN:       filename    full path to MLS L2GP file
0012 %
0013 % OUT:      P           L2GP structure. These fields are returned, with
0014 %                       example on size:
0015 %                             L2GPVALUE: [47x3495 double]
0016 %                         L2GPPRECISION: [47x3495 double]
0017 %                               QUALITY: [3495x1 double]
0018 %                                STATUS: [3495x1 double]
0019 %                              LATITUDE: [3495x1 double]
0020 %                             LONGITUDE: [3495x1 double]
0021 %                           CHUNKNUMBER: [3495x1 double]
0022 %                                  TIME: [3495x1 double]
0023 %                        LOCALSOLARTIME: [3495x1 double]
0024 %                      SOLARZENITHANGLE: [3495x1 double]
0025 %                    ORBITGEODETICANGLE: [3495x1 double]
0026 %                      LINEOFSIGHTANGLE: [3495x1 double]
0027 %                              PRESSURE: [47x1 double]
0028 %------------------------------------------------------------------------
0029 
0030 % HISTORY: 2004.08.01  Created by Carlos Jimenez
0031 %                      Institute of Atmospheric and Environmental Science,
0032 %                      School of GeoSciences, The University of Edinburgh
0033 %                      Crew Building, Mayfield Road, Edinburgh EH9 3JN
0034 %                      Telephone / Fax: +44 (0) 131 650 5098  / 662 0478
0035 %                      http://www.geos.ed.ac.uk/contacts/homes/cjimenez
0036 %
0037 %          2005.09.11  Update to make independent of MLS-struc
0038 %
0039 %          2006-03-27
0040 
0041 function P = auramls_read_l2gp( filename )
0042 
0043 
0044 %=== De-activation of older input argument
0045 %
0046 do_column = 0;
0047 
0048 
0049 %=== file exist and can be read?
0050 %
0051 if ~exist( filename, 'file' );
0052    error('File could not be found.');
0053 end
0054 %
0055 if isempty( findstr( filename, 'L2GP' ) )
0056   error('File is not L2GP data.');
0057 end
0058 %
0059 if ~isempty( findstr( filename, 'L2GP' ) ) & ... 
0060                                         ~isempty( findstr( filename, 'DGG' ) ) 
0061   error('Sorry, but this diagnostic L2GP data cannot be read.');
0062 end
0063 
0064 
0065 %= Find product
0066 %
0067 product = filename( findstr( filename, 'L2GP' )+5:end );
0068 product = product( 1 : min(findstr(product,'_'))-1 );
0069 
0070 
0071 
0072 %== read hdf-eos5
0073 %
0074 P = read_hdf5eos( filename, product, do_column );
0075 
0076 return
0077 
0078 
0079 
0080 %------------------------------------------------------------------------
0081 %                               SUB-FUNCTIONS
0082 %------------------------------------------------------------------------
0083 
0084 function P = read_hdf5eos( filename, group, do_column )
0085 
0086 
0087 day = strfind( filename, 'd' );
0088 day = day(end);
0089 day = str2num( filename( day +1 : day + 3) );
0090 
0091 
0092 %=== reading the most useful fields, user can add more
0093 %    if desired here
0094 
0095 
0096 %== Preparing from column
0097 
0098 if do_column
0099 
0100   group = [ group, ' column'];
0101 
0102 end
0103 
0104 
0105 %== Can we read this field?
0106 
0107 try
0108   double(hdf5read(filename, ...
0109        ['/HDFEOS/SWATHS/' group '/Data Fields/L2gpValue']));
0110 catch
0111   P = [];
0112   return
0113 end 
0114 
0115 %== Data Fields
0116 
0117 P.L2GPVALUE=double(hdf5read(filename, ...
0118        ['/HDFEOS/SWATHS/' group '/Data Fields/L2gpValue']));
0119 P.L2GPPRECISION=double(hdf5read(filename, ...
0120        ['/HDFEOS/SWATHS/' group '/Data Fields/L2gpPrecision']));
0121 P.QUALITY=double(hdf5read(filename, ...
0122        ['/HDFEOS/SWATHS/' group '/Data Fields/Quality']));
0123 P.STATUS=double(hdf5read(filename, ...
0124        ['/HDFEOS/SWATHS/' group '/Data Fields/Status']));
0125 
0126 %== Geolocation fields
0127 
0128 P.LATITUDE=double(hdf5read(filename, ...
0129        ['/HDFEOS/SWATHS/' group '/Geolocation Fields/Latitude']));
0130 P.LONGITUDE=double(hdf5read(filename, ...
0131        ['/HDFEOS/SWATHS/' group '/Geolocation Fields/Longitude']));
0132 P.CHUNKNUMBER=double(hdf5read(filename, ...
0133        ['/HDFEOS/SWATHS/' group '/Geolocation Fields/ChunkNumber']));
0134 P.TIME=double(hdf5read(filename, ...
0135        ['/HDFEOS/SWATHS/' group '/Geolocation Fields/Time']));
0136 P.LOCALSOLARTIME=double(hdf5read(filename, ...
0137        ['/HDFEOS/SWATHS/' group '/Geolocation Fields/LocalSolarTime']));
0138 P.SOLARZENITHANGLE=double(hdf5read(filename, ...
0139        ['/HDFEOS/SWATHS/' group '/Geolocation Fields/SolarZenithAngle']));
0140 P.ORBITGEODETICANGLE=double(hdf5read(filename, ...
0141        ['/HDFEOS/SWATHS/' group '/Geolocation Fields/OrbitGeodeticAngle']));
0142 P.LINEOFSIGHTANGLE=double(hdf5read(filename, ...
0143        ['/HDFEOS/SWATHS/' group '/Geolocation Fields/LineOfSightAngle']));
0144 
0145 
0146 
0147 if ~do_column & ~strcmp( group, 'TPPressureWMO' )
0148   P.PRESSURE=double(hdf5read(filename, ...
0149        ['/HDFEOS/SWATHS/' group '/Geolocation Fields/Pressure']));
0150 end
0151 
0152 return
0153 
0154

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005