9 |
use CreateNewField_m, only: CreateNewField |
use CreateNewField_m, only: CreateNewField |
10 |
use GetFieldIndex_m, only: GetFieldIndex |
use GetFieldIndex_m, only: GetFieldIndex |
11 |
USE netcdf95, ONLY: nf95_put_var |
USE netcdf95, ONLY: nf95_put_var |
12 |
USE write_field, ONLY: fieldid, fieldindex, fieldvarid |
USE write_field, ONLY: ncid, record, varid, nbfield |
13 |
|
|
14 |
character(len=*) :: name |
character(len=*) :: name |
15 |
integer :: dimx, dimy, dimz |
integer :: dimx, dimy, dimz |
16 |
real, dimension(dimx, dimy, dimz) :: Field |
real, dimension(dimx, dimy, dimz) :: Field |
17 |
integer :: index |
integer :: index |
|
integer :: start(4) |
|
|
integer :: count(4) |
|
18 |
|
|
19 |
!------------------------------------------------------------ |
!------------------------------------------------------------ |
20 |
|
|
21 |
Index=GetFieldIndex(name) |
Index=GetFieldIndex(name) |
22 |
if (Index==-1) then |
if (Index==-1) then |
23 |
call CreateNewField(name, dimx, dimy, dimz) |
call CreateNewField(name, (/dimx, dimy, dimz/)) |
24 |
Index=GetFieldIndex(name) |
Index=nbfield |
25 |
else |
else |
26 |
FieldIndex(Index)=FieldIndex(Index)+1 |
Record(Index)=Record(Index)+1 |
27 |
endif |
endif |
28 |
|
|
29 |
start(1)=1 |
call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, & |
30 |
start(2)=1 |
start = (/1, 1, 1, Record(Index)/)) |
|
start(3)=1 |
|
|
start(4)=FieldIndex(Index) |
|
|
|
|
|
count(1)=dimx |
|
|
count(2)=dimy |
|
|
count(3)=dimz |
|
|
count(4)=1 |
|
|
|
|
|
call NF95_PUT_VAR(FieldId(Index), FieldVarId(Index), Field, start, count) |
|
31 |
|
|
32 |
end subroutine WriteField_gen |
end subroutine WriteField_gen |
33 |
|
|