1 | program changement_grille |
---|
2 | implicit none |
---|
3 | |
---|
4 | integer i,j,ii,jj ! entiers de boucle |
---|
5 | integer aux, numx, numy ! un entier auxiliaire |
---|
6 | |
---|
7 | integer,parameter :: Xmin = -990 ! les bornes du domaine (en km) |
---|
8 | integer,parameter :: Xmax = 895 ! dans la grille de Bamber |
---|
9 | integer,parameter :: Ymin = -3515 |
---|
10 | integer,parameter :: Ymax = -550 |
---|
11 | |
---|
12 | integer,parameter :: pasx_init = 5 ! pas initial selon x : 5km |
---|
13 | integer,parameter :: pasy_init = 5 ! pas initial selon y : 5km |
---|
14 | |
---|
15 | ! integer,parameter :: pasx_new = 15 ! nouveau pas selon x : 15km |
---|
16 | ! integer,parameter :: pasy_new = 15 ! nouveau pas selon y : 15km |
---|
17 | |
---|
18 | integer,parameter :: pasx_new = 45 ! nouveau pas selon x : 45km |
---|
19 | integer,parameter :: pasy_new = 45 ! nouveau pas selon y : 45km |
---|
20 | |
---|
21 | ! nx_init=((Xmax-Xmin)+pasx_init)/pasx_init |
---|
22 | ! nx_new=((Xmax-Xmin)+pasx_init)/pasx_new |
---|
23 | integer,parameter :: nx_init = 378 ! nb initial d'elements en x |
---|
24 | integer,parameter :: ny_init = 594 ! nb initial d'elements en y |
---|
25 | ! nb d'elmt en x et y, pour 15km : |
---|
26 | ! integer,parameter :: nx_new = 126 ! nouveau nb elements en x |
---|
27 | ! integer,parameter :: ny_new = 198 ! nouveau nb elements en y |
---|
28 | ! nb d'elmt en x et y, pour 45km : |
---|
29 | integer,parameter :: nx_new = 42 |
---|
30 | integer,parameter :: ny_new = 66 |
---|
31 | |
---|
32 | |
---|
33 | integer indicex ! un indice pour la matrice initiale, x |
---|
34 | integer indicey ! un indice pour la matrice initiale, y |
---|
35 | |
---|
36 | integer pt_courantx |
---|
37 | integer pt_couranty |
---|
38 | |
---|
39 | character*99 out_surface |
---|
40 | character*99 out_socle |
---|
41 | character*99 out_thick |
---|
42 | character*99 out_grid |
---|
43 | |
---|
44 | real,dimension(nx_init,ny_init) :: Surf_init ! Matrice Surface initiale |
---|
45 | real,dimension(nx_new,ny_new) :: Surf_new ! Nouvelle matrice Surface |
---|
46 | |
---|
47 | real,dimension(nx_init,ny_init) :: Socle_init ! Matrice Socle initiale |
---|
48 | real,dimension(nx_new,ny_new) :: Socle_new ! Nouvelle matrice Socle |
---|
49 | |
---|
50 | real,dimension(nx_init,ny_init) :: Thick_init ! Matrice Epaisseur initiale |
---|
51 | real,dimension(nx_new,ny_new) :: Thick_new ! Nouvelle matrice Epaisseur |
---|
52 | |
---|
53 | character(len=60) :: dir_data |
---|
54 | dir_data='/pc96/work250g/aquiquet/DATA/BASE_PROPRE/IN_OUTPUT/TEMP' |
---|
55 | |
---|
56 | ! Pour passer à 15 km : |
---|
57 | ! out_surface=trim(dir_data)//'/surface_xyz_15km.txt' |
---|
58 | ! out_socle=trim(dir_data)//'/socle_xyz_15km.txt' |
---|
59 | ! out_thick=trim(dir_data)//'/thick_xyz_15km.txt' |
---|
60 | ! out_grid=trim(dir_data)//'/grid_xy_15km.txt' |
---|
61 | |
---|
62 | ! Pour passer à 45 km : |
---|
63 | out_surface=trim(dir_data)//'/surface_xyz_45km.txt' |
---|
64 | out_socle=trim(dir_data)//'/socle_xyz_45km.txt' |
---|
65 | out_thick=trim(dir_data)//'/thick_xyz_45km.txt' |
---|
66 | out_grid=trim(dir_data)//'/grid_xy_45km.txt' |
---|
67 | |
---|
68 | !__________________________________________________________________________ |
---|
69 | ! Lecture des donnees au pas initial |
---|
70 | open(71, file=trim(dir_data)//'/surface_xyz_5km.txt', & |
---|
71 | form='formatted',status='old') |
---|
72 | open(72, file=trim(dir_data)//'/socle_xyz_5km.txt', & |
---|
73 | form='formatted',status='old') |
---|
74 | open(73, file=trim(dir_data)//'/thick_xyz_5km.txt', & |
---|
75 | form='formatted',status='old') |
---|
76 | |
---|
77 | do j=1,ny_init ! Attention : j=1 au nord, j=ny_init au sud |
---|
78 | do i=1,nx_init ! i=1 à l'ouest |
---|
79 | read(71,*) aux, aux, Surf_init(i,j) |
---|
80 | read(72,*) aux, aux, Socle_init(i,j) |
---|
81 | read(73,*) aux, aux, Thick_init(i,j) |
---|
82 | end do |
---|
83 | end do |
---|
84 | close(71) |
---|
85 | close(72) |
---|
86 | close(73) |
---|
87 | ! Fin de lecture |
---|
88 | !-------------------------------------------------------------------------- |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | !__________________________________________________________________________ |
---|
94 | ! Calcul des donnees au pas plus large |
---|
95 | numx = pasx_new/pasx_init |
---|
96 | numy = pasy_new/pasy_init |
---|
97 | |
---|
98 | do j=1,ny_new |
---|
99 | do i=1,nx_new |
---|
100 | Surf_new(i,j)=0 |
---|
101 | Socle_new(i,j)=0 |
---|
102 | Thick_new(i,j)=0 |
---|
103 | indicex=((numx-1)/2 + 1) + (i-1)*numx |
---|
104 | indicey=((numy-1)/2 + 1) + (j-1)*numy |
---|
105 | do jj=1,numy ! on va sommer tous les elmt de la petite grille |
---|
106 | do ii=1,numx |
---|
107 | Surf_new(i,j)=Surf_new(i,j) + & |
---|
108 | Surf_init(indicex+(ii-1)-(numx-1)/2, & |
---|
109 | indicey+(jj-1)-(numy-1)/2) |
---|
110 | Socle_new(i,j)=Socle_new(i,j) + & |
---|
111 | Socle_init(indicex+(ii-1)-(numx-1)/2, & |
---|
112 | indicey+(jj-1)-(numy-1)/2) |
---|
113 | Thick_new(i,j)=Thick_new(i,j) + & |
---|
114 | Thick_init(indicex+(ii-1)-(numx-1)/2, & |
---|
115 | indicey+(jj-1)-(numy-1)/2) |
---|
116 | if(i.eq.50) then ! un test |
---|
117 | print*, 'i,j,ii,jj,socle(i,j)', i,j,ii,jj, Socle_new(i,j) |
---|
118 | end if |
---|
119 | end do |
---|
120 | end do |
---|
121 | Surf_new(i,j)=Surf_new(i,j)/(numx*numy) ! on veut la moyenne |
---|
122 | Socle_new(i,j)=Socle_new(i,j)/(numx*numy) |
---|
123 | Thick_new(i,j)=Thick_new(i,j)/(numx*numy) |
---|
124 | end do |
---|
125 | end do |
---|
126 | |
---|
127 | ! Fin de calcul |
---|
128 | !-------------------------------------------------------------------------- |
---|
129 | |
---|
130 | !__________________________________________________________________________ |
---|
131 | ! Ecriture des donnees au pas de temps plus large |
---|
132 | open(81, file=out_surface,form='formatted',status='unknown') |
---|
133 | open(82, file=out_socle,form='formatted',status='unknown') |
---|
134 | open(83, file=out_thick,form='formatted',status='unknown') |
---|
135 | pt_couranty=Ymax-(numy-1)*pasy_init/2 ! /I\ on avait j=1 au nord. |
---|
136 | do j=1,ny_new |
---|
137 | pt_courantx=Xmin+(numx-1)*pasx_init/2 |
---|
138 | do i=1,nx_new |
---|
139 | write(81,*) pt_courantx, pt_couranty, Surf_new(i,j) |
---|
140 | write(82,*) pt_courantx, pt_couranty, Socle_new(i,j) |
---|
141 | write(83,*) pt_courantx, pt_couranty, Thick_new(i,j) |
---|
142 | pt_courantx = pt_courantx + pasx_new |
---|
143 | enddo |
---|
144 | pt_couranty = pt_couranty - pasy_new |
---|
145 | enddo |
---|
146 | close(81) |
---|
147 | close(82) |
---|
148 | close(83) |
---|
149 | ! Fin d'ecriture |
---|
150 | !-------------------------------------------------------------------------- |
---|
151 | |
---|
152 | !-------------------------------------------------------------------------- |
---|
153 | ! Ecriture d'un simple fichier grille x y : |
---|
154 | open(91, file=out_grid,form='formatted',status='unknown') |
---|
155 | pt_couranty=Ymax-(numy-1)*pasy_init/2 ! /I\ on avait j=1 au nord. |
---|
156 | do j=1,ny_new |
---|
157 | pt_courantx=Xmin+(numx-1)*pasx_init/2 |
---|
158 | do i=1,nx_new |
---|
159 | write(91,*) pt_courantx, pt_couranty |
---|
160 | pt_courantx = pt_courantx + pasx_new |
---|
161 | end do |
---|
162 | pt_couranty = pt_couranty - pasy_new |
---|
163 | end do |
---|
164 | close(91) |
---|
165 | |
---|
166 | end program changement_grille |
---|