Changeset 262 for trunk/MESOSCALE_DEV/MANUAL/SRC/postproc.tex
- Timestamp:
- Aug 5, 2011, 4:48:44 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MESOSCALE_DEV/MANUAL/SRC/postproc.tex
r261 r262 2 2 3 3 \vk 4 In this chapter, the user is introduced to the principles of choosing the outputs from the LMD Martian Mesoscale Model. Elements about post-processing are also proposed here, although it is obviously left to the user to choose and develop its own tools to analyzingthe results of LMD Martian Mesoscale Model computations.4 In this chapter, the user is introduced to the principles of choosing the outputs of the LMD Martian Mesoscale Model. Elements about post-processing (interpolation, graphics) are also proposed here, although it is obviously left to the user to choose and develop its own tools to analyze the results of LMD Martian Mesoscale Model computations. 5 5 6 6 \mk … … 9 9 \sk 10 10 All non-local variables communicated within subroutines and functions in the WRF dynamical core are declared in a text file named \ttt{Registry.EM} located in \ttt{\$MMM/SRC/WRFV2/Registry}. In this file, each useful variable is declared through a one-line instance organized as follows: 11 11 12 \scriptsize 12 13 \begin{verbatim} … … 14 15 \end{verbatim} 15 16 \normalsize 17 18 \sk 16 19 The fields which appears in \ttt{wrfout*} output files feature an \ttt{h} (which stands for history) in the 8th column. If you do not want the field to appear in \ttt{wrfout*} files, simply remove the letter \ttt{h} from the group of letters in the 8th column. If you want the field to appear in \ttt{wrfout*} files, simply add the letter \ttt{h} in the group of letters in the 8th column. 17 20 18 21 \sk 19 22 It is also possible to output fields which are present only in the physical computations, i.e. appearing in \ttt{\$MMM/SRC/WRFV2/mars\_lmd/libf/phymars/physiq.F}. The method is simple. Assume you would like to output in the \ttt{wrfout*} files a 3D field named \ttt{zdtnirco2} and a 2D field named \ttt{qsurfice} in \ttt{physiq.F} with the new names \ttt{HR\_NIR} and \ttt{QSURFICE}. All you have to do is add the following lines to \ttt{Registry.EM} (see also examples around lines \ttt{75-120}. For 2D [3D] files the 4th column must be \ttt{ij} [\ttt{ikj}] and the 12th column \ttt{\#SAVEMARS2} [\ttt{\#SAVEMARS3}]. 23 20 24 \scriptsize 21 25 \begin{verbatim} … … 26 30 27 31 \sk 28 Each change in \ttt{Registry.EM} must be followed by a complete recompilation because the model variables have changed. If you use \ttt{makemeso}, please answer \ttt{y} to the question \scriptsize \ttt{Did you modify anything in the Registry or clean ?} \normalsize. If you use \ttt{runmeso}, please use it withoption \ttt{-r} to force recompiling with a new/updated list of variables.32 Each change in \ttt{Registry.EM} must be followed by a complete recompilation because the model variables have changed. Whether you use \ttt{makemeso} or \ttt{runmeso}, use the option \ttt{-r} to force recompiling with a new/updated list of variables. 29 33 30 34 \sk … … 37 41 38 42 \sk 39 The fields output in \ttt{wrfout*} files are given for each grid point and model level s. A vertical interpolation has to be performed to get those fields either in altitude or pressure levels. In addition, perturbation potential temperature \ttt{T}, x-component wind \ttt{U} and y-component \ttt{V} are output instead of the more informative (meteorogically-speaking) temperature \ttt{tk}, zonal wind \ttt{Um} and meridional wind \ttt{Vm}. This is why we developed a program named \ttt{api} (Altitude and Pressure Interpolator) which performs the tasks to convert the netCDF \ttt{wrfout*} files into another netCDF file featuring useful fields for making plots and analyzing the Martian mesoscale meteorology more easily than raw \ttt{wrfout*} files.43 The fields output in \ttt{wrfout*} files are given for each grid point and model level. A vertical interpolation has to be performed to get those fields either in altitude or pressure levels. In addition, perturbation potential temperature \ttt{T}, x-component wind \ttt{U} and y-component \ttt{V} are output instead of the more informative (meteorogically-speaking) temperature \ttt{tk}, zonal wind \ttt{Um} and meridional wind \ttt{Vm}. This is why we developed a program named \ttt{api} (Altitude and Pressure Interpolator) which performs the tasks to convert the netCDF \ttt{wrfout*} files into another netCDF file featuring more useful fields to make plots and analyze the Martian mesoscale meteorology. 40 44 41 45 \sk 42 The useful source files are located in \ttt{\$MMM/SRC/POSTPROC/}. The program \ttt{api.F90} has to be compiled with the \ttt{comp\_api} command (which must be edited first to uncomment the line corresponding to the Fortran compiler you are used to). Then the user has to fill in the parameter file \ttt{namelist.api} (a commented example is given below, but many examples can be found in \ttt{\$MMM/SRC/POSTPROC/}) before launching the interpolator through the command \ttt{api}. The calculations might be long if you are asking for many fields and many interpolation levels. In the example below, temperature, meteorological winds and vertical velocity will be interpolated at~$50$~m above the local surface. The results are output in a netCDF file having the same name as the input \ttt{wrfout*} files, with an additional suffix which depends on the chosen interpolation method.46 The source files for \ttt{api} are located in \ttt{\$MMM/SRC/POSTPROC/}. The program \ttt{api.F90} has to be compiled with the \ttt{comp\_api} command (which must be edited first, to uncomment the line corresponding to the Fortran compiler you are used to). Then the user has to fill in the parameter file \ttt{namelist.api} before launching the interpolator through the command \ttt{api}. A commented template for \ttt{namelist.api} is given below (this examples and many others can be found in \ttt{\$MMM/SRC/POSTPROC/}). The calculations might be long if you are asking for many fields and many interpolation levels. In the example below, temperature, meteorological winds and vertical velocity are interpolated at~$50$~m above the local surface. The results are output in a netCDF file having the same name as the input \ttt{wrfout*} files, with an additional suffix which depends on the chosen interpolation method. 43 47 44 48 \scriptsize … … 47 51 48 52 \mk 49 \section{Generating maps for winds and meteorological fields }\label{plots}53 \section{Generating maps for winds and meteorological fields simulated by the model}\label{plots} 50 54 51 55 \sk … … 53 57 54 58 \sk 55 This section does not replace the need for you to develop your own plotting tools to suit your needs, which should be not too difficult. The model outputs, as well as the results of \ttt{api} interpolations, are written using the netCDF format which can be read by most software w hich features graphical capabilities. For a quick inspection of model results (especially for checking model outputs while the model is running), we recommend using \ttt{ncview}; for simple manipulations of netCDF files (e.g. concatenation, difference, extraction, \ldots), we recommend using commands from the \ttt{nco} package (see chapter~\ref{install} for website links). Graphical routines based on \ttt{idl} (most graphics in the published papers to date about the LMD Martian Mesoscale Model makes use of this software), \ttt{ferret} and \ttt{grads} can be made available upon request (as is, i.e. undocumented yet commented scripts). Successful reading/plotting of the LMD Martian Mesoscale Model outputs on \ttt{matlab}, \ttt{octave}, \ttt{idv} have also been reported to us. It is also possible to import the model's outputs to Geographical Information System (GIS) such as \ttt{arcgis}. Note that \ttt{idl}, \ttt{matlab} and \ttt{arcgis} are commercial applications.59 This section does not replace the need for you to develop your own plotting tools to suit your needs, which should be not too difficult. The model outputs, as well as the results of \ttt{api} interpolations, are written using the netCDF format which can be read by most software with graphical capabilities. For a quick inspection of model results (especially for checking model outputs while the model is running), we recommend using \ttt{ncview}; for simple manipulations of netCDF files (e.g. concatenation, difference, extraction, \ldots), we recommend using commands from the \ttt{nco} package (see chapter~\ref{install} for website links). Graphical routines based on \ttt{idl}\footnote{Most graphics in the published papers to date about the LMD Martian Mesoscale Model were made with this software}, \ttt{ferret} and \ttt{grads} can be made available upon request (as is, i.e. undocumented yet commented scripts). Successful reading/plotting of the LMD Martian Mesoscale Model outputs on \ttt{matlab}, \ttt{octave}, \ttt{idv} are also reported. It is possible to import the model's outputs to Geographical Information System (GIS) such as \ttt{arcgis}\footnote{\ttt{idl}, \ttt{matlab} and \ttt{arcgis} are neither open-source nor free.}. 56 60 57 61 \sk … … 59 63 60 64 \sk 61 Powerful scripts based on \ttt{python+numpy+matplotlib} have been recently developed to obtain plots from the mesoscale model outputs. All figures in this user manual are based on these scripts. Those scripts can be found in \ttt{\$MMM/SRC/PYTHON}: \ttt{domain.py} and \ttt{winds.py} (more scripts will be added in the future). It is required that \ttt{python} and numerical+graphical librairies (\ttt{numpy}, \ttt{scipy}, \ttt{matplotlib}, \ttt{basemap}, \ttt{netcdf} are installed on your system. Perhaps the simplest way to do so is to install the user-friendly \ttt{epd} complete python distribution (cf. link in chapter~\ref{install}). One of the advantages of an approach using \ttt{python}, apart from its open-source philosophy and the abundant online documentation, is that in a common framework it allows for scripting with various options, integrating Fortran routines, manipulating arrays, making plots with various map projections. This is exemplified by the \ttt{winds.py} script we developed: it can perform interpolation with \ttt{api} for the level requested by the user,then generate a map, all that in one simple command line. For instance, Figures~\ref{arsia} in chapter~\ref{compile} has been generated by the following two commands:65 Powerful scripts based on \ttt{python+numpy+matplotlib} have been developed to obtain plots from the mesoscale model outputs. All figures in this user manual are based on the scripts \ttt{domain.py} and \ttt{winds.py} (more scripts will be available in the future). Those scripts can be found in \ttt{\$MMM/SRC/PYTHON}. It is required that \ttt{python} and numerical/graphical librairies (\ttt{numpy}, \ttt{scipy}, \ttt{matplotlib}, \ttt{basemap}, \ttt{netcdf} are installed on your system. Perhaps the simplest way to do so is to install the user-friendly complete python distribution \ttt{epd} (cf. link in chapter~\ref{install}). One of the advantages of an approach using \ttt{python}, apart from its open-source philosophy and the abundant online documentation, is that in a common framework it allows for scripting with various options, integrating Fortran routines, manipulating arrays, making plots with various map projections. This is exemplified by the \ttt{winds.py} script. It can both perform interpolation with \ttt{api} for the level requested by the user then generate a map, all that in one simple command line. For instance, Figures~\ref{arsia} in chapter~\ref{compile} has been generated by the following two commands: 62 66 63 67 \scriptsize … … 68 72 \normalsize 69 73 70 Many options can be used in our \ttt{python} scripts. The example of command \ttt{winds.py} at the time of writing is listed below; this information can be obtained by typing \ttt{winds.py -h}. This script can also be easily edited to suit your needs if the option you wouldneed does not exist.74 Many options can be used in our \ttt{python} scripts. The example of command \ttt{winds.py} at the time of writing is listed below; this information can be obtained by typing \ttt{winds.py -h}. This script can also be easily edited to suit your needs if the option you need does not exist. 71 75 72 76 \scriptsize … … 81 85 PATH=$PYTHONPATH:$PATH 82 86 \end{verbatim} 83 \item The option \ttt{-i} in \ttt{winds.py} make use of the Fortran routine \ttt{api.F90} (and the routine \ttt{time.F} is also needed). Th is routine has to be converted to a \ttt{python} commandusing \ttt{f2py}. Please execute the script amongst \ttt{api\_g95.sh}, \ttt{api\_ifort.sh}, \ttt{api\_pgf90.sh} which corresponds to the Fortran compiler installed on your system. Check for errors/warnings in the log files and ensure that the two files \ttt{api.so} and \ttt{timestuff.so} are generated.87 \item The option \ttt{-i} in \ttt{winds.py} make use of the Fortran routine \ttt{api.F90} (and the routine \ttt{time.F} is also needed). The routines have to be converted to \ttt{python} commands using \ttt{f2py}. Please execute the script amongst \ttt{api\_g95.sh}, \ttt{api\_ifort.sh}, \ttt{api\_pgf90.sh} which corresponds to the Fortran compiler installed on your system. Check for errors/warnings in the log files and ensure that the two files \ttt{api.so} and \ttt{timestuff.so} are generated. 84 88 \end{finger} 85 89
Note: See TracChangeset
for help on using the changeset viewer.