Home > atmlab > arts > scenegen > asg2y_1d_cloudsat.m

asg2y_1d_cloudsat

PURPOSE ^

ASG2Y_1D_cloudsat Performs 1D scattering calculations based on ASG data

SYNOPSIS ^

function [Y,ydata,DY,G1] = asg2y_1d_cloudsat(Gcs,grids_cs,C,Q,workfolder)

DESCRIPTION ^

 ASG2Y_1D_cloudsat   Performs 1D scattering calculations based on ASG data 

    Calculates spectrum/spectra considering scattering, where the spatial
    structure of the clouds is taken from radar data.

    Reads in Cloudsat radar data from selected parts
    of the orbits based on the fields of *C*.
    The radar data are shifted in latitude
    to be centered around 0 degrees.
    Prepares data for the function *asg2y_1d_1dbz_scene*
    which is later called 

    FORMAT [Y,ydata,DY,G1] = asg2y_1d_cloudsat(Gcs,grids_cs,C,Q,workfolder)

 OUT   y           As returned by *arts_y*.
       ydata       As returned by *arts_y*.
       dy          As returned by *arts_y*.
       G1          modified G format data
 IN    Gcs         Specification of clear sky fields, in gformat.
       grids_cs    Initial grids for clear sky fields. These grids are used
                   as put into Q before calling *asg_atmgrids*. Obtained
                   grids are used e.g. when calling *asg_rndmz* for clear 
                   sky fields. 
                   The input is given as an array of vectors, where element  
                   1 corresponds to Q.P_GRID, element 2 Q.LAT_GRID and 
                   element 3 Q.LON_GRID. 
       C           A cloud definition structure with fields
         DATA           name of datafile to be read in
         LEG            leg of cloudsat data 
         USE_LATS       latitude midpoints
         DLAT           latitude (scalar)
         LAT_RES        latitude resolution (scalar)
         LON_GRID       longitude grid 
         C.P_LIMS       pressure limits
         DIMADD         (see asg_dimadd)
         PROPS
                    a psd and ssp defintiion structure 
                    C.PROPS(1) corresponds to the radar frequency             
                    C.PROPS(2) corresponds to the instrument frequencys 
                    with fields                    
             SSP    single scattering properties data
             PSD    particle size distribution, only 'MH97' works
             method psd method, only 'gauss-laguerre' works
             x      particle sizes (see help gauss_laguerre)
             w      weights
             x_norm normalistaion factor 
             shape  particle shape, only 'sphere' works 
                
       Q           Qarts structure. See above.
       workfolder  Used as input to *asg2q*.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

asg2y_1d_cloudsat.m

SOURCE CODE ^

