/[MITgcm]/MITgcm/pkg/profiles/profiles_readvector.F
ViewVC logotype

Contents of /MITgcm/pkg/profiles/profiles_readvector.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.9 - (show annotations) (download)
Tue Aug 24 15:03:15 2010 UTC (13 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint63, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65d, checkpoint65e, checkpoint62k, checkpoint62j, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x
Changes since 1.8: +12 -12 lines
remove tabs

1 C $Header: /u/gcmpack/MITgcm/pkg/profiles/profiles_readvector.F,v 1.8 2007/06/15 04:49:31 gforget Exp $
2 C $Name: $
3
4 #include "PROFILES_OPTIONS.h"
5
6 C o==========================================================o
7 C | subroutine profiles_readvector |
8 C | o reads a profile from a netcdf profiles data file |
9 C | started: Gael Forget 15-March-2006 |
10 C o==========================================================o
11
12 SUBROUTINE profiles_readvector(fNb, vNb, irec,
13 & vec_loc_length, vec_loc , bi,bj, myThid)
14
15 implicit none
16
17 C ==================== Global Variables ===========================
18 #include "EEPARAMS.h"
19 #include "SIZE.h"
20 #include "GRID.h"
21 #include "DYNVARS.h"
22 #ifdef ALLOW_PROFILES
23 #include "netcdf.inc"
24 #include "profiles.h"
25 #endif
26 C ==================== Routine Variables ==========================
27 integer vec_loc_length, vNb, k, kk, kkk,bi,bj
28 integer irec, fNb, myThid,err,varid1,tmpprofno
29 _RL vec_loc(vec_loc_length)
30
31 #ifdef ALLOW_PROFILES
32
33 integer vec_start(2),vec_count(2)
34 _RL vec_tmp1(1000*NLEVELMAX),vec_tmp2(1000*NLEVELMAX)
35 character*(max_len_mbuf) msgbuf
36
37 c-- == end of interface ==
38
39
40 if ( (irec.LT.profiles_minind_buff(bi,bj)).OR.
41 & (irec.GT.profiles_maxind_buff(bi,bj)).OR.
42 & (profiles_curfile_buff(bi,bj).NE.fNb) ) then
43 err = NF_INQ_DIMID(fiddata(fNb,bi,bj),'iPROF', varid1)
44 err = NF_INQ_DIMLEN(fiddata(fNb,bi,bj), varid1, tmpprofno)
45
46 if (profiles_curfile_buff(bi,bj).NE.fNb) then
47 c no asumption on whether a forward or a backward loop is calling
48 profiles_minind_buff(bi,bj)=max(1,irec-500+1)
49 profiles_maxind_buff(bi,bj)=min(tmpprofno,irec+500)
50 elseif (irec.LT.profiles_minind_buff(bi,bj)) then
51 c implies that a backward loop is calling
52 profiles_minind_buff(bi,bj)=max(1,irec-999)
53 profiles_maxind_buff(bi,bj)=irec
54 else
55 c implies that a forward loop is calling
56 profiles_minind_buff(bi,bj)=irec
57 profiles_maxind_buff(bi,bj)=min(tmpprofno,irec+999)
58 endif
59
60 write(msgbuf,'(a,5I9)')
61 & 'buffer readvector ',
62 & profiles_minind_buff(bi,bj), profiles_maxind_buff(bi,bj),
63 & irec, profNo(fNb,bi,bj), tmpprofno
64 call print_message(
65 & msgbuf, standardmessageunit, SQUEEZE_RIGHT , mythid)
66
67 vec_start(1)=1
68 vec_start(2)=profiles_minind_buff(bi,bj)
69 vec_count(1)=vec_loc_length
70 vec_count(2)=
71 & profiles_maxind_buff(bi,bj)-profiles_minind_buff(bi,bj)+1
72
73 do kkk=1,NVARMAX
74 if (vec_quantities(fNb,kkk,bi,bj).EQV..TRUE.) then
75 err = NF_INQ_VARID(fiddata(fNb,bi,bj),prof_names(kkk),
76 & varid1 )
77 err = NF_GET_VARA_DOUBLE(fiddata(fNb,bi,bj), varid1 , vec_start,
78 & vec_count, vec_tmp1)
79 err = NF_INQ_VARID(fiddata(fNb,bi,bj),prof_namesweight(kkk)
80 & , varid1 )
81 err = NF_GET_VARA_DOUBLE(fiddata(fNb,bi,bj), varid1 , vec_start,
82 & vec_count, vec_tmp2)
83
84 if (err.NE.NF_NOERR) then
85 WRITE(errorMessageUnit,'(A)')
86 & 'WARNING in profiles_readvector: record not found!!'
87 endif
88
89 do k=1,vec_count(1)
90 do kk=1,vec_count(2)
91 profiles_data_buff(k,kk,kkk,bi,bj)=vec_tmp1((kk-1)*vec_count(1)+k)
92 profiles_weight_buff(k,kk,kkk,bi,bj)=vec_tmp2((kk-1)*vec_count(1)
93 & +k)
94 enddo
95 enddo
96 endif
97 enddo
98
99 profiles_curfile_buff(bi,bj)=fNb
100 endif
101
102 cgf ...now, get vec_loc from the buffer
103 if (vNb.LT.0) then
104 do k=1,vec_loc_length
105 vec_loc(k)= profiles_weight_buff
106 & (k,irec-profiles_minind_buff(bi,bj)+1,-vNb,bi,bj)
107 enddo
108
109 else
110 do k=1,vec_loc_length
111 vec_loc(k)=profiles_data_buff
112 & (k,irec-profiles_minind_buff(bi,bj)+1,vNb,bi,bj)
113 enddo
114 endif
115
116 #endif
117
118 END

  ViewVC Help
Powered by ViewVC 1.1.22