#DEFINITIONS: -*-sh-*- # Simple simulations of ground-based measurements of ozone at 110.8 GHz, # mainly to test different sensor response methods. # User defined variables are also used heavily, to set up consistent # frequency grids inside the control file (instead of loading files). # This includes the generation of a compact, non-uniform, f_grid. # # Author: Patrick Eriksson Arts2 { INCLUDE "general/general.arts" INCLUDE "general/agendas.arts" INCLUDE "general/planet_earth.arts" # Agenda for scalar gas absorption calculation Copy(abs_xsec_agenda, abs_xsec_agenda__noCIA) # (standard) emission calculation Copy( iy_main_agenda, iy_main_agenda__Emission ) # standard surface agenda (i.e., make use of surface_rtprop_agenda) Copy( iy_surface_agenda, iy_surface_agenda__UseSurfaceRtprop ) # sensor-only path Copy( ppath_agenda, ppath_agenda__FollowSensorLosPath ) # no refraction Copy( ppath_step_agenda, ppath_step_agenda__GeometricPath ) # Number of Stokes components to be computed IndexSet( stokes_dim, 1 ) # ---- f_grid ---------------------------------------------------------------- NumericCreate( v0 ) NumericCreate( fw ) IndexCreate( nlogpart ) NumericCreate( fw_fine ) NumericCreate( df_fine ) # Centre frequency NumericSet( v0, 1.108360400e+11 ) # One sided width of f_grid NumericSet( fw, 330e6 ) # Numer of points (on each side) of logarithmic part IndexSet( nlogpart, 35 ) # One sided width of fine grid at centre of f_grid NumericSet( fw_fine, 240e3 ) # Spacing of this fine grid NumericSet( df_fine, 40e3 ) # A logarithmically spaced grid between [fw_fine,fw] NumericCreate( f1 ) NumericCreate( f2 ) VectorCreate( flog ) Copy( f1, fw_fine ) Copy( f2, fw ) VectorNLogSpace( flog, nlogpart, f1, f2 ) # First part of f_grid is flog "mirrored" VectorFlip( f_grid, flog ) VectorScale( f_grid, f_grid, -1 ) # Append an equidistant grid between [-fw_fine+df_fine,fw_fine-df_fine] VectorCreate( feqd ) Copy( f1, fw_fine ) NumericScale( f1, f1, -1 ) NumericAdd( f1, f1, df_fine ) NumericScale( f2, f1, -1 ) VectorLinSpace( feqd, f1, f2, df_fine ) Append( f_grid, feqd ) # Append flog Append( f_grid, flog ) # Add v0 VectorAddScalar( f_grid, f_grid, v0 ) # ---- Species --------------------------------------------------------------- abs_speciesSet( species=[ "O3", "H2O" ] ) # ---- Atmospheric scenario -------------------------------------------------- # Dimensionality of the atmosphere AtmosphereSet1D # A pressure grid rougly matching 0 to 80 km in 500 m steps. VectorNLogSpace( p_grid, 160, 1.013e5, 1 ) AtmRawRead( basename = "testdata/tropical" ) AtmFieldsCalc # ---- Absorption ------------------------------------------------------------ ReadXML( abs_lines, "testdata/ozone_line.xml" ) abs_lines_per_speciesCreateFromLines abs_cont_descriptionInit AbsInputFromAtmFields abs_speciesSet( abs_species=abs_nls, species=[] ) VectorSet( abs_nls_pert, [] ) VectorSet( abs_t_pert, [] ) abs_xsec_agenda_checkedCalc jacobianOff abs_lookupCalc # absorption from LUT Copy( propmat_clearsky_agenda, propmat_clearsky_agenda__LookUpTable ) # ---- Observation geometry -------------------------------------------------- NumericCreate( z_platform ) NumericCreate( za ) # Platform altitude NumericSet( z_platform, 50 ) # Zenith angle NumericSet( za, 60 ) MatrixSetConstant( sensor_pos, 1, 1, z_platform ) Copy( z_surface, sensor_pos ) MatrixSetConstant( sensor_los, 1, 1, za ) # ---- Finalise atmosphere --------------------------------------------------- cloudboxOff atmfields_checkedCalc atmgeom_checkedCalc cloudbox_checkedCalc # Important to run HSE before yCalc if temperature jacobians with HSE # will be used. A latitude and longitude must here be specified. Extract( p_hse, p_grid, 0 ) NumericSet( z_hse_accuracy, 0.1 ) VectorSet( lat_true, [58] ) VectorSet( lon_true, [-12] ) # z_fieldFromHSE # ---- Turn off cosmic background radiation --------------------------------- # This to faciliate comparison of spectra from the different observation modes AgendaSet( iy_space_agenda ){ Ignore( rtp_pos ) Ignore( rtp_los ) nelemGet( nelem, f_grid ) MatrixSetConstant( iy, nelem, stokes_dim, 0 ) } # --- Common sensor settings ------------------------------------------------- FlagOn( sensor_norm ) StringSet( iy_unit, "RJBT" ) NumericCreate( f_resolution ) NumericCreate( f_switch ) # Resolution (and also channel spacing) of spectrometer NumericSet( f_resolution, 500e3 ) # Size of frequency throw NumericSet( f_switch, 10e6 ) VectorCreate( f_resolution_v ) VectorSetConstant( f_resolution_v, 1, f_resolution) backend_channel_responseGaussian( backend_channel_response, f_resolution_v, [2] ) # Calculate where first channel can start (considering f_switch and # channel widths) Copy( f1, fw ) NumericScale( f1, f1, -1 ) NumericAdd( f1, f1, f_switch ) NumericAdd( f1, f1, f_resolution ) Copy( f2, f1 ) NumericScale( f2, f2, -1 ) VectorLinSpace( f_backend, f1, f2, f_resolution ) VectorAddScalar( f_backend, f_backend, v0 ) VectorCreate(yREFERENCE) # --- Spectrum for "direct" observation (load switching) --------------------- AntennaOff sensor_responseInit sensor_responseBackend # jacobianOff # propmat_clearsky_agenda_checkedCalc sensor_checkedCalc # yCalc # WriteXML( output_file_format, y, "TestGbased.y1.xml" ) WriteXML( output_file_format, y_f, "TestGbased.f.xml" ) ReadXML( yREFERENCE, "TestGbased.y1REFERENCE.xml") Compare( y, yREFERENCE, 1e-4) # --- Beam switching --------------------------------------------------------- NumericCreate( za_negative ) Copy( za_negative, za ) NumericScale( za_negative, za_negative, -1 ) VectorCreate( za_vector ) VectorNLinSpace( za_vector, 2, za_negative, 0 ) Matrix1ColFromVector( mblock_dlos_grid, za_vector ) sensor_responseInit sensor_responseBeamSwitching sensor_responseBackend sensor_checkedCalc yCalc # WriteXML( output_file_format, y, "TestGbased.y2.xml" ) ReadXML( yREFERENCE, "TestGbased.y2REFERENCE.xml") Compare( y, yREFERENCE, 1e-4) # --- Frequency switching ----------------------------------------------------- Copy( f1, f_switch ) NumericScale( f1, f1, -1 ) AntennaOff sensor_responseInit sensor_responseBackendFrequencySwitching( sensor_response, sensor_response_f, sensor_response_pol, sensor_response_dlos, sensor_response_f_grid, sensor_response_pol_grid, sensor_response_dlos_grid, f_backend, backend_channel_response, sensor_norm, f1, f_switch ) sensor_checkedCalc yCalc # WriteXML( output_file_format, y, "TestGbased.y3.xml" ) ReadXML( yREFERENCE, "TestGbased.y3REFERENCE.xml") Compare( y, yREFERENCE, 1e-4) }