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

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

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


Revision 1.10 - (show annotations) (download)
Mon Dec 10 00:01:30 2012 UTC (11 years, 6 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint65, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e
Changes since 1.9: +2 -2 lines
- refine profIsInRunTime test to allow for short tests.
- hard code file units to avoid conflict with nectdf file units (temporary fix?).

1 C $Header: /u/gcmpack/MITgcm/pkg/profiles/profiles_init_ncfile.F,v 1.9 2012/06/22 22:07:34 gforget Exp $
2 C $Name: $
3
4 #include "PROFILES_OPTIONS.h"
5
6 C o==========================================================o
7 C | subroutine profiles_init_ncfile |
8 C | o initialization of model counterparts files |
9 C | for netcdf profiles data |
10 C | started: Gael Forget 15-March-2006 |
11 C o==========================================================o
12
13 subroutine profiles_init_ncfile(num_file,fid1,file2,fid2,length,
14 & Zlength,bi,bj,myThid)
15
16 implicit none
17
18 C ==================== Global Variables ===========================
19 #include "EEPARAMS.h"
20 #include "SIZE.h"
21 #include "GRID.h"
22 #include "DYNVARS.h"
23 #ifdef ALLOW_PROFILES
24 # include "profiles.h"
25 # include "netcdf.inc"
26 #endif
27 C ==================== Routine Variables ==========================
28 integer fid1,fid2,dimid1,dimid2,varid(10),varid0
29 integer myThid,bi,bj,err,vecid(2), length, Zlength
30 character*(80) file2
31 integer irec, num_var,num_file
32 real*8 tmp_vec(Zlength+1)
33 c == end of interface ==
34
35 #ifdef ALLOW_PROFILES
36
37 if (profilesDoNcOutput) then
38 c1) creation :
39 err = NF_CREATE(file2 , NF_CLOBBER, fid2)
40 err = NF_DEF_DIM(fid2,'iDEPTH', Zlength ,dimid1)
41 err = NF_DEF_DIM(fid2,'iPROF',length,dimid2)
42 vecid(1)=dimid1
43 vecid(2)=dimid2
44
45 err = NF_DEF_VAR (fid2,'prof_ind_glob', NF_INT, 1,vecid(2),
46 & varid(1))
47 err = NF_PUT_ATT_INT(fid2,varid(1),'_FillValue',NF_INT,1,0)
48
49 do num_var=1,NVARMAX
50 err = NF_INQ_VARID(fid1,prof_names(num_var), varid0 )
51 if (err.EQ.NF_NOERR) then
52
53 err = NF_DEF_VAR (fid2,prof_names(num_var), NF_DOUBLE,
54 & 2,vecid,varid(2+(num_var-1)*2))
55 err = NF_PUT_ATT_DOUBLE(fid2, varid(2+(num_var-1)*2),'_FillValue',
56 & NF_DOUBLE,1, 0. _d 0 )
57 err = NF_DEF_VAR (fid2,prof_namesmask(num_var),
58 & NF_DOUBLE, 2,vecid, varid(3+(num_var-1)*2))
59 err = NF_PUT_ATT_DOUBLE(fid2,varid(3+(num_var-1)*2),'_FillValue',
60 & NF_DOUBLE,1, 0. _d 0)
61
62 endif
63 enddo
64
65 err=NF_ENDDEF(fid2)
66 err=NF_CLOSE(fid2)
67
68 err = NF_OPEN(file2, NF_WRITE , fid2)
69
70 else
71
72 c call MDSFINDUNIT( fid2 , mythid )
73 open( fid2, file=file2, form ='unformatted', status='unknown',
74 & access='direct', recl= (Zlength + 1)*WORDLENGTH*2 )
75
76 do irec=1,Zlength+1
77 tmp_vec(irec)=0
78 enddo
79 #ifdef _BYTESWAPIO
80 call MDS_BYTESWAPR8(Zlength+1,tmp_vec)
81 #endif
82 do irec=length,1,-1
83 do num_var=prof_num_var_tot(num_file,bi,bj),1,-1
84 write(fid2,rec=((irec-1)*prof_num_var_tot(num_file,bi,bj)
85 & +num_var-1)*2 +1) tmp_vec
86 write(fid2,rec=((irec-1)*prof_num_var_tot(num_file,bi,bj)
87 & +num_var-1)*2 +2) tmp_vec
88 enddo
89 enddo
90
91 endif
92
93 #endif
94
95 END

  ViewVC Help
Powered by ViewVC 1.1.22