LMDZ
iotd_ini.F90
Go to the documentation of this file.
1  SUBROUTINE iotd_ini(fichnom,iim,jjm,llm,prlonv,prlatu,pcoordv)
2  IMPLICIT NONE
3 
4 !=======================================================================
5 !
6 ! Auteur: L. Fairhead , P. Le Van, Y. Wanherdrick, F. Forget
7 ! -------
8 !
9 ! Objet:
10 ! ------
11 !
12 ! 'Initialize' the diagfi.nc file: write down dimensions as well
13 ! as time-independent fields (e.g: geopotential, mesh area, ...)
14 !
15 !=======================================================================
16 !-----------------------------------------------------------------------
17 ! Declarations:
18 ! -------------
19 
20 #include "netcdf.inc"
21 #include "iotd.h"
22 
23 ! Arguments:
24 ! ----------
25 
26  integer iim,jjm,llm
27  real prlonv(iim),prlatu(jjm),pcoordv(llm),timestep
28  INTEGER id_FOCE
29 
30  integer corner(4),edges(4),ndim
31  real px(1000)
32  character (len=10) :: nom
33 
34 ! Local:
35 ! ------
36  INTEGER ierr
37 
38  integer :: nvarid
39  integer, dimension(2) :: id
40  integer :: varid
41 
42  character*10 fichnom
43  real*4 rlonv(iim),rlatu(jjm),coordv(llm)
44 
45  real pi
46 
47  print*,'INIIO prlonv ',prlonv
48  imax=iim
49  jmax=jjm
50  lmax=llm
51 
52  rlonv=prlonv
53  rlatu=prlatu
54  coordv=pcoordv
55 
56 !-----------------------------------------------------------------------
57 
58 
59  pi=2.*asin(1.)
60 
61 ! Define dimensions
62 
63  ! Create the NetCDF file
64  ierr=nf_create(fichnom, nf_clobber, nid)
65  ! Define the 'Time' dimension
66  ierr=nf_def_dim(nid,"Time",nf_unlimited,dim_coord(4))
67  ! Define the 'Time' variable
68  ierr=nf_def_var(nid, "Time", nf_float, 1, dim_coord(4),varid)
69 ! ! Add a long_name attribute
70 ! ierr=NF_PUT_ATT_TEXT(nid, varid, "long_name",4,"Time")
71 ! ! Add a units attribute
72  ierr=nf_put_att_text(nid, varid,'units',29,"days since 0000-00-0 00:00:00")
73  ! Switch out of NetCDF Define mode
74 
75  ierr=nf_def_dim(nid, "longitude", iim, dim_coord(1))
76  ierr=nf_def_dim(nid, "latitude", jjm, dim_coord(2))
77  ierr=nf_def_dim(nid, "altitude", llm, dim_coord(3))
78 
79 
80  ierr=nf_enddef(nid)
81 !
82 ! Contol parameters for this run
83 ! --------------------------
84 
85  ierr=nf_redef(nid)
86  ierr=nf_def_var(nid,"longitude", nf_float, 1, dim_coord(1),nvarid)
87 ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name", 14,
88 ! . "East longitude")
89 ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east")
90  ierr=nf_enddef(nid)
91  ierr=nf_put_var_real(nid,nvarid,rlonv)
92  print*,ierr
93 
94 ! --------------------------
95  ierr=nf_redef(nid)
96  ierr=nf_def_var(nid, "latitude", nf_float, 1, dim_coord(2),nvarid)
97 ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north")
98 ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name", 14,"North latitude")
99  ierr=nf_enddef(nid)
100  ierr=nf_put_var_real(nid,nvarid,rlatu)
101 !
102 ! --------------------------
103  ierr=nf_redef(nid)
104  ierr=nf_def_var(nid, "altitude", nf_float, 1,dim_coord(3),nvarid)
105  ierr=nf_put_att_text(nid,nvarid,"long_name",10,"pseudo-alt")
106 ! ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',2,"km")
107  if ( pcoordv(2)>pcoordv(1) ) then
108  ierr=nf_put_att_text(nid,nvarid,"long_name",10,"pseudo-alt")
109  ierr=nf_put_att_text(nid,nvarid,'positive',2,"up")
110  else
111  ierr=nf_put_att_text(nid,nvarid,"long_name",8,"pressure")
112  ierr = nf_put_att_text(nid,nvarid,'positive',4,"down")
113  endif
114  ierr=nf_enddef(nid)
115 
116  ierr=nf_put_var_real(nid,nvarid,coordv)
117 !
118  END
subroutine iotd_ini(fichnom, iim, jjm, llm, prlonv, prlatu, pcoordv)
Definition: iotd_ini.F90:2
integer imax
Definition: iotd.h:1
nid INTEGER nid
Definition: iotd.h:16
nid INTEGER dim_coord
Definition: iotd.h:16
jmax
Definition: iotd.h:1
lmax
Definition: iotd.h:1