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

Merge branch 'LIBTOOLS-master' into MNH-52X

parents b3954b2c bc64fa68
No related branches found
No related tags found
No related merge requests found
Showing
with 5419 additions and 0 deletions
#include <stdio.h>
#include "ieee754.h"
#include <math.h>
#ifdef NO_UNDERSCORE
# define NEAREST_POW2 nearest_pow2
# define MINBITS_IN_WORD minbits_in_word
# define FMINBITS_IN_WORD fminbits_in_word
#else
# define NEAREST_POW2 nearest_pow2_
# define MINBITS_IN_WORD minbits_in_word_
# define FMINBITS_IN_WORD fminbits_in_word_
#endif
void NEAREST_POW2(union ieee754_double *xval, unsigned int *pow)
{
if (xval->d != 0.0)
*pow = xval->ieee.exponent - IEEE754_DOUBLE_BIAS;
else {
printf("Warning : NEAREST_POW2 ne traite que des reels > 0.0\n");
*pow = 0;
}
}
void MINBITS_IN_WORD(int *nval, unsigned int *nbit)
{
union ieee754_double xval;
int ival = *nval;
/* ne fonctionne qu'avec des entiers non signs */
if (ival-- < 0){
printf("Warning : MINBITS_IN_WORD ne traite que des entiers POSITIFS.\n");
*nbit = -1;
return;
} else
if (ival > 0){
xval.d = (double)ival;
NEAREST_POW2(&xval,nbit);
(*nbit)++;
} else
*nbit = 0 ;
}
int FMINBITS_IN_WORD(int *nval)
{
union ieee754_double xval;
int ival = *nval;
unsigned int nbit;
/* ne fonctionne qu'avec des entiers non signs */
if (ival < 0){
printf("Warning : MINBITS_IN_WORD ne traite que des entiers POSITIFS.\n");
return -1;
} else {
if (ival > 0){
xval.d = (double)ival;
NEAREST_POW2(&xval,&nbit);
nbit++;
} else
nbit = 0 ;
return nbit;
}
}
/* int main(){ */
/* double x; */
/* int i,nbit; */
/* int exp2; */
/* printf("Reel : "); */
/* scanf("%lf",&x); */
/* nearest_pow2_((union ieee754_double*)&x,&exp2); */
/* printf("2**%d = %lf est la puissance de 2 la plus proche et inferieure %lf\n", */
/* exp2,pow(2.,exp2),x); */
/* printf("%lf <= %lf <= %lf\n",pow(2.,(double)exp2),x,pow(2.,(double)exp2+1.)); */
/* printf("Entier positif : "); */
/* scanf("%d",&i); */
/* minbits_in_word_(&i,&nbit); */
/* printf("%d valeurs : %d bits (2**%d = %d).\n",i,nbit,nbit,(1<<nbit)); */
/* } */
!-----------------------------------------------------------------
!--------------- special set of characters for RCS information
!-----------------------------------------------------------------
! $Source$ $Revision$ $Date$
!-----------------------------------------------------------------
!-----------------------------------------------------------------
MODULE MODE_SEARCHGRP
IMPLICIT NONE
TYPE SOP_t
INTEGER :: NBGRP
INTEGER,DIMENSION(:),POINTER :: IBEG
INTEGER,DIMENSION(:),POINTER :: IEND
INTEGER,DIMENSION(:),POINTER :: VALMIN
INTEGER,DIMENSION(:),POINTER :: VALMAX
END TYPE SOP_t
INTEGER,EXTERNAL :: FMINBITS_IN_WORD
! Private variables
INTEGER,SAVE, PRIVATE :: IGRP
INTEGER,DIMENSION(:),ALLOCATABLE,TARGET,PRIVATE :: IBEG,IEND,VALMAX,VALMIN
INTEGER,PARAMETER, PRIVATE :: MAINSEUIL=8
INTEGER,SAVE, PRIVATE :: IGRPMAX
INTEGER,SAVE, PRIVATE :: ICOUNT
INTEGER,DIMENSION(16),PARAMETER, PRIVATE :: MINELT=(/4,4,4,4,5,5,6,6,7,8,9,11,13,17,26,51/)
! Private routines
PRIVATE :: RECSEARCH_GRP
CONTAINS
SUBROUTINE INI_SOPDATA(SOPDATA)
TYPE(SOP_t), INTENT(OUT) :: SOPDATA
SOPDATA%NBGRP = 0
NULLIFY(SOPDATA%IBEG)
NULLIFY(SOPDATA%IEND)
NULLIFY(SOPDATA%VALMIN)
NULLIFY(SOPDATA%VALMAX)
END SUBROUTINE INI_SOPDATA
SUBROUTINE RECSEARCH(KTAB,SOPDATA)
INTEGER,DIMENSION(:) :: KTAB
TYPE(SOP_t), INTENT(OUT) :: SOPDATA
INTEGER :: NELT
INTEGER :: GELT,BGELT
IF (ALLOCATED(IBEG)) THEN
DEALLOCATE(IBEG,IEND,VALMAX,VALMIN)
END IF
NELT=SIZE(KTAB)
ALLOCATE(IBEG(NELT),IEND(NELT),VALMAX(NELT),VALMIN(NELT))
ICOUNT = 0
IGRP = 0
IGRPMAX = NELT
CALL RECSEARCH_GRP(1,NELT,KTAB,MAINSEUIL)
GELT = MAXVAL(IEND(1:IGRP)-IBEG(1:IGRP)+1)
BGELT = FMINBITS_IN_WORD(GELT)
#ifdef DEBUG
PRINT *,'Routine RECSEARCH_GRP appelee',ICOUNT,'fois.'
PRINT *,'Nbre de groupes =',IGRP
PRINT *,'Nbre maxi d''elements dans groupes',GELT
PRINT *,'Nbre de bits pour coder le nombre d''elements:',BGELT
#endif
SOPDATA%NBGRP=IGRP
SOPDATA%IBEG=>IBEG
SOPDATA%IEND=>IEND
SOPDATA%VALMIN=>VALMIN
SOPDATA%VALMAX=>VALMAX
END SUBROUTINE RECSEARCH
RECURSIVE SUBROUTINE RECSEARCH_GRP(IND1,IND2,ITAB,ISEUIL)
INTEGER, INTENT(IN) :: IND1,IND2,ISEUIL
INTEGER,DIMENSION(:),INTENT(IN) :: ITAB
INTEGER :: II
INTEGER :: IMAX,IMIN
INTEGER :: IVAL
INTEGER :: nbitcod
INTEGER :: tmpidx1,tmpidx2
ICOUNT=ICOUNT+1
IF (IGRP == 0) THEN
IMIN = MINVAL(ITAB(IND1:IND2))
IMAX = MAXVAL(ITAB(IND1:IND2))
IGRP = 1
VALMIN(IGRP) = IMIN
VALMAX(IGRP) = IMAX
IBEG(IGRP) = IND1
IEND(IGRP) = IND2
ELSE
IMIN = VALMIN(IGRP)
IMAX = VALMAX(IGRP)
END IF
IF (IMAX > IMIN) THEN
IBEG(IGRP) = IND1
IEND(IGRP) = IND1
VALMIN(IGRP) = ITAB(IND1)
VALMAX(IGRP) = ITAB(IND1)
DO II=IND1,IND2-1
IVAL = ITAB(II+1)
IMAX=MAX(VALMAX(IGRP),IVAL)
IMIN=MIN(VALMIN(IGRP),IVAL)
IF ((IMAX-IMIN)<(2**ISEUIL)) THEN
! II+1 belong to group IGRP
IEND(IGRP) = II+1
VALMIN(IGRP) = IMIN
VALMAX(IGRP) = IMAX
ELSE
! Search the created group
nbitcod=FMINBITS_IN_WORD(VALMAX(IGRP)-VALMIN(IGRP))
#ifdef DEBUG
PRINT *,'F:(IGRP,IBEG,IEND,MAX,MIN,nbitcod)=',IGRP,',',IBEG(IGRP),',',IEND(IGRP),',',VALMAX(IGRP),',',VALMIN(IGRP),',',nbitcod
#endif
IF (IEND(IGRP)-IBEG(IGRP)>MINELT(nbitcod+1)) THEN
IF (nbitcod > 0) THEN
tmpidx1=IBEG(IGRP)
tmpidx2=IEND(IGRP)
#ifdef DEBUG
PRINT *,'Appel 1 RECSEARCH_GRP (first,last,seuil):',tmpidx1,tmpidx2,nbitcod/2
#endif
CALL RECSEARCH_GRP(tmpidx1,tmpidx2,ITAB,nbitcod/2)
END IF
ELSE
IF (IGRP > 1) THEN
nbitcod=FMINBITS_IN_WORD(VALMAX(IGRP-1)-VALMIN(IGRP-1))
IMIN=MIN(VALMIN(IGRP-1),VALMIN(IGRP))
IMAX=MAX(VALMAX(IGRP-1),VALMAX(IGRP))
IF (IEND(IGRP-1)-IBEG(IGRP-1)<=MINELT(nbitcod+1)) THEN
IF ((IMAX-IMIN) < 2**15) THEN
! concat IGRP-1 and IGRP
IEND(IGRP-1) = IEND(IGRP)
VALMIN(IGRP-1) = IMIN
VALMAX(IGRP-1) = IMAX
IGRP = IGRP-1
END IF
ELSE
IF (FMINBITS_IN_WORD(IMAX-IMIN) <= nbitcod) THEN
! concat IGRP-1 and IGRP
IEND(IGRP-1) = IEND(IGRP)
VALMIN(IGRP-1) = IMIN
VALMAX(IGRP-1) = IMAX
IGRP = IGRP-1
END IF
END IF
END IF
END IF
! New group is created
IGRP = IGRP+1
IF (IGRP>IGRPMAX) THEN
PRINT *,'ERROR max number of group exceeded !'
STOP
END IF
IBEG(IGRP) = II+1
IEND(IGRP) = II+1
VALMIN(IGRP) = IVAL
VALMAX(IGRP) = IVAL
END IF
END DO
#ifdef DEBUG
PRINT *,'L:',IGRP,':',VALMAX(IGRP)-VALMIN(IGRP),FMINBITS_IN_WORD(VALMAX(IGRP)-VALMIN(IGRP))
#endif
nbitcod = FMINBITS_IN_WORD(VALMAX(IGRP)-VALMIN(IGRP))
IF (IEND(IGRP)-IBEG(IGRP)>= MINELT(nbitcod+1)) THEN
IF (nbitcod > 0) THEN
tmpidx1=IBEG(IGRP)
tmpidx2=IEND(IGRP)
#ifdef DEBUG
PRINT *,'Appel 2 RECSEARCH_GRP (first,last,seuil):',tmpidx1,tmpidx2,nbitcod/2
#endif
CALL RECSEARCH_GRP(tmpidx1,tmpidx2,ITAB,nbitcod/2)
END IF
END IF
END IF
END SUBROUTINE RECSEARCH_GRP
END MODULE MODE_SEARCHGRP
SUBROUTINE INVERTCOL(ITAB,KX,KY)
IMPLICIT NONE
INTEGER, INTENT(IN) :: KX,KY
INTEGER,DIMENSION(KX,KY), INTENT(INOUT)::ITAB
ITAB(:,2:KY:2) = ITAB(KX:1:-1,2:KY:2)
END SUBROUTINE INVERTCOL
GRIB_DIR=$(wildcard gribex*)
SUBDIRS = NEWLFI COMPRESS MPIvide RAD2 SURCOUCHE vis5d
.PHONY: subdirs $(SUBDIRS) $(GRIB_DIR)
ifndef ARCH
VALID_ARCH=$(subst ../conf/config.,,$(wildcard ../conf/config.*))
dummy %:
@echo "ERROR : ARCH variable is not set !";echo
@echo "Please, choose one of these statements then try again :";echo " "
@for i in $(VALID_ARCH); do echo export ARCH=$$i; done
else
subdirs: $(SUBDIRS) $(GRIB_DIR)
$(SUBDIRS):
$(MAKE) -C $@
$(GRIB_DIR):
@echo "==========================================================================="
@echo "GRIB library : please go into $@ directory and see README files"
@echo " in order to generate manually the GRIB library."
@echo "==========================================================================="
clean distclean:
@for dir in $(SUBDIRS) $(GRIB_DIR); do \
$(MAKE) -C $$dir $@; \
done
endif
F77FLAGS += -O3 -assume byterecl
CFLAGS += -O2
CPPFLAGS += -DLINUX -DSWAPIO
OBJS = NEWLFI_ALL.o poub.o fswap8buff.o
DIR_OBJ = ./$(ARCH)
VPATH = src:$(DIR_OBJ)
DIR_CONF:=$(shell pwd|sed -e 's/lib\/.*/conf/')
include $(DIR_CONF)/config.$(ARCH)
include Rules.$(ARCH)
OBJS = binio.o v5d.o
# The following are dependencies generated by running makedepend:
all : libv5d.a
libv5d.a : $(DIR_OBJ)/.dummy $(OBJS)
cd $(DIR_OBJ) ; $(AR) crv $@ $(OBJS)
binio.o: binio.c binio.h
$(CC) -c $(CFLAGS) $< -o $(DIR_OBJ)/$@
v5d.o: v5d.c binio.h v5d.h vis5d.h
$(CC) -c $(CFLAGS) $< -o $(DIR_OBJ)/$@
$(DIR_OBJ)/.dummy :
mkdir -p $(DIR_OBJ)
@touch $(DIR_OBJ)/.dummy
tar :
tar cvf vis5d.tar Makefile Rules* binio.c binio.h v5d.c v5d.h vis5d.h
clean :
(if [ -d $(DIR_OBJ) ] ; then cd $(DIR_OBJ) ; rm -f $(OBJS); fi)
distclean:
rm -rf $(DIR_OBJ)
CC = cc
#CFLAGS = -c -O2 -DUNDERSCORE -DLITTLE
CFLAGS = -c -O2 -DUNDERSCORE -DVPP
OBJETS = binio.o v5d.o
# The following are dependencies generated by running makedepend:
all : libv5d.a
libv5d.a : $(OBJETS)
ar crv $@ $?
binio.o: binio.c binio.h
$(CC) $(CFLAGS) binio.c
v5d.o: binio.h v5d.h vis5d.h v5d.c
$(CC) $(CFLAGS) v5d.c
tar :
tar cvf libvis5d.tar Makefile binio.c binio.h v5d.c v5d.h vis5d.h
clean :
rm -rf libv5d.a $(OBJETS)
#CFLAGS += -DUNDERSCORE -DVPP
#CFLAGS += -DUNDERSCORE -DLITTLE
CFLAGS += -DUNDERSCORE
#CFLAGS += -DUNDERSCORE -DVPP
#CFLAGS += -DUNDERSCORE -DLITTLE
CFLAGS += -DUNDERSCORE
#
# Don't forget -DLITTLE flag for little-endian architecture
#
#CFLAGS += -DUNDERSCORE -DVPP
CFLAGS += -DUNDERSCORE -DLITTLE
#CFLAGS += -DUNDERSCORE -DVPP
#CFLAGS += -DUNDERSCORE -DLITTLE
CFLAGS += -DUNDERSCORE
CFLAGS += -DUNDERSCORE
CFLAGS += -DUNDERSCORE -DVPP
/* Vis5D version 5.1 */
/*
Vis5D system for visualizing five dimensional gridded data sets
Copyright (C) 1990 - 1997 Bill Hibbard, Johan Kellum, Brian Paul,
Dave Santek, and Andre Battaiola.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Functions to do binary I/O of floats, ints.
*
* >>>> These functions are built on top of Unix I/O functions, not stdio! <<<<
*
* The file format is assumed to be BIG-ENDIAN.
* If this code is compiled with -DLITTLE and executes on a little endian
* CPU then byte-swapping will be done.
*
* If an ANSI compiler is used prototypes and ANSI function declarations
* are used. Otherwise use K&R conventions.
*
* If we're running on a CRAY (8-byte ints and floats), conversions will
* be done as needed.
*/
/*
* Updates:
*
* April 13, 1995, brianp
* added cray_to_ieee and iee_to_cray array conversion functions.
* fixed potential cray bug in write_float4_array function.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef _CRAY
# include <string.h>
#endif
#include "binio.h"
/**********************************************************************/
/****** Byte Flipping *****/
/**********************************************************************/
#define FLIP4( n ) ( (n & 0xff000000) >> 24 \
| (n & 0x00ff0000) >> 8 \
| (n & 0x0000ff00) << 8 \
| (n & 0x000000ff) << 24 )
#define FLIP2( n ) (((unsigned short) (n & 0xff00)) >> 8 | (n & 0x00ff) << 8)
/*
* Flip the order of the 4 bytes in an array of 4-byte words.
*/
void flip4( const unsigned int *src, unsigned int *dest, int n )
{
int i;
for (i=0;i<n;i++) {
unsigned int tmp = src[i];
dest[i] = FLIP4( tmp );
}
}
/*
* Flip the order of the 2 bytes in an array of 2-byte words.
*/
void flip2( const unsigned short *src, unsigned short *dest, int n )
{
int i;
for (i=0;i<n;i++) {
unsigned short tmp = src[i];
dest[i] = FLIP2( tmp );
}
}
#ifdef _CRAY
/*****************************************************************************
*
* The following source code is in the public domain.
* Specifically, we give to the public domain all rights for future licensing
* of the source code, all resale rights, and all publishing rights.
*
* We ask, but do not require, that the following message be included in all
* derived works:
*
* Portions developed at the National Center for Supercomputing Applications at
* the University of Illinois at Urbana-Champaign.
*
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
*
****************************************************************************/
/** THESE ROUTINES MUST BE COMPILED ON THE CRAY ONLY SINCE THEY **/
/** REQUIRE 8-BYTES PER C-TYPE LONG **/
/* Cray to IEEE single precision */
static void c_to_if( long *t, const long *f)
{
if (*f != 0){
*t = (((*f & 0x8000000000000000) | /* sign bit */
((((*f & 0x7fff000000000000) >> 48)-16258) << 55)) + /* exp */
(((*f & 0x00007fffff000000) +
((*f & 0x0000000000800000) << 1)) << 8)); /* mantissa */
}
else *t = *f;
}
#define C_TO_IF( T, F ) \
if (F != 0) { \
T = (((F & 0x8000000000000000) | \
((((F & 0x7fff000000000000) >> 48)-16258) << 55)) + \
(((F & 0x00007fffff000000) + \
((F & 0x0000000000800000) << 1)) << 8)); \
} \
else { \
T = F; \
}
/* IEEE single precison to Cray */
static void if_to_c( long *t, const long *f)
{
if (*f != 0) {
*t = (((*f & 0x8000000000000000) |
((*f & 0x7f80000000000000) >> 7) +
(16258 << 48)) |
(((*f & 0x007fffff00000000) >> 8) | (0x0000800000000000)));
if ((*f << 1) == 0) *t = 0;
}
else *t = *f;
}
/* T and F must be longs! */
#define IF_TO_C( T, F ) \
if (F != 0) { \
T = (((F & 0x8000000000000000) | \
((F & 0x7f80000000000000) >> 7) + \
(16258 << 48)) | \
(((F & 0x007fffff00000000) >> 8) | (0x0000800000000000))); \
if ((F << 1) == 0) T = 0; \
} \
else { \
T = F; \
}
/*
* Convert an array of Cray 8-byte floats to an array of IEEE 4-byte floats.
*/
void cray_to_ieee_array( long *dest, const float *source, int n )
{
long *dst;
const long *src;
long tmp1, tmp2;
int i;
dst = dest;
src = (const long *) source;
for (i=0;i<n;i+=2) { /* add 1 in case n is odd */
c_to_if( &tmp1, &src[i] );
c_to_if( &tmp2, &src[i+1] );
*dst = (tmp1 & 0xffffffff00000000) | (tmp2 >> 32);
dst++;
}
}
/*
* Convert an array of IEEE 4-byte floats to an array of 8-byte Cray floats.
*/
void ieee_to_cray_array( float *dest, const long *source, int n )
{
long *dst;
const long *src;
int i;
long ieee;
src = source;
dst = (long *) dest;
for (i=0;i<n;i++) {
/* most significant 4-bytes of ieee contain bit pattern to convert */
if ((i&1)==0) {
/* get upper half */
ieee = src[i/2] & 0xffffffff00000000;
}
else {
/* get lower half */
ieee = src[i/2] << 32;
}
if_to_c( dst, &ieee );
dst++;
}
}
#endif /*_CRAY*/
/**********************************************************************/
/***** Read Functions *****/
/**********************************************************************/
/*
* Read a block of bytes.
* Input: f - the file descriptor to read from.
* b - address of buffer to read into.
* n - number of bytes to read.
* Return: number of bytes read, 0 if error.
*/
int read_bytes( int f, void *b, int n )
{
return read( f, b, n );
}
/*
* Read an array of 2-byte integers.
* Input: f - file descriptor
* iarray - address to put integers
* n - number of integers to read.
* Return: number of integers read.
*/
int read_int2_array( int f, short *iarray, int n )
{
#ifdef _CRAY
int i;
signed char *buffer;
int nread;
buffer = (signed char *) malloc( n * 2 );
if (!buffer) return 0;
nread = read( f, buffer, n*2 );
if (nread<=0) return 0;
nread /= 2;
for (i=0;i<nread;i++) {
/* don't forget about sign extension! */
iarray[i] = (buffer[i*2] * 256) | buffer[i*2+1];
}
free( buffer );
return nread;
#else
int nread = read( f, iarray, n*2 );
if (nread<=0)
return 0;
#ifdef LITTLE
flip2( (const unsigned short *) iarray, (unsigned short *) iarray, nread/2);
#endif
return nread/2;
#endif
}
/*
* Read an array of unsigned 2-byte integers.
* Input: f - file descriptor
* iarray - address to put integers
* n - number of integers to read.
* Return: number of integers read.
*/
int read_uint2_array( int f, unsigned short *iarray, int n )
{
#ifdef _CRAY
int i;
unsigned char *buffer;
int nread;
buffer = (unsigned char *) malloc( n * 2 );
if (!buffer) return 0;
nread = read( f, buffer, n*2 );
if (nread<=0) return 0;
nread /= 2;
for (i=0;i<nread;i++) {
iarray[i] = (buffer[i*2] << 8) | buffer[i*2+1];
}
free( buffer );
return nread;
#else
int nread = read( f, iarray, n*2 );
if (nread<=0)
return 0;
#ifdef LITTLE
flip2( iarray, iarray, nread/2 );
#endif
return nread/2;
#endif
}
/*
* Read a 4-byte integer.
* Input: f - the file descriptor to read from
* i - pointer to integer to put result into.
* Return: 1 = ok, 0 = error
*/
int read_int4( int f, int *i )
{
#ifdef LITTLE
/* read big endian and convert to little endian */
unsigned int n;
if (read( f, &n, 4 )==4) {
*i = FLIP4( n );
return 1;
}
else {
return 0;
}
#else
if (read( f, i, 4 )==4) {
# ifdef _CRAY
*i = *i >> 32;
# endif
return 1;
}
else {
return 0;
}
#endif
}
/*
* Read an array of 4-byte integers.
* Input: f - file descriptor
* iarray - address to put integers
* n - number of integers to read.
* Return: number of integers read.
*/
int read_int4_array( int f, int *iarray, int n )
{
#ifdef _CRAY
int j, nread;
int *buffer;
buffer = (int *) malloc( (n+1)*4 );
if (!buffer)
return 0;
nread = read( f, buffer, 4*n );
if (nread<=0) {
return 0;
}
nread /= 4;
for (j=0;j<nread;j++) {
if ((j&1)==0) {
iarray[j] = buffer[j/2] >> 32;
}
else {
iarray[j] = buffer[j/2] & 0xffffffff;
}
}
free( buffer );
return nread;
#else
int nread = read( f, iarray, 4*n );
if (nread<=0)
return 0;
# ifdef LITTLE
flip4( (const unsigned int *) iarray, (unsigned int *) iarray, nread/4 );
# endif
return nread/4;
#endif
}
/*
* Read a 4-byte IEEE float.
* Input: f - the file descriptor to read from.
* x - pointer to float to put result into.
* Return: 1 = ok, 0 = error
*/
int read_float4( int f, float *x )
{
#ifdef _CRAY
long buffer = 0;
if ( read( f, &buffer, 4 )==4 ) {
/* convert IEEE float (buffer) to Cray float (x) */
if_to_c( (long *) x, &buffer );
return 1;
}
return 0;
#else
# ifdef LITTLE
unsigned int n, *iptr;
if (read( f, &n, 4 )==4) {
iptr = (unsigned int *) x;
*iptr = FLIP4( n );
return 1;
}
else {
return 0;
}
# else
if (read( f, x, 4 )==4) {
return 1;
}
else {
return 0;
}
# endif
#endif
}
/*
* Read an array of 4-byte IEEE floats.
* Input: f - file descriptor
* x - address to put floats
* n - number of floats to read.
* Return: number of floats read.
*/
int read_float4_array( int f, float *x, int n )
{
#ifdef _CRAY
/* read IEEE floats into buffer, then convert to Cray format */
long *buffer;
int i, nread;
buffer = (long *) malloc( (n+1) * 4 );
if (!buffer) return 0;
nread = read( f, buffer, n*4 );
if (nread<=0) return 0;
nread /= 4;
ieee_to_cray_array( x, buffer, nread );
free( buffer );
return nread;
#else
int nread = read( f, x, 4*n );
if (nread<=0)
return 0;
#ifdef LITTLE
flip4( (const unsigned int *) x, (unsigned int*) x, nread/4 );
#endif
return nread/4;
#endif
}
/*
* Read a block of memory.
* Input: f - file descriptor
* data - address of first byte
* elements - number of elements to read
* elsize - size of each element to read (1, 2 or 4)
* Return: number of elements written
*/
int read_block( int f, void *data, int elements, int elsize )
{
if (elsize==1) {
return read( f, data, elements );
}
else if (elsize==2) {
#ifdef LITTLE
int n;
n = read( f, data, elements*2 ) / 2;
if (n==elements) {
flip2( (const unsigned short *) data, (unsigned short *) data,
elements );
}
return n;
#else
return read( f, data, elements*2 ) / 2;
#endif
}
else if (elsize==4) {
#ifdef LITTLE
int n;
n = read( f, data, elements*4 ) / 4;
if (n==elements) {
flip4( (const unsigned int *) data, (unsigned int *) data, elements );
}
return n;
#else
return read( f, data, elements*4 ) / 4;
#endif
}
else {
printf("Fatal error in read_block(): bad elsize (%d)\n", elsize );
abort();
}
return 0;
}
/**********************************************************************/
/***** Write Functions *****/
/**********************************************************************/
/*
* Write a block of bytes.
* Input: f - the file descriptor to write to.
* b - address of buffer to write.
* n - number of bytes to write.
* Return: number of bytes written, 0 if error.
*/
int write_bytes( int f, const void *b, int n )
{
return write( f, b, n );
}
/*
* Write an array of 2-byte integers.
* Input: f - file descriptor
* iarray - address to put integers
* n - number of integers to write.
* Return: number of integers written
*/
int write_int2_array( int f, const short *iarray, int n )
{
#ifdef _CRAY
printf("write_int2_array not implemented!\n");
exit(1);
#else
int nwritten;
#ifdef LITTLE
flip2( (const unsigned short *) iarray, (unsigned short *) iarray, n );
#endif
nwritten = write( f, iarray, 2*n );
#ifdef LITTLE
flip2( (const unsigned short *) iarray, (unsigned short *) iarray, n );
#endif
if (nwritten<=0)
return 0;
return nwritten/2;
#endif
}
/*
* Write an array of 2-byte unsigned integers.
* Input: f - file descriptor
* iarray - address to put integers
* n - number of integers to write.
* Return: number of integers written
*/
int write_uint2_array( int f, const unsigned short *iarray, int n )
{
#ifdef _CRAY
int i, nwritten;
unsigned char *buffer;
buffer = (unsigned char *) malloc( 2*n );
if (!buffer) return 0;
for (i=0;i<n;i++) {
buffer[i*2] = (iarray[i] >> 8) & 0xff;
buffer[i*2+1] = iarray[i] & 0xff;
}
nwritten = write( f, buffer, 2*n );
free( buffer );
if (nwritten<=0)
return 0;
else
return nwritten/2;
#else
int nwritten;
#ifdef LITTLE
flip2( iarray, (unsigned short *) iarray, n );
#endif
nwritten = write( f, iarray, 2*n );
#ifdef LITTLE
flip2( iarray, (unsigned short *) iarray, n );
#endif
if (nwritten<=0)
return 0;
else
return nwritten/2;
#endif
}
/*
* Write a 4-byte integer.
*Input: f - the file descriptor
* i - the integer
* Return: 1 = ok, 0 = error
*/
int write_int4( int f, int i )
{
#ifdef _CRAY
i = i << 32;
return write( f, &i, 4 ) > 0;
#else
# ifdef LITTLE
i = FLIP4( i );
# endif
return write( f, &i, 4 ) > 0;
#endif
}
/*
* Write an array of 4-byte integers.
* Input: f - the file descriptor
* i - the array of ints
* n - the number of ints in array
* Return: number of integers written.
*/
int write_int4_array( int f, const int *i, int n )
{
#ifdef _CRAY
int j, nwritten;
char *buf, *b, *ptr;
b = buf = (char *) malloc( n*4 + 8 );
if (!b)
return 0;
ptr = (char *) i;
for (j=0;j<n;j++) {
ptr += 4; /* skip upper 4 bytes */
*b++ = *ptr++;
*b++ = *ptr++;
*b++ = *ptr++;
*b++ = *ptr++;
}
nwritten = write( f, buf, 4*n );
free( buf );
if (nwritten<=0)
return 0;
else
return nwritten / 4;
#else
# ifdef LITTLE
int nwritten;
flip4( (const unsigned int *) i, (unsigned int *) i, n );
nwritten = write( f, i, 4*n );
flip4( (const unsigned int *) i, (unsigned int *) i, n );
if (nwritten<=0)
return 0;
else
return nwritten / 4;
# else
return write( f, i, 4*n ) / 4;
# endif
#endif
}
/*
* Write a 4-byte IEEE float.
* Input: f - the file descriptor
* x - the float
* Return: 1 = ok, 0 = error
*/
int write_float4( int f, float x )
{
#ifdef _CRAY
char buffer[8];
c_to_if( (long *) buffer, (const long *) &x );
return write( f, buffer, 4 ) > 0;
#else
# ifdef LITTLE
float y;
unsigned int *iptr = (unsigned int *) &y, temp;
y = (float) x;
temp = FLIP4( *iptr );
return write( f, &temp, 4 ) > 0;
# else
float y;
y = (float) x;
return write( f, &y, 4 ) > 0;
# endif
#endif
}
/*
* Write an array of 4-byte IEEE floating point numbers.
* Input: f - the file descriptor
* x - the array of floats
* n - number of floats in array
* Return: number of float written.
*/
int write_float4_array( int f, const float *x, int n )
{
#ifdef _CRAY
/* convert cray floats to IEEE and put into buffer */
int nwritten;
long *buffer;
buffer = (long *) malloc( n*4 + 8 );
if (!buffer)
return 0;
cray_to_ieee_array( buffer, x, n );
nwritten = write( f, buffer, 4*n );
free( buffer );
if (nwritten<=0)
return 0;
else
return nwritten / 4;
#else
# ifdef LITTLE
int nwritten;
flip4( (const unsigned int *) x, (unsigned int *) x, n );
nwritten = write( f, x, 4*n );
flip4( (const unsigned int *) x, (unsigned int *) x, n );
if (nwritten<=0)
return 0;
else
return nwritten / 4;
# else
return write( f, x, 4*n ) / 4;
# endif
#endif
}
/*
* Write a block of memory.
* Input: f - file descriptor
* data - address of first byte
* elements - number of elements to write
* elsize - size of each element to write (1, 2 or 4)
* Return: number of elements written
*/
int write_block( int f, const void *data, int elements, int elsize )
{
if (elsize==1) {
return write( f, data, elements );
}
else if (elsize==2) {
#ifdef LITTLE
int n;
flip2( (const unsigned short *) data, (unsigned short *) data, elements);
n = write( f, data, elements*2 ) / 2;
flip2( (const unsigned short *) data, (unsigned short *) data, elements);
return n;
#else
return write( f, data, elements*2 ) / 2;
#endif
}
else if (elsize==4) {
#ifdef LITTLE
int n;
flip4( (const unsigned int *) data, (unsigned int *) data, elements );
n = write( f, data, elements*4 ) / 4;
flip4( (const unsigned int *) data, (unsigned int *) data, elements );
return n;
#else
return write( f, data, elements*4 ) / 4;
#endif
}
else {
printf("Fatal error in write_block(): bad elsize (%d)\n", elsize );
abort();
}
return 0;
}
/* Vis5D version 5.1 */
/*
Vis5D system for visualizing five dimensional gridded data sets
Copyright (C) 1990 - 1997 Bill Hibbard, Brian Paul, Dave Santek,
and Andre Battaiola.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Functions to do binary I/O of floats, ints, etc. with byte swapping
* as needed.
*/
#ifndef BINIO_H
#define BINIO_H
/* Include files which define SEEK_SET, O_RD_ONLY, etc. */
/* and prototype open(), close(), lseek(), etc. */
#include <unistd.h>
#include <fcntl.h>
extern void flip4( const unsigned int *src, unsigned int *dest, int n );
extern void flip2( const unsigned short *src, unsigned short *dest, int n );
/* Modif pour prendre en compte la FUJI avec des entiers 32 bits
et des reels 64 bits. Or on a :
sizeof(int) = 4
sizeof(long) = 4
sizeof(long long) = 8
sizeof(float) = 4
sizeof(double) = 8
*/
#ifdef _CRAY
extern void cray_to_ieee_array( long *dest, const float *source, int n );
extern void ieee_to_cray_array( float *dest, const long *source, int n );
#endif
/**********************************************************************/
/***** Read Functions *****/
/**********************************************************************/
extern int read_bytes( int f, void *b, int n );
extern int read_int2_array( int f, short *iarray, int n );
extern int read_uint2_array( int f, unsigned short *iarray, int n );
extern int read_int4( int f, int *i );
extern int read_int4_array( int f, int *iarray, int n );
extern int read_float4( int f, float *x );
extern int read_float4_array( int f, float *x, int n );
extern int read_block( int f, void *data, int elements, int elsize );
/**********************************************************************/
/***** Write Functions *****/
/**********************************************************************/
extern int write_bytes( int f, const void *b, int n );
extern int write_int2_array( int f, const short *iarray, int n );
extern int write_uint2_array( int f, const unsigned short *iarray, int n );
extern int write_int4( int f, int i );
extern int write_int4_array( int f, const int *iarray, int n );
extern int write_float4( int f, float x );
extern int write_float4_array( int f, const float *x, int n );
extern int write_block( int f, const void *data, int elements, int elsize );
#endif
This diff is collapsed.
/* Vis5D version 5.1 */
/*
Vis5D system for visualizing five dimensional gridded data sets
Copyright (C) 1990 - 1996 Bill Hibbard, Brian Paul, Dave Santek,
and Andre Battaiola.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef V5D_H
#define V5D_H
/*
* A numeric version number which we can test for in utility programs which
* use the v5d functions. For example, we can do tests like this:
* #if V5D_VERSION > 42
* do something
* #else
* do something else
* #endif
*
* If V5D_VERSION is not defined, then its value is considered to be zero.
*/
#define V5D_VERSION 42
/*
* Define our own 1 and 2-byte data types. We use these names to avoid
* collisions with types defined by the OS include files.
*/
typedef unsigned char V5Dubyte; /* Must be 1 byte, except for cray */
typedef unsigned short V5Dushort; /* Must be 2 byte, except for cray */
#define MISSING 1.0e35
#define IS_MISSING(X) ( (X) >= 1.0e30 )
/* Limits on 5-D grid size: (must match those in v5df.h!!!) */
#define MAXVARS 100
#define MAXTIMES 400
#define MAXROWS 800
#define MAXCOLUMNS 800
#define MAXLEVELS 100
#ifdef VPP
#define FLOAT double
#else
#define FLOAT float
#endif
/************************************************************************/
/*** ***/
/*** Functions for writing v5d files. See README file for details. ***/
/*** These are the functions user's will want for writing file ***/
/*** converters, etc. ***/
/*** ***/
/************************************************************************/
extern int v5dCreateSimple( const char *name,
int numtimes, int numvars,
int nr, int nc, int nl,
const char varname[MAXVARS][10],
const int timestamp[],
const int datestamp[],
float northlat, float latinc,
float westlon, float loninc,
float bottomhgt, float hgtinc );
extern int v5dCreate( const char *name,
int numtimes, int numvars,
int nr, int nc, const int nl[],
const char varname[MAXVARS][10],
const int timestamp[],
const int datestamp[],
int compressmode,
int projection,
const FLOAT proj_args[],
int vertical,
const FLOAT vert_args[] );
extern int v5dWrite( int time, int var, const FLOAT data[] );
extern int v5dClose( void );
extern int v5dSetLowLev( int lowlev[] );
extern int v5dSetUnits( int var, const char *units );
/************************************************************************/
/*** ***/
/*** Definition of v5d struct and function prototypes. ***/
/*** These functions are used by vis5d and advanced v5d utilities. ***/
/*** ***/
/************************************************************************/
#define MAXPROJARGS 100
#define MAXVERTARGS (MAXLEVELS+1)
/*
* This struct describes the structure of a .v5d file.
*/
typedef struct {
/* PUBLIC (user can freely read, sometimes write, these fields) */
int NumTimes; /* Number of time steps */
int NumVars; /* Number of variables */
int Nr; /* Number of rows */
int Nc; /* Number of columns */
int Nl[MAXVARS]; /* Number of levels per variable */
int LowLev[MAXVARS]; /* Lowest level per variable */
char VarName[MAXVARS][10]; /* 9-character variable names */
char Units[MAXVARS][20]; /* 19-character units for variables */
int TimeStamp[MAXTIMES]; /* Time in HHMMSS format */
int DateStamp[MAXTIMES]; /* Date in YYDDD format */
float MinVal[MAXVARS]; /* Minimum variable data values */
float MaxVal[MAXVARS]; /* Maximum variable data values */
/* This info is used for external function computation */
short McFile[MAXTIMES][MAXVARS];/* McIDAS file number in 1..9999 */
short McGrid[MAXTIMES][MAXVARS];/* McIDAS grid number in 1..? */
int VerticalSystem; /* Which vertical coordinate system */
float VertArgs[MAXVERTARGS]; /* Vert. Coord. Sys. arguments... */
/*
IF VerticalSystem==0 THEN
-- Linear scale, equally-spaced levels in generic units
VertArgs[0] = Height of bottom-most grid level in generic units
VertArgs[1] = Increment between levels in generic units
ELSE IF VerticalSystem==1 THEN
-- Linear scale, equally-spaced levels in km
VertArgs[0] = Height of bottom grid level in km
VertArgs[1] = Increment between levels in km
ELSE IF VerticalSystem==2 THEN
-- Linear scale, Unequally spaced levels in km
VertArgs[0] = Height of grid level 0 (bottom) in km
... ...
VertArgs[n] = Height of grid level n in km
ELSE IF VerticalSystem==3 THEN
-- Linear scale, Unequally spaced levels in mb
VertArgs[0] = Pressure of grid level 0 (bottom) in mb
... ...
VertArgs[n] = Pressure of grid level n in mb
ENDIF
*/
int Projection; /* Which map projection */
float ProjArgs[MAXPROJARGS]; /* Map projection arguments... */
/*
IF Projection==0 THEN
-- Rectilinear grid, generic units
ProjArgs[0] = North bound, Y coordinate of grid row 0
ProjArgs[1] = West bound, X coordiante of grid column 0
ProjArgs[2] = Increment between rows
ProjArgs[3] = Increment between colums
NOTES: X coordinates increase to the right, Y increase upward.
NOTES: Coordinate system is right-handed.
ELSE IF Projection==1 THEN
-- Cylindrical equidistant (Old VIS-5D)
-- Rectilinear grid in lat/lon
ProjArgs[0] = Latitude of grid row 0, north bound, in degrees
ProjArgs[1] = Longitude of grid column 0, west bound, in deg.
ProjArgs[2] = Increment between rows in degrees
ProjArgs[3] = Increment between rows in degrees
NOTES: Coordinates (degrees) increase to the left and upward.
ELSE IF Projection==2 THEN
-- Lambert conformal
ProjArgs[0] = Standared Latitude 1 of conic projection
ProjArgs[1] = Standared Latitude 2 of conic projection
ProjArgs[2] = Row of North/South pole
ProjArgs[3] = Column of North/South pole
ProjArgs[4] = Longitude which is parallel to columns
ProjArgs[5] = Increment between grid columns in km
ELSE IF Projection==3 THEN
-- Polar Stereographic
ProjArgs[0] = Latitude of center of projection
ProjArgs[1] = Longitude of center of projection
ProjArgs[2] = Grid row of center of projection
ProjArgs[3] = Grid column of center of projection
ProjArgs[4] = Increment between grid columns at center in km
ELSE IF Projection==4 THEN
-- Rotated
ProjArgs[0] = Latitude on rotated globe of grid row 0
ProjArgs[1] = Longitude on rotated globe of grid column 0
ProjArgs[2] = Degrees of latitude on rotated globe between
grid rows
ProjArgs[3] = Degrees of longitude on rotated globe between
grid columns
ProjArgs[4] = Earth latitude of (0, 0) on rotated globe
ProjArgs[5] = Earth longitude of (0, 0) on rotated globe
ProjArgs[6] = Clockwise rotation of rotated globe in degrees
ENDIF
*/
int CompressMode; /* 1, 2 or 4 = # bytes per grid point */
char FileVersion[10]; /* 9-character version number */
/* PRIVATE (not to be touched by user code) */
unsigned int FileFormat; /* COMP5D file version or 0 if .v5d */
int FileDesc; /* Unix file descriptor */
char Mode; /* 'r' = read, 'w' = write */
int CurPos; /* current position of file pointer */
int FirstGridPos; /* position of first grid in file */
int GridSize[MAXVARS]; /* size of each grid */
int SumGridSizes; /* sum of GridSize[0..NumVars-1] */
} v5dstruct;
extern float pressure_to_height( float pressure);
extern float height_to_pressure( float height );
extern int v5dYYDDDtoDays( int yyddd );
extern int v5dHHMMSStoSeconds( int hhmmss );
extern int v5dDaysToYYDDD( int days );
extern int v5dSecondsToHHMMSS( int seconds );
extern void v5dPrintStruct( const v5dstruct *v );
extern v5dstruct *v5dNewStruct( void );
extern void v5dFreeStruct( v5dstruct* v );
extern void v5dInitStruct( v5dstruct *v );
extern int v5dVerifyStruct( const v5dstruct *v );
extern void v5dCompressGrid( int nr, int nc, int nl, int compressmode,
const float data[], void *compdata,
float ga[], float gb[],
float *minval, float *maxval );
extern void v5dDecompressGrid( int nr, int nc, int nl, int compressmode,
void *compdata,
float ga[], float gb[],
float data[] );
extern int v5dSizeofGrid( const v5dstruct *v, int time, int var );
extern v5dstruct *v5dOpenFile( const char *filename, v5dstruct *v );
extern int v5dCreateFile( const char *filename, v5dstruct *v );
extern v5dstruct *v5dUpdateFile( const char *filename, v5dstruct *v );
extern int v5dCloseFile( v5dstruct *v );
extern int v5dReadCompressedGrid( v5dstruct *v,
int time, int var,
float *ga, float *gb,
void *compdata );
extern int v5dReadGrid( v5dstruct *v, int time, int var, float data[] );
extern int v5dWriteCompressedGrid( const v5dstruct *v,
int time, int var,
const float *ga, const float *gb,
const void *compdata );
extern int v5dWriteGrid( v5dstruct *v, int time, int var, const float data[] );
#endif
/* Vis5D version 5.1 */
/*
Vis5D system for visualizing five dimensional gridded data sets
Copyright (C) 1990-1997 Bill Hibbard, Brian Paul, Dave Santek,
and Andre Battaiola.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* This configuration file contains options which can be safely
* changed by the user.
*/
#ifndef VIS5D_H
#define VIS5D_H
/*
* Amount of physical RAM in megabytes:
* vis5d normally uses a bounded amount of memory to avoid swapping.
* When the limit is reached, the least-recently-viewed graphics will
* be deallocated. If MBS is set to 0, however, vis5d will use ordinary
* malloc/free and not deallocate graphics (ok for systems with a lot
* of memory (>=128MB)).
*/
/* Default Value: 32 */
#define MBS 128
/* Default topography file: */
#define TOPOFILE "/home/chajpmnt/chajp/ADD/data/EARTH.TOPO"
/* Default map lines files: */
#define WORLDFILE "/home/chajpmnt/chajp/ADD/data/OUTLSUPW"
#define USAFILE "/home/chajpmnt/chajp/ADD/data/OUTLUSAM"
/* Default filename of Tcl startup commands: */
#define TCL_STARTUP_FILE "vis5d.tcl"
/* Default directory to search for user functions: */
#define FUNCTION_PATH "userfuncs"
/* Default animation rate in milliseconds: */
#define ANIMRATE 100
/* Default scale and exponent values for logrithmic vertical coordinate system: */
#define DEFAULT_LOG_SCALE 1012.5
#define DEFAULT_LOG_EXP -7.2
#define DEFAULT_SOUNDFONTNAME "6x12"
/**********************************************************************/
/**********************************************************************/
/*** USERS: DON'T CHANGE ANYTHING BEYOND THIS POINT ***/
/**********************************************************************/
/**********************************************************************/
/*
* Define BIG_GFX to allow larger isosurfaces, contour slices, etc. if
* there's enough memory.
#if MBS==0 || MBS>=128
# define BIG_GFX
#endif
*/
#define BIG_GFX
/*
* Shared by code above and below API:
*/
#define MAX_LABEL 1000
#define MAX_FUNCS 100
#endif
tools.ps : tools.dvi
dvips -o $@ $<
tools.dvi : tools.tex
latex tools.tex
latex tools.tex
latex tools.tex
clean:
rm -f *.aux *.log *.toc *.dvi
realclean: clean
rm -f *.ps
\section{Conversion of FM synchronous file to diachronic format}
Short description is given here, readers must refer to the original documentation on the Meso-NH web site:
``{\sc traitement graphique des fichiers synchrones produits par le mod\`ele
mesonh}, J. Duron''.
\subsection{Synchronous and diachronic formats} \label{diachro_file}
The Meso-NH graphic utility ({\tt diaprog}) works on FM files which are on
diachronic format. A diachronic FM file is either
\begin{itemize}
\item
a file produced during the simulation
which contain time series of self-documented informations
(e.g. file with name CEXP.1.CSEG.000).
An information is one of the following:
\subitem - a
3-dimensional, 2-dimensional, 1-dimensional or 0-dimensional field (eventually
time-averaged, or compressed in one direction): type {\sc cart},
\subitem - a set of vertical profiles at points checking some criteria:
type {\sc mask},
\subitem - spectral coefficients obtained by FFT along the X or Y direction:
type {\sc spxy},
\subitem - pseudo-observations (ground station: type {\sc ssol};
dropsonde: type {\sc drst}; radiosonde: type {\sc rspl};
airborne radar: type {\sc rapl}).
\\
A diachronic file can contains informations of one or several previous types
stored at different time frequency.
For a whole description about the diachronic file type, reader must refer
to the original documentation on the Meso-NH web site:
``{\sc cr\'eation et exploitation de fichiers diachroniques}, J. Duron''.
\end{itemize}
or
\begin{itemize}
\item a `pseudo'-diachronic file resulting of the conversion of a synchronous
file (e.g. with name CEXP.1.CSEG.00n where n$>$0).
Recall that such a file contains all the pronostic fields of the model at one
instant (initial or during the simulation).
When converted it is a 'pseudo'-diachronic file, because it contains only one
instant and one type of diachronic information ({\sc cart}).
The next subsection presents the conversion tool (named \texttt{conv2dia})
to apply to synchronous files, necessary step to use \texttt{diaprog} graphic
tool.
\end{itemize}
\subsection{{\tt conv2dia} tool}
The conversion tool works on files produced by
the initialisation programs ({\sc prep\_pgd, prep\_ideal\_case,
prep\_real\_case}), the model simulation, or the post-processing program
({\tt\sc diag}). It allows to convert one synchronous file onto one diachronic
file, as well as merge several synchronous files with chronological times
(outputs of one run, or files initialised from large-scale model)
onto one diachronic file.
With {\tt conv2dia.elim} tool, you can choose not to convert all the fields of
the input file(s). The pronostic fields at $t-dt$ instant, or at $t$ instant,
or any other fields can be eliminated.
With {\tt conv2dia.select} tool, you have to indicate the fields to select
for conversion.
This is done to reduce the size of the output file.
The output file contains informations whose type is {\sc cart} stored in arrays
with size of {\tt (IIU*IJU*IKU), (IIU*IJU), (IIU*IKU),} or 1.
\subsection{Example}
Only the binary (\textsc{LFI}) part of the input FM files is required
in the current directory (split the FM file with the {\tt fm2deslfi}
script if not).
All characters typed on keyboard are saved in {\tt dirconv.elim} or
{\tt dirconv.select} file, it can be appended and used as input (after being
renamed) for the next call of the tool
\newline (e.g. {\tt conv2dia.elim < dirconv.elim.ex}).
Below is the example of questions when {\tt conv2dia.elim} is invoked.
\small
\begin{tabular}{l}
\\
\\
{\tt ENTER NUMBER OF INPUT FM FILES} \\
{\tt\it 2 } \\
{\tt ENTER FM FILE NAME} \\
{\tt\it CEXP.1.CSEG.001} \\
{\tt ENTER FM FILE NAME} \\
{\tt\it CEXP.1.CSEG.002} \\
{\tt ENTER DIACHRONIC FILE NAME} \\
{\tt\it CEXP.1.CSEG.1-2.dia} \\
{\tt DELETION OF PARAMETERS AT TIME t-dt ? (enter 1) } \\
{\tt DELETION OF PARAMETERS AT TIME t ? (enter 2) } \\
{\tt NO DELETION ? (enter 0) } \\
{\tt\it 2 } \\
{\tt Do you want to suppress others parameters ? (y/n) }\\
{\tt\it y } \\
{\tt Enter their names in UPPERCASE (1/1 line) }\\
{\tt End by END}\\
{\tt\it DTHCONV } \\
{\tt\it DRVCONV } \\
{\tt\it END } \\
\end{tabular}
\normalsize
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