Home > atmlab > arts > scenegen > asg2y_3d_cloudsat.m

asg2y_3d_cloudsat

PURPOSE ^

ASG2Y_3D_cloudsat Performs 3D scattering calculations based on ASG data

SYNOPSIS ^

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

DESCRIPTION ^

 ASG2Y_3D_cloudsat   Performs 3D 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_3d_1dbz_scene*
    which is later called 

    FORMAT [Y,ydata,DY,G1] = asg2y_3d_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_3d_cloudsat.m

SOURCE CODE ^

0001 % ASG2Y_3D_cloudsat   Performs 3D 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_3d_1dbz_scene*
0011 %    which is later called
0012 %
0013 %    FORMAT [Y,ydata,DY,G1] = asg2y_3d_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 %  2007-11-26 created by XXX
0053 
0054 function [Y,ydata,DY,G1] = asg2y_3d_cloudsat(Gcs,grids_cs,C,Q,workfolder)
0055   
0056   
0057 %- Load CloudSat data
0058 %
0059 C.AUX       = {'DEM_elevation','Longitude','TAI_start','Profile_time'};
0060 lat_limits  = [ C.USE_LATS(1)-C.DLAT/2 C.USE_LATS(end)+C.DLAT/2 ];
0061 %make sure we read in also just outside lat_limits
0062 lat_out     = [ lat_limits(1)-0.1 lat_limits(end)+0.1 ];
0063 [Gdbz,Ddbz] = gfin_cloudsat_dBZe([],[],C.DATA,C.AUX,[],C.LEG,lat_out,[]);
0064 
0065 
0066 %- reduce the latitude resolution
0067 %  bin the data on a desired grid
0068 %
0069 grids{1} = Gdbz(1).GRID1;
0070 grids{1} = Gdbz(1).GRID1( find( Gdbz(1).GRID1>0 & Gdbz(1).GRID1<24e3 ) );
0071 grids{2} = lat_limits(1) : C.LAT_RES : lat_limits(end);
0072 %
0073 % Make sure that end points not have slipped outside covered range due to
0074 % numerical problems.
0075 %grids{2}(1)   = lat_limits(1);
0076 %grids{2}(end) = lat_limits(end);
0077 %
0078 [Gdbz,Ddbz]=gf_bin(Ddbz,Gdbz,grids,[1 2]);
0079 
0080 % Switch to pressure grid. Sort data in order to get decreasing pressures and
0081 % increasing latitudes.
0082 %
0083 tai_ind=find(strcmp({Gdbz.NAME},'TAI_start'));
0084 pt_ind=find(strcmp({Gdbz.NAME},'Profile_time'));
0085 dbz_ind=find(strcmp({Gdbz.NAME},'Radar_Reflectivity'));
0086 
0087 mjd1=date2mjd(1993,1,1,0,0,0);
0088 
0089 sec_of_day=60*60*24;
0090 mjd=mjd1+(Gdbz(tai_ind).DATA+mean(Gdbz(pt_ind).DATA))/sec_of_day;
0091 DOY = mjd2doy(mjd);
0092 Gdbz(dbz_ind).GRID1= z2p_cira86(Gdbz(dbz_ind).GRID1,mean(lat_limits),DOY );
0093 Ddbz.GRID1_NAME='Pressure';
0094 Ddbz.GRID1_UNIT='Pa';
0095 %
0096 
0097 % Set DIMADD or similar fields based on fields of C.
0098 %
0099 grids_dbz{3} = C.LON_GRID;
0100 Gdbz(dbz_ind).DIMADD=C.DIMADD;
0101 %
0102 
0103 %- Set Gdbz.GRID1
0104 %
0105 % Find part of P.??? that is inside C.P_LIMS.
0106 %
0107 limits=[fliplr(C.P_LIMS);lat_limits];
0108 [Gdbz(dbz_ind),Ddbz]=gf_crop(Ddbz,Gdbz(dbz_ind),limits,[1 2]);
0109 grids_dbz{1} = Gdbz(dbz_ind).GRID1;
0110 %
0111 
0112 %add the psd and ssp properties of the assumed particles
0113 %
0114 Gdbz(dbz_ind).PROPS=C.PROPS;
0115 
0116 %- Init Gcs1 (as Gcs but only holding a single case)
0117 %
0118 % Batch data are compacted below.
0119 %
0120 Gcs1 = Gcs;
0121 
0122 %- Make simulations for each selected latitude
0123 %
0124 for ip = 1 : length(C.USE_LATS)
0125 
0126   %- Extract clear sky fileds
0127   %
0128   for ig = 1 : length(Gcs)
0129     if any( Gcs(ig).DIMS == 4 )
0130       icase         = rem( ip-1, size(Gcs(ig).DATA,4) ) + 1;
0131       Gcs1(ig).DATA = Gcs(ig).DATA(:,:,:,icase);
0132       Gcs1(ig).DIMS = setdiff( Gcs(ig).DIMS, 4 );
0133     end
0134   end
0135   
0136   
0137   %- Extract CloudSat data
0138   %
0139   lat  = [C.USE_LATS(ip)-C.DLAT/2 C.USE_LATS(ip)+C.DLAT/2];
0140   limits=[fliplr(C.P_LIMS);lat];
0141   [G(ip),Ddbz]=gf_crop(Ddbz,Gdbz(dbz_ind),limits,[1 2]);  
0142   
0143   %place the grid on 0 degree latitude
0144   G(ip).GRID2= round( [G(ip).GRID2-mean(G(ip).GRID2)]*1000)/1000;
0145   grids_dbz{2} = G(ip).GRID2;
0146 
0147   %- Temperature and water vapor
0148   %
0149   % add the possibility to include ECMWF data
0150     
0151  
0152   %- Make calculations
0153   %
0154   [y,ydata,dy,G1{ip}] = asg2y_3d_1dbz_scene( Gcs1, grids_cs, G(ip), ...
0155                                                    grids_dbz, Q,workfolder );
0156   %
0157   if ip == 1
0158     Y  = zeros( length(y), length(C.USE_LATS) );
0159     DY = zeros( length(y), length(C.USE_LATS) );
0160   end
0161   %
0162   Y(:,ip)  = y;
0163   DY(:,ip) = dy;
0164   
0165 end
0166

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