Home > atmlab > deprecated > common_read_cpr_2BCWCRO.m

common_read_cpr_2BCWCRO

PURPOSE ^

common_read_cpr_2BCWCRO Read CloudSat CPR data in the common format (see README)

SYNOPSIS ^

function S = common_read_cpr_2BCWCRO(file, varargin)

DESCRIPTION ^

 common_read_cpr_2BCWCRO Read CloudSat CPR data in the common format (see README)

 This file reads data from a CloudSat CPR file and rearranges the fields to
 the common format.

 FORMAT

   data = common_read_cpr(file[, extra])

 IN

   file    string      Path to zipped CPR file
   extra   cell array (optional) extra fields.

 OUT

   data    struct  With fields:
                   time    time in seconds since 00:00 UT
                   lat     latitude in degrees, one column per viewing angle
                   lon     longitude in [-180, 180] degrees, colums as for lat

 $Id: common_read_cpr_2BCWCRO.m 8243 2013-02-27 22:05:14Z seliasson $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

common_read_cpr_2BCWCRO.m

SOURCE CODE ^

0001 function S = common_read_cpr_2BCWCRO(file, varargin)
0002 
0003 % common_read_cpr_2BCWCRO Read CloudSat CPR data in the common format (see README)
0004 %
0005 % This file reads data from a CloudSat CPR file and rearranges the fields to
0006 % the common format.
0007 %
0008 % FORMAT
0009 %
0010 %   data = common_read_cpr(file[, extra])
0011 %
0012 % IN
0013 %
0014 %   file    string      Path to zipped CPR file
0015 %   extra   cell array (optional) extra fields.
0016 %
0017 % OUT
0018 %
0019 %   data    struct  With fields:
0020 %                   time    time in seconds since 00:00 UT
0021 %                   lat     latitude in degrees, one column per viewing angle
0022 %                   lon     longitude in [-180, 180] degrees, colums as for lat
0023 %
0024 % $Id: common_read_cpr_2BCWCRO.m 8243 2013-02-27 22:05:14Z seliasson $
0025 
0026 if (nargin==1)
0027     warning(['atmlab:' mfilename], ['Calling ' mfilename ' with 1 argument ' ...
0028                 'is deprecated. Four additional fields will be included for ' ...
0029                 'backward compatibility. Pass empty cell-array if this is ' ...
0030                 'not desired!']);
0031 end
0032 
0033 core_fields = {'Longitude'; 'Latitude'; 'UTC_start'; 'Profile_time'; 'product_version'};
0034 extra_fields = optargs(varargin, {{'RO_ice_water_path'; 'RO_ice_water_path_uncertainty'; 'IO_RO_ice_water_path'; 'IO_RO_ice_water_path_uncertainty'}});
0035 all_fields = [core_fields; extra_fields];
0036 %S = cloudsat_read_zipped(file, all_fields);
0037 S = read_cloudsat_hdf(file, all_fields);
0038 
0039 % construct time axis with same dimensions
0040 S.time = S.UTC_start + S.Profile_time;
0041 
0042 % rename some fields
0043 
0044 S.lon = double(S.Longitude(:));
0045 S.lat = double(S.Latitude(:));
0046 S.version = S.product_version; % will be written to NetCDF
0047 
0048 % add filename
0049 
0050 S.path = file;
0051 
0052 % get epoch
0053 
0054 info = find_info_from_granule('cpr', file);
0055 date = dayofyear_inverse(str2double(info.year), str2double(info.doy));
0056 S.epoch = round(date2unixsecs(date.year, date.month, date.day));
0057 
0058 % remove redundant fields
0059 S = rmfield(S, {'Longitude', 'Latitude', 'UTC_start', 'Profile_time', 'product_version'});
0060 
0061 % convert 1-D fields into column vectors. This is required for processing.
0062 flds = fieldnames(S);
0063 for i = 1:length(flds)
0064     fld = flds{i};
0065     if isvector(S.(fld))
0066         S.(fld) = S.(fld)(:);
0067     end
0068 end
0069 
0070 end

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