| 1 | This directory contains source codes of utilities (programs) that can be |
|---|
| 2 | used to process the LMD Mars GCM output files (like "diagfi" or |
|---|
| 3 | "stats"). |
|---|
| 4 | In addition most output file from one of these program can then be |
|---|
| 5 | processed by another. |
|---|
| 6 | |
|---|
| 7 | See script "compile" for instructions and recommendations to compile |
|---|
| 8 | the utilities. Once adequately modified, that script can be used to |
|---|
| 9 | compile each utility; e.g. to build the zrecast.e utility program: |
|---|
| 10 | > compile zrecast |
|---|
| 11 | |
|---|
| 12 | Note that inputs can be provided by (1) replying to questions on screen or |
|---|
| 13 | (2) filling the corresponding *.def and redirecting the input of these *.def |
|---|
| 14 | files instead. For example : |
|---|
| 15 | > concatnc.e < concatnc.def |
|---|
| 16 | > zrecast.e < zrecast.def |
|---|
| 17 | |
|---|
| 18 | -------------------------------------------------------------------- |
|---|
| 19 | 1) concatnc.e : concatenate successive GCM output files |
|---|
| 20 | -------------------------------------------------------------------- |
|---|
| 21 | |
|---|
| 22 | This program is used to concatenate consecutive |
|---|
| 23 | output files ("diagfi", and even "stats") for a selection of |
|---|
| 24 | variable, in order to obtain one single big file. The time dimension can |
|---|
| 25 | be "sols" or "Ls" (in that last case, Ls will not be linear, and |
|---|
| 26 | software like Grads may not be able to use it. To have a linear "Ls" |
|---|
| 27 | timescale, you can use "Ls_Linear.e" (see below). |
|---|
| 28 | You can also add a "Ls" variable corresponding solar longitude for each |
|---|
| 29 | timestep by using the "adls" option. |
|---|
| 30 | |
|---|
| 31 | Output file is : concat.nc |
|---|
| 32 | |
|---|
| 33 | -------------------------------------------------------------------- |
|---|
| 34 | 2) zrecast.e : put GCM data in physical vertical coordinate |
|---|
| 35 | -------------------------------------------------------------------- |
|---|
| 36 | |
|---|
| 37 | GCM outputs are in GCM hybrid coordinate which do not correspond to any |
|---|
| 38 | physical vertical coordinate ! zrecast is NECESSARY to make any publishable |
|---|
| 39 | scientific figure. |
|---|
| 40 | |
|---|
| 41 | This program reads 4D (lon-lat-alt-time) fields from GCM output files |
|---|
| 42 | (ie: diagfi.nc time series or concat.nc or stats.nc files) and, by |
|---|
| 43 | integrating the hydrostatic equation, recasts data along the vertical |
|---|
| 44 | direction. |
|---|
| 45 | The vertical coordinate can be either 1) pressure, 2) above areoid |
|---|
| 46 | altitudes, 3) above local surface altitudes or 4) distance to center of |
|---|
| 47 | the planet. Some interpolation along the vertical direction is also |
|---|
| 48 | done, following instructions given by user (levels may be specified |
|---|
| 49 | or given as minimu,maximum and number of levels). |
|---|
| 50 | For "above areoid altitudes" output, Atmospheric pressure is added to |
|---|
| 51 | output dataset; for "pressure coordinate" outputs, the above areoid |
|---|
| 52 | altitude of pressure is added to output dataset. |
|---|
| 53 | |
|---|
| 54 | Minimal requirements and dependencies: |
|---|
| 55 | The dataset must include the following data: |
|---|
| 56 | - surface pressure |
|---|
| 57 | - atmospheric temperature |
|---|
| 58 | - hybrid coordinates aps() and bps(), or sigma levels() |
|---|
| 59 | - ground geopotential (in input file; if not found, it is sought |
|---|
| 60 | in a 'diagfi.nc' file. If not found there, it is then sought in |
|---|
| 61 | a 'phisinit.nc' file (see section 1.3.3 of program) |
|---|
| 62 | |
|---|
| 63 | - When integration the hydrostatic equation, we assume that R, the |
|---|
| 64 | molecular Gas Constant, may not be constant, so it is computed as |
|---|
| 65 | R=P/(rho*T) (P=Pressure, rho=density, T=temperature) |
|---|
| 66 | If 'rho' is not available, then we use a constant R (see section |
|---|
| 67 | 2.2 in source file) |
|---|
| 68 | |
|---|
| 69 | - Vertical interpolation : note that density (kg.m-3) and species density |
|---|
| 70 | (e.g. in molecules.cm-3) must be vertically interpolated in log-space. For |
|---|
| 71 | that purpose, these variables names must start with "rho" (exemple : rho for |
|---|
| 72 | density, rho_co2, rho_o2, etc....) |
|---|
| 73 | |
|---|
| 74 | output file is : |
|---|
| 75 | name_of_input_file_P.nc with pressure coordinate |
|---|
| 76 | name_of_input_file_A.nc with altitude above areoid coordinate |
|---|
| 77 | name_of_input_file_S.nc with altitude above local surface coordinate |
|---|
| 78 | name_of_input_file_R.nc with altitude as distance to center of planet |
|---|
| 79 | |
|---|
| 80 | -------------------------------------------------------------------- |
|---|
| 81 | 3) localtime.e : put GCM data in local time coordinate |
|---|
| 82 | -------------------------------------------------------------------- |
|---|
| 83 | |
|---|
| 84 | Program to redistribute and interpolate the variable a the same |
|---|
| 85 | local times everywhere (useful to mimic satellite observations, or |
|---|
| 86 | analyse day to day variations at a given local time). |
|---|
| 87 | input : diagfi.nc / concat.nc / stats.nc kind of files |
|---|
| 88 | |
|---|
| 89 | output file is : name_of_input_file_LT.nc |
|---|
| 90 | |
|---|
| 91 | -------------------------------------------------------------------- |
|---|
| 92 | 4) lslin.e : redistribute and average gcm output in Ls coordinate. |
|---|
| 93 | -------------------------------------------------------------------- |
|---|
| 94 | |
|---|
| 95 | This program has been designed to interpolate data in Solar Longitude (Ls) |
|---|
| 96 | linear time coordinate (usable with grads) from Netcdf diagfi or concatnc |
|---|
| 97 | files, and to average the instantaneous data in periodic Ls intervals |
|---|
| 98 | (for comparison with binned dataset, for instance). |
|---|
| 99 | |
|---|
| 100 | lslin also creates a lslin.ctl file that can be read |
|---|
| 101 | directly by grads (>xdfopen lsllin.ctl) to plot in Ls coordinate to |
|---|
| 102 | avoid some problem with grads when grads think that "the time interval |
|---|
| 103 | is too small"... |
|---|
| 104 | |
|---|
| 105 | Output file is : name_of_input_file_Ls.nc |
|---|
| 106 | |
|---|
| 107 | -------------------------------------------------------------------- |
|---|
| 108 | 5) solzenangle.e : select GCM data at a given solar zenith angle |
|---|
| 109 | -------------------------------------------------------------------- |
|---|
| 110 | |
|---|
| 111 | Program to redistribute and interpolate the variable a the same |
|---|
| 112 | solar zenith angle (notably useful to mimic satellite observations and in particular |
|---|
| 113 | SOLAR OCCULTATIONS by choosing solar zenith angle = 90°) |
|---|
| 114 | The user choose between Morning and Evening side. |
|---|
| 115 | |
|---|
| 116 | input : diagfi.nc / concat.nc / stats.nc kind of files |
|---|
| 117 | |
|---|
| 118 | On the morning side output file (1 output per sol per grid point) is : |
|---|
| 119 | name_of_input_file_MO.nc |
|---|
| 120 | |
|---|
| 121 | On the evening side output file is (1 output per sol per grid point): |
|---|
| 122 | name_of_input_file_EV.nc |
|---|
| 123 | |
|---|
| 124 | -------------------------------------------------------------------- |
|---|
| 125 | 6) hrecast.e : interpolate data at another horizontal grid resolution. |
|---|
| 126 | -------------------------------------------------------------------- |
|---|
| 127 | |
|---|
| 128 | This program can interpolate GCM output on any horizontal grid (regular |
|---|
| 129 | lat - lon) as long as it cover all the planet. |
|---|
| 130 | The grid can be given points by points. The best way is to use the |
|---|
| 131 | redirected input hrecast.def |
|---|
| 132 | |
|---|
| 133 | hrecast.e < hrecast.def |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | -------------------------------------------------------------------- |
|---|
| 137 | 7) expandstartfi.e : to plot data in a startfi.nc file |
|---|
| 138 | -------------------------------------------------------------------- |
|---|
| 139 | |
|---|
| 140 | In startfi.nc file, data are not plotable because the horizontal coordinate |
|---|
| 141 | in only a 1D list of all atmospheric columns on the planets. |
|---|
| 142 | This program takes a physics start file ("startfi.nc") and recasts it |
|---|
| 143 | on the corresponding lonxlat grid (so it contents may easily be displayed |
|---|
| 144 | using Python, Grads, Ferret, etc.) |
|---|
| 145 | |
|---|
| 146 | Simply run expandstartfi.e as a command line with arguments: |
|---|
| 147 | |
|---|
| 148 | expandstartfi.e [infile.nc] [outfile.nc] |
|---|
| 149 | |
|---|
| 150 | (if infile is not specified, "startfi.nc" is used as default) |
|---|
| 151 | (if outfile is not specified, it is built as "infile_ex.nc") |
|---|
| 152 | |
|---|
| 153 | -------------------------------------------------------------------- |
|---|
| 154 | 8) extract.e : get data at specific coordinates for comparison with observations |
|---|
| 155 | -------------------------------------------------------------------- |
|---|
| 156 | |
|---|
| 157 | This program extracts (ie: interpolates) pointwise values of an atmospheric |
|---|
| 158 | variable from a 'zrecast'ed diagfi file (works if altitude is geometrical |
|---|
| 159 | height or a pressure vertical coordinates) |
|---|
| 160 | user has to specify: |
|---|
| 161 | - name of input file |
|---|
| 162 | - date (in sols) offset wrt the input file (e.g. if the input file "begins" |
|---|
| 163 | at Ls=0, then the offset is 0; if the input file begins at Ls=90, the |
|---|
| 164 | offset date corresponding to the first 3 months is 61+66+66=193 sols, etc.) |
|---|
| 165 | NB: that means the input file must have its "Time" coordinate in sols |
|---|
| 166 | - the "extraction mode": |
|---|
| 167 | 1: extract individual values; user will specify values of |
|---|
| 168 | lon lat alt Ls LT (all on a same line) |
|---|
| 169 | on as many lines as there are sought values |
|---|
| 170 | 2: extract a profile: user will specify on a first line the values of |
|---|
| 171 | lon lat Ls LT (all on a same line) |
|---|
| 172 | and then only specify values of altitudes (m or Pa depending on the |
|---|
| 173 | coordinate in the input file), one per line, at which values are |
|---|
| 174 | sought |
|---|
| 175 | - output values are sent to (ASCII) output file 'infile_var_.dat', where |
|---|
| 176 | 'infile' is the input file name (without trailing '.nc') and |
|---|
| 177 | 'var' is the sought variable, for extraction mode 1 as |
|---|
| 178 | lines of "lon lat alt Ls LT value" and for a profile (extraction mode 2) |
|---|
| 179 | as lines of "alt value" |
|---|
| 180 | |
|---|
| 181 | NB: If there is no data to do an appropriate interpolation to extract |
|---|
| 182 | the sought value, then a "missing_value" (taken from the variable's |
|---|
| 183 | attribute in the input file, most likely -9.99E33) is returned. |
|---|
| 184 | |
|---|
| 185 | See files "extract.points.def" and "extract.profile.def" for examples of |
|---|
| 186 | input format that would simply need to be redirected to extract.e, e.g.: |
|---|
| 187 | |
|---|
| 188 | extract.e < extract.points.def |
|---|
| 189 | |
|---|
| 190 | -------------------------------------------------------------------- |
|---|
| 191 | 9) aeroptical.e : compute aerosol opacities at a given wavelength |
|---|
| 192 | -------------------------------------------------------------------- |
|---|
| 193 | |
|---|
| 194 | Program to compute opacity profiles opa_[aer] (1/km) of aerosols |
|---|
| 195 | at a wavelength given by the user. |
|---|
| 196 | Computation is made from the aerosol mass mixing ratios and effective radius, |
|---|
| 197 | associated with air density (rho) and files containing the aerosol |
|---|
| 198 | optical properties (generally present in the GCM datadir/ directory). |
|---|
| 199 | The user have to precise the type of opacity : extinction or absorption. |
|---|
| 200 | The user can also ask to compute the column-integrated optical depth tau_[aer]. |
|---|
| 201 | |
|---|
| 202 | NB : this program requires to compile the module aeropt_mod.F90 |
|---|
| 203 | at the same time |
|---|
| 204 | |
|---|
| 205 | input : diagfi.nc / concat.nc / stats.nc kind of files |
|---|
| 206 | |
|---|
| 207 | output file is : |
|---|
| 208 | name_of_input_file_OPAext.nc for extinction opacities |
|---|
| 209 | name_of_input_file_OPAabs.nc for absorption opacities |
|---|
| 210 | |
|---|
| 211 | aeroptical.e < aeroptical.def |
|---|