Home > atmlab > demos > qpack2_t_demo.m

qpack2_t_demo

PURPOSE ^

QPACK2_T_DEMO2 A temperature retrieval demo

SYNOPSIS ^

function L2 = qpack2_t_demo

DESCRIPTION ^

 QPACK2_T_DEMO2   A temperature retrieval demo

    Similar to *qpack2_demo*, but used to test temperature retrievals. The
    set-up is simplified and adoptions needed for real inversions. Performs
    no plotting.

 FORMAT   L2 = qpack2_t_demo2
        
 OUT      L2   L2 data output from *qpack2*.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

DOWNLOAD ^

qpack2_t_demo.m

SOURCE CODE ^

0001 % QPACK2_T_DEMO2   A temperature retrieval demo
0002 %
0003 %    Similar to *qpack2_demo*, but used to test temperature retrievals. The
0004 %    set-up is simplified and adoptions needed for real inversions. Performs
0005 %    no plotting.
0006 %
0007 % FORMAT   L2 = qpack2_t_demo2
0008 %
0009 % OUT      L2   L2 data output from *qpack2*.
0010 
0011 % 2013-08-10   Created by Patrick Eriksson.
0012 
0013 function L2 = qpack2_t_demo
0014   
0015 errid = ['atmlab:' mfilename]; 
0016 
0017 %- Qarts settings
0018 %
0019 Q    = q_demo;           % Local file, found below
0020 
0021 
0022 %- Measurement data
0023 %
0024 Y = y_demo( Q );  
0025 
0026 
0027 %- OEM variables
0028 %
0029 O              = qp2_l2( Q );
0030 %
0031 O.linear       = false;
0032 %
0033 if ~O.linear 
0034   O.itermethod = 'GN';
0035   O.stop_dx    = 0.01;
0036   O.maxiter    = 10;
0037 end
0038 
0039 
0040 %- Make inversion
0041 %
0042 L2 = qpack2( Q, O, Y );
0043 
0044 return
0045 %-----------------------------------------------------------------------------
0046 %-----------------------------------------------------------------------------
0047 %-----------------------------------------------------------------------------
0048 
0049 
0050 
0051 
0052 
0053 function Q = q_demo
0054  
0055 errid = ['atmlab:' mfilename];
0056 
0057 %- Atmlab settings
0058 %
0059 arts_xmldata_path = atmlab( 'ARTS_XMLDATA_PATH' );
0060 arts_includes     = atmlab( 'ARTS_INCLUDES' );
0061 if isnan( arts_xmldata_path ) 
0062   error( errid,'You need to set ARTS_XMLDATA_PATH to run this exmaple.' );
0063 end
0064 if isnan( arts_includes )
0065   error( erird,'You need to ARTS_INCLUDES to run this example.' );
0066 end                                                      
0067 %
0068 fascod = fullfile( arts_xmldata_path, 'planets', 'Earth', 'Fascod' );
0069 
0070 
0071 %- Init Q
0072 %
0073 Q = qarts;
0074 %
0075 Q.INCLUDES            = { fullfile( 'ARTS_INCLUDES', 'general.arts' ), ...
0076                           fullfile( 'ARTS_INCLUDES', 'agendas.arts' ), ...
0077                           fullfile( 'ARTS_INCLUDES', 'continua.arts' ), ...
0078                           fullfile( 'ARTS_INCLUDES', 'planet_earth.arts' ) };
0079 Q.ATMOSPHERE_DIM      = 1;
0080 Q.STOKES_DIM          = 4;
0081 Q.J_DO                = true;
0082 Q.CLOUDBOX_DO         = false;
0083 
0084 
0085 %= Define agendas
0086 %
0087 Q.PPATH_AGENDA               = { 'ppath_agenda__FollowSensorLosPath'   };
0088 Q.PPATH_STEP_AGENDA          = { 'ppath_step_agenda__GeometricPath'    };
0089 Q.BLACKBODY_RADIATION_AGENDA = { 'blackbody_radiation_agenda__Planck'  };
0090 Q.IY_SPACE_AGENDA            = { 'iy_space_agenda__CosmicBackground'   };
0091 Q.IY_SURFACE_AGENDA          = { 'iy_surface_agenda__UseSurfaceRtprop' };
0092 Q.IY_MAIN_AGENDA             = { 'iy_main_agenda__Emission'            };
0093 
0094 
0095 %- Radiative transfer
0096 %
0097 Q.IY_UNIT             = 'RJBT'; 
0098 Q.YCALC_WSMS          = { 'yCalc' };
0099 %
0100 Q.PPATH_LMAX          = 250;
0101 
0102 
0103 %- Surface
0104 %
0105 Q.Z_SURFACE           = 50;
0106 
0107 
0108 %- Absorption
0109 %
0110 Q.ABS_LINES_FORMAT    = 'None';
0111 %
0112 Q.ABSORPTION          = 'OnTheFly';
0113 Q.ABS_NLS             = [];
0114 
0115 
0116 %- Pressure grid
0117 %
0118 z_toa                 = 95e3;
0119 %
0120 Q.P_GRID              = z2p_simple( Q.Z_SURFACE-500 : 500 : z_toa )';
0121 
0122 
0123 
0124 %- Spectrometer stuff
0125 %
0126 % A simple set-up, e.g. F_GRID too coarse around the transitions found
0127 % inside the frequency range
0128 %
0129 Q.F_GRID              = [52.2e9 : 10e6 : 53.2e9 ]';
0130 %
0131 H                     = qartsSensor;
0132 %
0133 H.SENSOR_NORM         = true;
0134 %
0135 H.BACKEND_DO          = true;
0136 df                    = 5e6;
0137 H.F_BACKEND           = ( min(Q.F_GRID)+df : df : max(Q.F_GRID)-df )';
0138 %
0139 B.name                = 'Spectrometer channel response function';
0140 B.gridnames           = { 'Frequency' };
0141 B.grids               = { [-df/2 df/2] };
0142 B.dataname            = 'Response';
0143 B.data                = [1 1];
0144 %
0145 H.BACKEND_CHANNEL_RESPONSE{1} = B;
0146 clear B
0147 %
0148 H.SENSOR_POL          = { 6 };
0149 %
0150 Q.SENSOR_DO           = true;
0151 Q.SENSOR_RESPONSE     = H;
0152 %
0153 Q.ANTENNA_DIM         = 1;
0154 Q.MBLOCK_ZA_GRID      = 0;
0155 
0156 
0157 
0158 %- Correlation of thermal noise
0159 %
0160 Q.TNOISE_C     = covmat1d_from_cfun( H.F_BACKEND, [], 'drc' );
0161 %
0162 clear H
0163 
0164 
0165 
0166 %- Define L2 structure (beside retrieval quantities below)
0167 %
0168 Q.L2_EXTRA     = { 'cost', 'dx', 'xa', 'y', 'yf', 'bl', 'ptz', ...
0169                    'mresp', 'A', 'e', 'eo', 'es', 'date', 'J' };
0170 
0171 
0172 %- Temperature
0173 %
0174 Q.T.RETRIEVE   = true;
0175 Q.T.ATMDATA    = gf_artsxml( fullfile( arts_xmldata_path, 'climatology', ...
0176                         'msis90', 'msis90.t.xml' ), 'Temperature', 't_field' );
0177 Q.T.L2         = true;
0178 Q.T.GRIDS      = { Q.P_GRID(1:4:end), [], [] };
0179 Q.T.SX         = covmat1d_from_cfun( Q.T.GRIDS{1}, 4, 'lin', 0.5, 0, @log10 );
0180 
0181 
0182 %- Determine altitudes through HSE
0183 %
0184 Q.HSE.ON       = true;
0185 Q.HSE.P        = Q.P_GRID(1);
0186 Q.HSE.ACCURACY = 0.1;
0187 
0188 
0189 %- Species
0190 
0191 %- Nitrogen
0192 %
0193 Q.ABS_SPECIES(1).TAG      = { 'N2' };
0194 Q.ABS_SPECIES(1).RETRIEVE = false;
0195 Q.ABS_SPECIES(1).ATMDATA  = gf_artsxml( fullfile( fascod, ...
0196       'midlatitude-summer', 'midlatitude-summer.N2.xml' ), 'N2', 'vmr_field' );
0197 
0198 %- Oxygen
0199 %
0200 Q.ABS_SPECIES(2).TAG      = { 'O2-PWR93' };
0201 Q.ABS_SPECIES(2).RETRIEVE = false;
0202 Q.ABS_SPECIES(2).ATMDATA  = gf_artsxml( fullfile( fascod, ...
0203       'midlatitude-summer', 'midlatitude-summer.O2.xml' ), 'O2', 'vmr_field' );
0204 
0205 %- Water vapour
0206 %
0207 Q.ABS_SPECIES(3).TAG      = { 'H2O' };
0208 Q.ABS_SPECIES(3).RETRIEVE = false;
0209 Q.ABS_SPECIES(3).ATMDATA  = gf_artsxml( fullfile( fascod, ...
0210     'midlatitude-summer', 'midlatitude-summer.H2O.xml' ), 'H2O', 'vmr_field' );
0211 
0212 return
0213 %-----------------------------------------------------------------------------
0214 %-----------------------------------------------------------------------------
0215 %-----------------------------------------------------------------------------
0216 
0217 
0218 
0219 
0220 function Y = y_demo(Q)
0221 
0222 % The data should be loaded from one or several files, but are here genereted
0223 % by a forward model call to show how qpack2 can also be used to generate
0224 % simulaled measurements (matching a priori assumptions).
0225 
0226 % The simulated data model airborn measurements at two different zenith
0227 % angles, from two nearby positions.
0228   
0229 % Init Y
0230 %
0231 Y = qp2_y;
0232 
0233 % Set a date
0234 %
0235 Y.YEAR  = 2008;
0236 Y.MONTH = 5;
0237 Y.DAY   = 25;
0238 
0239 % Lat / lon
0240 %
0241 Y.LATITUDE  = 45;
0242 Y.LONGITUDE = exp(1);
0243 
0244 
0245 Y.Z_PLATFORM = 50;
0246 Y.ZA         = 0;
0247 
0248 % Reference point for hydrostatic equilibrium
0249 %
0250 Y.HSE_P = 1000e2;
0251 Y.HSE_Z = 0;
0252 
0253 % Set backend frequencies
0254 %
0255 Y.F = Q.SENSOR_RESPONSE.F_BACKEND;
0256 
0257 % Thermal noise standard deviation
0258 %
0259 Y.TNOISE = 0.1;
0260 
0261 % Use FASCOD as true T profile
0262 fascod = fullfile( atmlab( 'ARTS_XMLDATA_PATH' ), ...
0263                                                 'planets', 'Earth', 'Fascod' );
0264 Q.T.ATMDATA  = gf_artsxml( fullfile( fascod, 'midlatitude-summer', ...
0265                       'midlatitude-summer.t.xml' ), 'Temperature', 't_field' );
0266   
0267 % Simulate a measurement
0268 %
0269 Y0   = Y;
0270 Y0.Y = []; 
0271 %
0272 Y = qpack2( Q, oem, Y0 ); 
0273 
0274 % Add thermal noise
0275 %
0276 Y.Y = Y.Y + Y.TNOISE .* make_noise( 1, Q.TNOISE_C );
0277 
0278 
0279

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