1 |
module WriteField_m |
module WriteField_m |
2 |
|
|
3 |
USE write_field, ONLY: ncid, record, varid, nbfield |
use CreateNewField_m, only: CreateNewField, ncid, nbfield, MaxWriteField |
|
use CreateNewField_m, only: CreateNewField |
|
4 |
use GetFieldIndex_m, only: GetFieldIndex |
use GetFieldIndex_m, only: GetFieldIndex |
5 |
USE netcdf95, ONLY: nf95_put_var |
USE netcdf95, ONLY: nf95_put_var |
6 |
|
|
7 |
implicit none |
implicit none |
8 |
|
|
9 |
|
integer, save:: Record(MaxWriteField) |
10 |
|
|
11 |
interface WriteField |
interface WriteField |
12 |
module procedure WriteField3d,WriteField2d,WriteField1d |
module procedure WriteField3d,WriteField2d,WriteField1d |
13 |
end interface WriteField |
end interface WriteField |
32 |
if (Index==-1) then |
if (Index==-1) then |
33 |
call CreateNewField(name, shape(field)) |
call CreateNewField(name, shape(field)) |
34 |
Index=nbfield |
Index=nbfield |
35 |
|
Record(Index) = 1 |
36 |
else |
else |
37 |
Record(Index)=Record(Index)+1 |
Record(Index)=Record(Index)+1 |
38 |
endif |
endif |
39 |
|
|
40 |
call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, & |
call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, & |
41 |
start = (/1, Record(Index)/)) |
start = (/1, Record(Index)/)) |
42 |
|
|
43 |
end subroutine WriteField1d |
end subroutine WriteField1d |
46 |
|
|
47 |
subroutine WriteField2d(name,Field) |
subroutine WriteField2d(name,Field) |
48 |
|
|
49 |
|
use netcdf, only: nf90_sync |
50 |
|
|
51 |
character(len=*), intent(in):: name |
character(len=*), intent(in):: name |
52 |
real, intent(in):: Field(:, :) |
real, intent(in):: Field(:, :) |
53 |
|
|
54 |
! Local: |
! Local: |
55 |
integer index |
integer index, status |
56 |
|
|
57 |
!------------------------------------------- |
!------------------------------------------- |
58 |
|
|
61 |
if (Index==-1) then |
if (Index==-1) then |
62 |
call CreateNewField(name, shape(field)) |
call CreateNewField(name, shape(field)) |
63 |
Index=nbfield |
Index=nbfield |
64 |
|
Record(Index) = 1 |
65 |
else |
else |
66 |
Record(Index)=Record(Index)+1 |
Record(Index)=Record(Index)+1 |
67 |
endif |
endif |
68 |
|
|
69 |
call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, & |
call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, & |
70 |
start = (/1, 1, Record(Index)/)) |
start = (/1, 1, Record(Index)/)) |
71 |
|
status = nf90_sync(Ncid(Index)) |
72 |
|
|
73 |
end subroutine WriteField2d |
end subroutine WriteField2d |
74 |
|
|
89 |
if (Index==-1) then |
if (Index==-1) then |
90 |
call CreateNewField(name, shape(field)) |
call CreateNewField(name, shape(field)) |
91 |
Index=nbfield |
Index=nbfield |
92 |
|
Record(Index) = 1 |
93 |
else |
else |
94 |
Record(Index)=Record(Index)+1 |
Record(Index)=Record(Index)+1 |
95 |
endif |
endif |
96 |
|
|
97 |
call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, & |
call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, & |
98 |
start = (/1, 1, 1, Record(Index)/)) |
start = (/1, 1, 1, Record(Index)/)) |
99 |
|
|
100 |
end subroutine WriteField3d |
end subroutine WriteField3d |