source: LMDZ5/trunk/libf/phylmd/iotd_ini.F90 @ 5456

Last change on this file since 5456 was 2239, checked in by Ehouarn Millour, 10 years ago

Reorganizing physics/dynamics interface:

  • what is related to dynamics-physics interface is now in a seperate directory: dynlmdz_phy* for physics in phy*
  • 1d model and related dependencies (including a couple from "dynamics", set up as symbolic links) is now in subdirectory "dyn1d" of phy*.
  • "bibio" directory is now "misc" and should only contain autonomous utilities.
  • "cosp" is now a subdirectory of phylmd.

EM

  • Property svn:executable set to *
File size: 3.3 KB
Line 
1      SUBROUTINE iotd_ini(fichnom,iim,jjm,llm,prlonv,prlatu,pcoordv)
2      IMPLICIT NONE
3
4!=======================================================================
5!
6!   Auteur:  F. Hourdin
7!   -------
8!
9!   Objet:
10!   ------
11!   Light interface for netcdf outputs. can be used outside LMDZ
12!
13!=======================================================================
14!-----------------------------------------------------------------------
15!   Declarations:
16!   -------------
17
18#include "netcdf.inc"
19#include "iotd.h"
20
21!   Arguments:
22!   ----------
23
24      integer iim,jjm,llm
25      real prlonv(iim),prlatu(jjm),pcoordv(llm),timestep
26      INTEGER id_FOCE
27
28      integer corner(4),edges(4),ndim
29      real  px(1000)
30      character (len=10) :: nom
31
32!   Local:
33!   ------
34      INTEGER ierr
35
36      integer :: nvarid
37      integer, dimension(2) :: id 
38      integer :: varid
39
40      character*10 fichnom
41      real*4 rlonv(iim),rlatu(jjm),coordv(llm)
42
43      real pi
44
45      print*,'INIIO prlonv ',prlonv
46      imax=iim
47      jmax=jjm
48      lmax=llm
49
50      rlonv=prlonv
51      rlatu=prlatu
52      coordv=pcoordv
53
54!-----------------------------------------------------------------------
55
56
57      pi=2.*asin(1.)
58
59! Define dimensions
60   
61         ! Create the NetCDF file
62         ierr=NF_CREATE(fichnom, NF_CLOBBER, nid)
63         ! Define the 'Time' dimension
64         ierr=nf_def_dim(nid,"Time",NF_UNLIMITED,dim_coord(4))
65         ! Define the 'Time' variable
66         ierr=NF_DEF_VAR(nid, "Time", NF_FLOAT, 1, dim_coord(4),varid)
67!        ! Add a long_name attribute
68!        ierr=NF_PUT_ATT_TEXT(nid, varid, "long_name",4,"Time")
69!        ! Add a units attribute
70         ierr=NF_PUT_ATT_TEXT(nid, varid,'units',29,"days since 0000-00-0 00:00:00")
71         ! Switch out of NetCDF Define mode
72
73      ierr=NF_DEF_DIM(nid, "longitude", iim, dim_coord(1))
74      ierr=NF_DEF_DIM(nid, "latitude", jjm, dim_coord(2))
75      ierr=NF_DEF_DIM(nid, "altitude", llm, dim_coord(3))
76
77
78      ierr=NF_ENDDEF(nid)
79!
80!  Contol parameters for this run
81! --------------------------
82
83      ierr=NF_REDEF(nid)
84      ierr=NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, dim_coord(1),nvarid)
85!     ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name", 14,
86!    .      "East longitude")
87!     ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east")
88      ierr=NF_ENDDEF(nid)
89      ierr=NF_PUT_VAR_REAL(nid,nvarid,rlonv)
90       print*,ierr
91
92! --------------------------
93      ierr=NF_REDEF(nid)
94      ierr=NF_DEF_VAR(nid, "latitude", NF_FLOAT, 1, dim_coord(2),nvarid)
95!     ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north")
96!     ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name", 14,"North latitude")
97      ierr=NF_ENDDEF(nid)
98      ierr=NF_PUT_VAR_REAL(nid,nvarid,rlatu)
99!
100! --------------------------
101      ierr=NF_REDEF(nid)
102      ierr=NF_DEF_VAR(nid, "altitude", NF_FLOAT, 1,dim_coord(3),nvarid)
103      ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name",10,"pseudo-alt")
104!     ierr=NF_PUT_ATT_TEXT(nid,nvarid,'units',2,"km")
105      if ( pcoordv(2)>pcoordv(1) ) then
106         ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name",10,"pseudo-alt")
107         ierr=NF_PUT_ATT_TEXT(nid,nvarid,'positive',2,"up")
108      else
109         ierr=NF_PUT_ATT_TEXT(nid,nvarid,"long_name",8,"pressure")
110         ierr = NF_PUT_ATT_TEXT (nid,nvarid,'positive',4,"down")
111      endif
112      ierr=NF_ENDDEF(nid)
113
114      ierr=NF_PUT_VAR_REAL(nid,nvarid,coordv)
115!
116      END
Note: See TracBrowser for help on using the repository browser.