forked from HYCOM/HYCOM-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhesmf_std.f
85 lines (85 loc) · 2.16 KB
/
hesmf_std.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
program hesmf_std
use mod_mean_esmf ! HYCOM ESMF mean array interface
use mod_za ! HYCOM array I/O interface
implicit none
c
c --- Form the std.dev. from a mean and a mean squared HYCOM ESMF archive file.
c
character label*81,text*18,flnm*80
logical meansq
integer mntype,iweight
c
integer iexpt,yrflag
double precision time_min,time_max,time_ave,time(3)
c
call xcspmd !define idm,jdm
call zaiost
lp=6
c
iexpt = 0
ii = idm
jj = jdm
iorign = 1
jorign = 1
c
c --- number of fields involved
c
call blkini(nn,'nn ')
c
c --- array allocation and initialiation
c
call mean_alloc
c
c --- land masks.
c
call getesmfd('regional.depth')
c
call bigrid_esmf(depths)
c
c --- first the mean archive file
c
read (*,'(a)') flnm
write (lp,'(2a)') ' input mean file: ',flnm(1:len_trim(flnm))
call flush(lp)
call getesmf(flnm,time,iweight,mntype,iexpt,yrflag)
if (mntype.ne.1) then
write(lp,'(/a/)') 'error not a mean file'
stop
endif
time_min = time(1)
time_max = time(2)
time_ave = time(3)
c
call mean_copy
c
c --- then the mean squared archive file
c
read (*,'(a)') flnm
write (lp,'(2a)') ' input mnsq file: ',flnm(1:len_trim(flnm))
call flush(lp)
call getesmf(flnm,time,iweight,mntype,iexpt,yrflag)
if (mntype.ne.2) then
write(lp,'(/a/)') 'error not a mnsq file'
stop
endif
if (time_min.ne.time(1) .or.
& time_max.ne.time(2) .or.
& time_ave.ne.time(3) ) then
write(lp,'(/a/)') 'error mean and mnst files incompatible'
write(lp,*) 'time_min = ',time_min,time(1)
write(lp,*) 'time_max = ',time_max,time(2)
write(lp,*) 'time_ave = ',time_ave,time(3)
stop
endif
c
c --- output the std. dev. archive.
c
call mean_std
c
read (*,'(a)') flnm
write (lp,'(2a)') 'output file: ',flnm(1:len_trim(flnm))
call flush(lp)
mntype = 3
call putesmf(flnm,time_min,time_max,time_ave,
& mntype,iexpt,yrflag)
end