source: trunk/src/SIMULS_IRCAAM/progfiltrage_simulation.f @ 55

Last change on this file since 55 was 55, checked in by pinsard, 15 years ago

parametrisation of SIMULS_IRCAAM/progfiltrage_....f (modulo dimension); add makefile

File size: 6.2 KB
Line 
1      PROGRAM progfiltrage_simulation
2C+
3C
4C NAME
5C ====
6C
7C ``progfiltrage_simulation.x``
8C
9C SYNOPSIS
10C ========
11C
12C ``progfiltrage_simulation.x``
13C
14C DESCRIPTION
15C ===========
16C
17C filtrage sur olr JAN-DEC de 1968
18C ++
19C
20C From olr_nofiltre_arpege_ \ *simulation*\ .dat.
21C ``progfiltrage_simulation.x`` compute ++.
22C
23C ``progfiltrage_simulation.x`` write
24C olr_filtre_\ *period1*\ -\ *period2*\ d_arpege_ \ *simulation*\ .dat.
25C
26C
27C CAUTIONS
28C ========
29C
30C On MAC ppc, this program must be compile with ``-fendian=little``
31C for g95
32C according to machineformat used in prepare_olr_filtre_simulation.m_.
33C
34C EXAMPLES
35C ========
36C
37C Following line read ``olr_nofiltre_arpege_AfNQIVIV.dat``,
38C compute ++,
39C write ``olr_filtre_10-30d_arpege_AfNQIVIV.dat``
40C ::
41C
42C $ echo "arpege AfNQIVIV 10 30" | progfiltrage_simulation.x -
43C
44C SEE ALSO
45C ========
46C
47C prepare_olr_filtre_simulation.m_
48C
49C .. _prepare_olr_filtre_simulation.m : prepare_olr_filtre_simulation.m.html
50C
51C forfilter.f_
52C
53C .. _forfilter.f : forfilter.f.html
54C
55C TODO
56C ====
57C
58C underflow tracking (see ifort failure)
59C
60C REAL ou DOUBLE PRECISION dans les fichiers matlab
61C
62C improve description
63C
64C improve file pb (err in open/read/write)
65C
66C F90 modules
67C
68C portability check because of getenv : now (20090203) written for
69C working on zeus using g95 (GCC 4.0.3 (g95!) Jun 18 2006)
70C
71C use PT fortran tool box ?! when public ...
72C
73C direct access file ? seems to work but see also
74C http://objectmix.com/fortran/305264-read-binaries-matlab.html
75C
76C EVOLUTIONS
77C ==========
78C
79C $Id$
80C
81C - fplod 2009-02-10T13:57:29Z aedon.locean-ipsl.upmc.fr (Darwin)
82C
83C   * bug fix on output file name to be compatible to convention
84C     (not fixed period number of digits)
85C
86C - fplod 2009-02-02T13:45:57Z aedon.locean-ipsl.upmc.fr (Darwin)
87C
88C   * created from progfiltrage_10_30.f  to replace it as well as
89C     progfiltrage_30_100.f
90C
91C   * Subroutines externalized in forfilter.f
92C
93C   * add parameters ircaam_dataset and simulation according to
94C     prepare_olr_filtre_simulation.m
95C
96C   * consolidation : implicit none, inquire iolength, force
97C     LITTLE ENDIAN
98C
99C-
100C
101      IMPLICIT NONE
102
103      EXTERNAL FILTRE
104
105      INTEGER, PARAMETER :: nb = 3660
106      INTEGER :: period1
107      INTEGER :: period2
108C
109      INTEGER :: i
110      INTEGER :: j
111      INTEGER :: k
112      INTEGER :: l
113      INTEGER :: lon0
114      INTEGER :: lat0
115C
116      REAL :: olr(24,15,nb),vb(nb)
117      REAL :: vvb(nb),vvvb(nb),olrf(24,15,nb)
118C
119      CHARACTER (LEN=255) :: ircaam_id
120      CHARACTER (LEN=255) :: ircaam_od
121C
122      CHARACTER (LEN=255) :: fullfilename
123      CHARACTER (LEN=255) :: fullfilename_format
124      INTEGER :: record_length = 0
125C
126      CHARACTER (LEN=6) :: ircaam_dataset
127      CHARACTER (LEN=8) :: simulation
128      LOGICAL           :: vsel = .TRUE.
129
130      write (*,*) 'enter ircaam_dataset simulation period1 period2'
131      read (*,*) ircaam_dataset,simulation,period1,period2
132
133      write (*,*) 'ircaam_dataset : ', ircaam_dataset
134      write (*,*) 'simulation : ', simulation
135      write (*,*) 'period1 : ', period1
136      write (*,*) 'period2 : ', period2
137
138C validation of ircaam_dataset
139      IF (ircaam_dataset /= 'arpege') THEN
140       vsel = .FALSE.
141       WRITE(*,*)' eee : pb validation ircaam_dataset'
142      ENDIF
143
144C validation of simulation
145      IF ((simulation /= 'AfNQIVIV') .AND.
146     +    (simulation /= 'TrNQIVIV') .AND.
147     +    (simulation /= 'AsNQIVIV') .AND.
148     +    (simulation /= 'CtIV') .AND.
149     +    (simulation /= 'CtCl ')) THEN
150       vsel = .FALSE.
151       WRITE(*,*)' eee : pb validation simulation'
152      ENDIF
153
154C validation of period1 and period2
155
156      IF (period1 >= period2) THEN
157       vsel = .FALSE.
158       WRITE(*,*)' eee : pb validation period1 vs period2'
159      ENDIF
160C
161      IF (.NOT. vsel) THEN
162       GOTO 994
163      ENDIF
164
165      CALL GETENV('IRCAAM_ID',ircaam_id)
166C++      ircaam_id='/usr/temp/fplod/ircaam_d/'
167      CALL GETENV('IRCAAM_OD',ircaam_od)
168C++      ircaam_od='/usr/temp/fplod/ircaam_d/'
169
170      WRITE(fullfilename,'(A,A,A,A,A,A)')
171     +TRIM(ircaam_id),
172     +'olr_nofiltre_',
173     +TRIM(ircaam_dataset),
174     +'_',
175     +TRIM(simulation),
176     +'.dat'
177
178C ask for record length
179      INQUIRE (IOLENGTH=record_length)
180     +(((olr(i,j,k),i=1,24),j=1,15),k=1,nb)
181
182      open(1,file=fullfilename
183     +,status='old'
184     +,form='unformatted',access='direct',recl=record_length)
185
186      read(1,rec=1)
187     +(((olr(i,j,k),i=1,24),j=1,15),k=1,nb)
188
189      CLOSE(1)
190
191c  l'ordre maximal du filtrage est tel que 2*MOR+1 < nb
192c  veuillez changer dans la subroutine FILTRE le parameter MOR
193
194      do lon0=1,24
195       do lat0=1,15
196        do i=1,nb
197         vb(i)=olr(lon0,lat0,i)
198        enddo
199        call filtre(vb,vvb,REAL(period1),nb)
200        call filtre(vb,vvvb,REAL(period2),nb)
201        do i=1,nb
202         olrf(lon0,lat0,i)=vvb(i)-vvvb(i)
203        enddo
204       enddo
205      enddo
206C      print*,(olrf(1,1,j),j=1,nb)
207
208C adjust format of output filename according to period1 and period2 values
209      fullfilename_format = '(A,A,'
210      IF (period1 < 10 ) THEN
211       fullfilename_format = TRIM(fullfilename_format)//'I1,'
212      ENDIF
213      IF ((period1 >= 10) .AND. (period1 < 100)) THEN
214       fullfilename_format = TRIM(fullfilename_format)//'I2,'
215      ENDIF
216      IF (period1 >= 100 ) THEN
217       fullfilename_format = TRIM(fullfilename_format)//'I3,'
218      ENDIF
219      fullfilename_format = TRIM(fullfilename_format) //'A,'
220      IF (period2 < 10 ) THEN
221       fullfilename_format = TRIM(fullfilename_format)//'I1,'
222      ENDIF
223      IF ((period2 >= 10) .AND. (period2 < 100)) THEN
224       fullfilename_format = TRIM(fullfilename_format)//'I2,'
225      ENDIF
226      IF (period2 >= 100 ) THEN
227       fullfilename_format = TRIM(fullfilename_format)//'I3,'
228      ENDIF
229
230      fullfilename_format = TRIM(fullfilename_format)//'A,A,A,A,A)'
231
232      WRITE(fullfilename,fullfilename_format)
233     +TRIM(ircaam_od),
234     +'olr_filtre_',
235     +period1,
236     +'-',
237     +period2,
238     +'d_',
239     +TRIM(ircaam_dataset),
240     +'_',
241     +TRIM(simulation),
242     +'.dat'
243
244      open(2,file=fullfilename
245     +,status='replace'
246     +,form='unformatted',access='direct',recl=24*15*nb*4)
247
248      write(2,rec=1)(((olrf(lon0,lat0,l),lon0=1,24),
249     +                lat0=1,15),l=1,nb)
250      close(2)
251
252994   CONTINUE
253      STOP
254      END
Note: See TracBrowser for help on using the repository browser.