0001 % ASG2Y_1D_cloudsat   Performs 1D scattering calculations based on ASG data
0002 %
0003 %    Calculates spectrum/spectra considering scattering, where the spatial
0004 %    structure of the clouds is taken from radar data.
0005 %
0006 %    Reads in Cloudsat radar data from selected parts
0007 %    of the orbits based on the fields of *C*.
0008 %    The radar data are shifted in latitude
0009 %    to be centered around 0 degrees.
0010 %    Prepares data for the function *asg2y_1d_1dbz_scene*
0011 %    which is later called
0012 %
0013 %    FORMAT [Y,ydata,DY,G1] = asg2y_1d_cloudsat(Gcs,grids_cs,C,Q,workfolder)
0014 %
0015 % OUT   y           As returned by *arts_y*.
0016 %       ydata       As returned by *arts_y*.
0017 %       dy          As returned by *arts_y*.
0018 %       G1          modified G format data
0019 % IN    Gcs         Specification of clear sky fields, in gformat.
0020 %       grids_cs    Initial grids for clear sky fields. These grids are used
0021 %                   as put into Q before calling *asg_atmgrids*. Obtained
0022 %                   grids are used e.g. when calling *asg_rndmz* for clear
0023 %                   sky fields.
0024 %                   The input is given as an array of vectors, where element
0025 %                   1 corresponds to Q.P_GRID, element 2 Q.LAT_GRID and
0026 %                   element 3 Q.LON_GRID.
0027 %       C           A cloud definition structure with fields
0028 %         DATA           name of datafile to be read in
0029 %         LEG            leg of cloudsat data
0030 %         USE_LATS       latitude midpoints
0031 %         DLAT           latitude (scalar)
0032 %         LAT_RES        latitude resolution (scalar)
0033 %         LON_GRID       longitude grid
0034 %         C.P_LIMS       pressure limits
0035 %         DIMADD         (see asg_dimadd)
0036 %         PROPS
0037 %                    a psd and ssp defintiion structure
0038 %                    C.PROPS(1) corresponds to the radar frequency
0039 %                    C.PROPS(2) corresponds to the instrument frequencys
0040 %                    with fields
0041 %             SSP    single scattering properties data
0042 %             PSD    particle size distribution, only 'MH97' works
0043 %             method psd method, only 'gauss-laguerre' works
0044 %             x      particle sizes (see help gauss_laguerre)
0045 %             w      weights
0046 %             x_norm normalistaion factor
0047 %             shape  particle shape, only 'sphere' works
0048 %
0049 %       Q           Qarts structure. See above.
0050 %       workfolder  Used as input to *asg2q*.
0051 
0052 %  2008-02-06 created by Bengt Rydberg
0053 
0054 function [Y,ydata,DY,G1] = asg2y_1d_cloudsat(Gcs,grids_cs,C,Q,workfolder)
0055   
0056   
0057 
0058 %- Load CloudSat data
0059 %
0060 C.AUX       = {'DEM_elevation','Longitude','TAI_start','Profile_time'};
0061 lat_limits  = [ C.USE_LATS(1)-C.DLAT/2 C.USE_LATS(end)+C.DLAT/2 ];
0062 %make sure we read in also just outside lat_limits
0063 lat_out     = [ lat_limits(1)-0.1 lat_limits(end)+0.1 ];
0064 [Gdbz,Ddbz] = gfin_cloudsat_dBZe([],[],C.DATA,C.AUX,[],C.LEG,lat_out,[]); 
0065 
0066 %order the desired cloudsat data in structures
0067 for i=1:length(C.USE_LATS)
0068     
0069     %- reduce the latitude resolution
0070     %  bin the data on a desired grid
0071     %
0072     grids{1} = Gdbz(1).GRID1;
0073     grids{1} = Gdbz(1).GRID1( find( Gdbz(1).GRID1>0 & Gdbz(1).GRID1<24e3 ) );
0074     grids{2} = [C.USE_LATS(i)-C.DLAT/2 C.USE_LATS(i) C.USE_LATS(i)+C.DLAT/2];
0075     %
0076     [Gdbz1,Ddbz]=gf_bin(Ddbz,Gdbz,grids,[1 2]);
0077     
0078    
0079     % Switch to pressure grid. Sort data in order to get decreasing pressures
0080     % and increasing latitudes.
0081     tai_ind=find(strcmp({Gdbz1.NAME},'TAI_start'));
0082     pt_ind=find(strcmp({Gdbz1.NAME},'Profile_time'));
0083     dbz_ind=find(strcmp({Gdbz1.NAME},'Radar_Reflectivity'));
0084 
0085     mjd1=date2mjd(1993,1,1,0,0,0);
0086 
0087     sec_of_day=60*60*24;
0088     mjd=mjd1+(Gdbz1(tai_ind).DATA+mean(Gdbz1(pt_ind).DATA))/sec_of_day;
0089     DOY = mjd2doy(mjd);
0090     Gdbz1(dbz_ind).GRID1= ...
0091              z2p_cira86(Gdbz1(dbz_ind).GRID1,mean(lat_limits),DOY );
0092     Ddbz.GRID1_NAME='Pressure';
0093     Ddbz.GRID1_UNIT='Pa';
0094 
0095     %- Set Gdbz.GRID1
0096     %
0097     % Find part of P.??? that is inside C.P_LIMS.
0098     % and the latitude region of interest
0099 
0100     limits=[fliplr(C.P_LIMS);lat_limits];
0101     limits=[fliplr(C.P_LIMS);...
0102         C.USE_LATS(i)-C.DLAT/2+0.1 C.USE_LATS(i)+C.DLAT/2-0.1 ];
0103     [Gdbz1(dbz_ind),Ddbz]=gf_crop(Ddbz,Gdbz1(dbz_ind),limits,[1 2]);
0104     Gdbz1(dbz_ind).DIMS=1;   
0105     Gdbz1(dbz_ind).GRID2=[]; 
0106 
0107     %add the psd and ssp properties of the assumed particles
0108     %
0109     Gdbz1(dbz_ind).PROPS=C.PROPS;
0110 
0111     %write the fields to a new variable
0112     Gdbz2{i}=Gdbz1; 
0113 end
0114 
0115 
0116 %- Init Gcs1 (as Gcs but only holding a single case)
0117 %
0118 
0119 Gcs1 = Gcs;
0120 
0121 %- Make simulations for each selected latitude
0122 %
0123 for ip = 1 : length(C.USE_LATS)
0124 
0125   %- Extract clear sky fileds
0126   %
0127   for ig = 1 : length(Gcs)
0128     if any( Gcs(ig).DIMS == 2 )
0129       icase         = find(Gcs(ig).GRID2==C.USE_LATS(ip));
0130       Gcs1(ig).DATA = Gcs(ig).DATA(:,icase);
0131       Gcs1(ig).GRID2= [];
0132       Gcs1(ig).DIMS = 1;
0133     end
0134   end
0135   
0136   G=Gdbz2{ip}(dbz_ind);
0137   grids_dbz{1} = G.GRID1;
0138   %
0139   
0140   
0141   %- Make calculations
0142   %
0143   [y,ydata,dy,G1{ip}] = asg2y_1d_1dbz_scene( Gcs1, grids_cs, G, ...
0144                                                    grids_dbz, Q,workfolder );
0145   %
0146   if ip == 1
0147     Y  = zeros( length(y), length(C.USE_LATS) );
0148     DY = zeros( length(y), length(C.USE_LATS) );
0149   end
0150   %
0151   Y(:,ip)  = y;
0152   %DY(:,ip) = dy;
0153   
0154 end

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