1 |
module writefield_gen_m |
2 |
|
3 |
implicit none |
4 |
|
5 |
contains |
6 |
|
7 |
subroutine WriteField_gen(name, Field, dimx, dimy, dimz) |
8 |
|
9 |
use CreateNewField_m, only: CreateNewField |
10 |
use GetFieldIndex_m, only: GetFieldIndex |
11 |
USE netcdf95, ONLY: nf95_put_var |
12 |
USE write_field, ONLY: fieldid, fieldindex, fieldvarid |
13 |
|
14 |
character(len=*) :: name |
15 |
integer :: dimx, dimy, dimz |
16 |
real, dimension(dimx, dimy, dimz) :: Field |
17 |
integer :: index |
18 |
integer :: start(4) |
19 |
integer :: count(4) |
20 |
|
21 |
!------------------------------------------------------------ |
22 |
|
23 |
Index=GetFieldIndex(name) |
24 |
if (Index==-1) then |
25 |
call CreateNewField(name, dimx, dimy, dimz) |
26 |
Index=GetFieldIndex(name) |
27 |
else |
28 |
FieldIndex(Index)=FieldIndex(Index)+1 |
29 |
endif |
30 |
|
31 |
start(1)=1 |
32 |
start(2)=1 |
33 |
start(3)=1 |
34 |
start(4)=FieldIndex(Index) |
35 |
|
36 |
count(1)=dimx |
37 |
count(2)=dimy |
38 |
count(3)=dimz |
39 |
count(4)=1 |
40 |
|
41 |
call NF95_PUT_VAR(FieldId(Index), FieldVarId(Index), Field, start, count) |
42 |
|
43 |
end subroutine WriteField_gen |
44 |
|
45 |
end module writefield_gen_m |