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