Skip to content
Snippets Groups Projects
Commit 547bbab7 authored by WAUTELET Philippe's avatar WAUTELET Philippe
Browse files

Beginning of open source history

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 287 additions and 0 deletions
\section{Conversion to NetCDF files}
\subsection{{\tt lfi2cdf} tool}
The \texttt{lfi2cdf} tool converts the binary part (or LFI file) of a
FM file (synchronous or diachronic) into a NetCDF file. All the fields
(or more precisely all the LFI articles) contained in the input LFI file
are copied to the NetCDF output file with their values unchanged. As
a LFI article does not hold any information on the variable, the tool
tries to describe the corresponding NetCDF variable by using~:
\begin{itemize}
\item 3 LFI articles: \texttt{IMAX, JMAX,} and \texttt{KMAX}
if they are available in the LFI input file. These articles may
provide the NetCDF dimensions \texttt{DIMX, DIMY,} and \texttt{DIMZ}
of an array variable. If these variables are not available in the
input file, the tool treats each array variable as a 1D array.
\item a small database implemented as a structure array in the
\texttt{lfi2cdf} source file \texttt{fieldtype.f90}. This array
holds the type (\texttt{REAL, INTEGER, LOGICAL}\ldots) of every
common LFI article. When an article is not present in this database,
its name is displayed on \texttt{stdout} by the running tool, and
the corresponding values are always considered as \texttt{REAL}
values. A new LFI article type description can be easily added in
the \texttt{fieldtype.f90} source file and the tool must be then
recompiled.
\end{itemize}
\subsubsection{Usage}
The binary part of the FM file is required in the current directory.
The following commands convert a file \texttt{myfile.lfi} from LFI to NetCDF:
\begin{verbatim}
lfi2cdf myfile.lfi
\end{verbatim}
or
\begin{verbatim}
lfi2cdf myfile
\end{verbatim}
\noindent The output NetCDF file is named:
\texttt{myfile.cdf}.
%myfile{\bf .cdf}.
It can easily be manipulated by NetCDF tools\footnote{see
freely available NetCDF software at http://www.unidata.ucar.edu/packages/netcdf/software.html} like
\texttt{ncdump}, \texttt{ncview}, or \texttt{NCO} operators.\\
\noindent In the same way, you will convert a NetCDF
file \texttt{myfile.cdf} back to LFI format by typing:
\begin{verbatim}
cdf2lfi myfile.cdf
\end{verbatim}
or
\begin{verbatim}
cdf2lfi myfile
\end{verbatim}
The output LFI file is then named: \texttt{myfile.lfi}
\subsection{{\tt extractdia} tool}
The \texttt{extractdia} tool converts a diachronic FM file into a NetCDF file after an extraction of a list of fields and an optional extraction of a sub-domain. See the section \ref{extractdia}.
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "tools"
%%% End:
This diff is collapsed.
\section{Compression of FM files}
A specific compression tool has been developed for FM files. This
tool, called {\tt lfiz}, was first devoted for files that will be
explored by the graphic utility {\tt diaprog}. In fact, it is also
used for files used during a simulation (initial and coupling files)
to reduce the data storage. Some information of how the compression
works is given here, its execution is particularly easy.
\subsection{{\tt lfiz} tool}
The \texttt{lfiz} tool works on the binary part (LFI file) of a FM
file, synchronous or diachronic. It is a lossy compression tool.
The compressed articles are exclusively the 2-dimensional or
3-dimensional \texttt{REAL} fields. When dealing with 3D fields the tool works
with each 2D plane on every vertical level. The initial values stored
with 64-bit \texttt{REAL} precision are first converted into 32-bit
\texttt{REAL} precision and then compressed by mapping the 32-bit
real values upon 16-bit integer values (with a possible isolation of
extrema values). The better compression is
achieved for fields with small value range. For fields with missing
value (e.g. 2-dimensional fields with land-sea mask), the extremum
value is excluded and the compression is done on significant values of
the field. The minimum compression ratio is 4 for each 2D or 3D
\texttt{REAL} compressed field.
\subsection{{\tt unlfiz} tool}
The \texttt{unlfiz} tool will restore the 64-bit \texttt{REAL} value size to all
the compressed LFI articles. However, each previously compressed article
will gain no more than a 32-bit \texttt{REAL} precision because of the lossy
technique involved above.
\subsection{Usage}
The binary part of the FM file is required in the current
directory. To compress the file \texttt{myfile.lfi}, you can type:
\begin{verbatim}
lfiz myfile.lfi
\end{verbatim}
\noindent This will produce the compressed file \texttt{myfile.Z.lfi}\\
\noindent In the same way, to uncompress the file \texttt{myfile.Z.lfi}, you can
type:
\begin{verbatim}
unlfiz myfile.Z.lfi
\end{verbatim}
\noindent The output file \texttt{myfile.lfi} is a valid LFI file but the LFI
articles previously compressed are 64-bit \texttt{REAL} with no more than 32-bit
\texttt{REAL} precision.
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "tools"
%%% End:
This diff is collapsed.
\documentclass[12pt]{article}
\usepackage[latin1]{inputenc}
\usepackage{epsfig}
\setlength{\textwidth}{16.cm}
\setlength{\textheight}{24.cm}
%\oddsidemargin=+1.6cm
%\evensidemargin=+0.6cm
\voffset=-1.8cm
\hoffset=-1.cm
%\makeindex
\begin{document}
%%%%%%%%%% Definition of new commands for LATEX :
%
\newcommand{\ignore}[1]{}
%
%
\title {Tools related to Meso-NH model}
\author{N. Asencio, J. Duron, J. Escobar, D. Gazen, P. Jabouille, I. Mallet}
\date{\today}
\maketitle
\tableofcontents
\include{intro}
\include{lfiz}
\include{conv2dia}
\include{lfi2cdf}
\include{extract}
\include{lfi2grb}
\end{document}
This diff is collapsed.
#
#compute_r00_pc
#==============
# Version PC de la routine compute_r00 utilisee dans le programme DIAG
#(voir la doc. "Lagrangian trajectory and air-mass tracking analyses with
#MesoNH by means of Eulerian passive tracers", Gheusi and Stein, 2003)
# On garde la structure F90 et la routine d'interpolation (interpxyz) mais on
#utilise les routines de lecture/ecriture de fichiers diachroniques
#(READVAR et WRITEVAR)
#
# il faut disposer
# 1)des fichiers diachroniques contenant les champs Lagrangiens LGXM,LGYM,LGZM
#(conversion par conv2dia de fichiers synchrones issus d une simulation avec LLG=T)
# 2)d'un fichier de namelist nommé compute_r00.nam, contenant le nom des
# fichiers diachroniques et eventuellement une liste de champs supplementaires
# devant etre concatenes, ex:
cat<<'eof' >compute_r00.nam
&NAM_STO_FILE CFILES(1)='AR40_mc2_19990921.00d.Z',
CFILES(2)='AR40_mc2_19990920.12d.Z',
CFILES(3)='AR40_mc2_19990920.00d.Z',
CFILES(4)='AR40_mc2_19990919.12d.Z',
CFILES(5)='AR40_mc2_19990919.00d.Z',
NSTART_SUP(1)=3 /
&NAM_FIELD CFIELD_LAG(1)='THM',
CFIELD_LAG(2)='RVM' /
eof
#
# initialiser
export DIRLFI=directory_fichier_diachro # facultatif si les fichiers sont dans le repertoire courant
# initialiser la variable ARCH (LXNAGf95 sur PC, HPf90 sur HP)
export ARCH=LXNAGf95
# executer
$MESONH/MAKE/tools/diachro/$ARCH/compute_r00_pc
#
# Les champs (X000,Y000,Z000,THM00,RVM00) sont concatenes depuis l instant
#initial (celui du dernier fichier de NAM_STO_FILE, CFILES(5) dans l exemple)
#jusqu'a l'instant du fichier traite (tous sauf le dernier de NAM_STO_FILE).
#Dans l exemple ci-dessus, une deuxieme serie de champs
#(X001,Y001,Z001,THM01,RVM01) sont concatenes depuis l'instant du fichier
#repere par NSTART_SUP(1) (CFILES(3) dans l exemple).
#Ces champs supplementaires sont ajoutes a ceux du fichier traite.
#Les possibilites de trace sont elargies puisque champs Lagrangiens concatenes
#et champs synchrones sont dans le meme fichier.
#
#
#personnalisation :
#=================
# cf $MESONH/MAKE/tools/diachro/exrwdia.LISEZMOI
#
# Pour modifier le programme:
#
# *initialiser et exporter la variable MNH_LIBTOOLS
#
export MNH_LIBTOOLS=$MESONH/MAKE
#
# *dans votre repertoire de travail:
# copier le fichier Makefile.exrwdia de $MNH_LIBTOOLS/tools/diachro
#
cp $MNH_LIBTOOLS/tools/diachro/Makefile.exrwdia Makefile
#
# *creer un repertoire qui contiendra les fichiers sources nommé src
# puis y copier exrwdia.f90, le modifier eventuellement
#
mkdir src
cp $MNH_LIBTOOLS/tools/diachro/src/EXTRACTDIA/compute_r00_pc.f90 src/.
#
# compiler par
#
gmake PROG=compute_r00_pc
#
# *completer le Makefile (liste des objets dans OBJS et dependances)
# si vous ajoutez des routines (exemple dans
# $MESONH/MAKE/tools/diachro/Makefile.extractdia)
#
# Mise à jour le 30/04/2004
&NAM_STO_FILE CFILES(1)='AR40_mc2_19990921.00d.Z',
CFILES(2)='AR40_mc2_19990920.12d.Z',
CFILES(3)='AR40_mc2_19990920.00d.Z',
CFILES(4)='AR40_mc2_19990919.12d.Z',
CFILES(5)='AR40_mc2_19990919.00d.Z' /
&NAM_FIELD CFIELD_LAG(1)='THM',
CFIELD_LAG(2)='RVM' /
This diff is collapsed.
This diff is collapsed.
#! /bin/sh
FILE=${1:-Bret45.99082200dg.Z}
#DIRLFI=${2:-.}
export DIRLFI
#
ARCH=LXNAGf95
B=32
#
rm ${FILE}*zc*
/mesonh/MAKE/tools/diachro/${ARCH}_${B}/extractdia << EOF
$FILE
ZCDL
5
1,10,1,10
1,1,1,1,1,1
3
1500 3000 5000
LALO
LAT
ALT
LON
END
EOF
This diff is collapsed.
#! /bin/sh
FILE=${1:-Bret45.99082200dg.Z}
DIRLFI=${2:-.}
export DIRLFI
#
ARCH=LXNAGf95
B=32
#
rm ${FILE}LLHV
/mesonh/MAKE/tools/diachro/${ARCH}_${B}/extractdia << EOF
$FILE
LLHV
0
1,10,1,10,2,5
1,1,1,1,1,1
FF
THM
DD
END
EOF
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment