1 !*------------------------------------------------------------------------------
4 !* Forecast Systems Laboratory
10 !* ADVANCED COMPUTING BRANCH
11 !* SMS/NNT Version: 2.0.0
13 !* This software and its documentation are in the public domain and
14 !* are furnished "as is". The United States government, its
15 !* instrumentalities, officers, employees, and agents make no
16 !* warranty, express or implied, as to the usefulness of the software
17 !* and documentation for any purpose. They assume no
18 !* responsibility (1) for the use of the software and documentation;
19 !* or (2) to provide technical support to users.
21 !* Permission to use, copy, modify, and distribute this software is
22 !* hereby granted, provided that this disclaimer notice appears in
23 !* all copies. All modifications to this software must be clearly
24 !* documented, and are solely the responsibility of the agent making
25 !* the modification. If significant modifications or enhancements
26 !* are made to this software, the SMS Development team
27 !* (sms-info@fsl.noaa.gov) should be notified.
29 !*----------------------------------------------------------------------------
32 ! Author: Jacques Middlecoff jacquesm@fsl.noaa.gov
33 !* Date: October 6, 2000
35 !*----------------------------------------------------------------------------
36 subroutine ext_ncd_RealFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status)
38 use ext_ncd_support_routines
40 include 'wrf_status_codes.h'
42 character (*) ,intent(in) :: IO
43 integer ,intent(in) :: NCID
44 integer ,intent(in) :: VarID
45 integer ,dimension(NVarDims),intent(in) :: VStart
46 integer ,dimension(NVarDims),intent(in) :: VCount
47 real, dimension(*) ,intent(inout) :: Data
48 integer ,intent(out) :: Status
51 if(IO == 'write') then
52 stat = NF_PUT_VARA_REAL(NCID,VarID,VStart,VCount,Data)
54 stat = NF_GET_VARA_REAL(NCID,VarID,VStart,VCount,Data)
56 call netcdf_err(stat,Status)
57 if(Status /= WRF_NO_ERR) then
58 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
59 call wrf_debug ( WARN , msg)
62 end subroutine ext_ncd_RealFieldIO
64 subroutine ext_ncd_DoubleFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status)
66 use ext_ncd_support_routines
68 include 'wrf_status_codes.h'
70 character (*) ,intent(in) :: IO
71 integer ,intent(in) :: NCID
72 integer ,intent(in) :: VarID
73 integer ,dimension(NVarDims),intent(in) :: VStart
74 integer ,dimension(NVarDims),intent(in) :: VCount
75 real*8 ,intent(inout) :: Data
76 integer ,intent(out) :: Status
79 if(IO == 'write') then
80 stat = NF_PUT_VARA_DOUBLE(NCID,VarID,VStart,VCount,Data)
82 stat = NF_GET_VARA_DOUBLE(NCID,VarID,VStart,VCount,Data)
84 call netcdf_err(stat,Status)
85 if(Status /= WRF_NO_ERR) then
86 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
87 call wrf_debug ( WARN , msg)
90 end subroutine ext_ncd_DoubleFieldIO
92 subroutine ext_ncd_IntFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status)
94 use ext_ncd_support_routines
96 include 'wrf_status_codes.h'
98 character (*) ,intent(in) :: IO
99 integer ,intent(in) :: NCID
100 integer ,intent(in) :: VarID
101 integer ,dimension(NVarDims),intent(in) :: VStart
102 integer ,dimension(NVarDims),intent(in) :: VCount
103 integer ,intent(inout) :: Data
104 integer ,intent(out) :: Status
107 if(IO == 'write') then
108 stat = NF_PUT_VARA_INT(NCID,VarID,VStart,VCount,Data)
110 stat = NF_GET_VARA_INT(NCID,VarID,VStart,VCount,Data)
112 call netcdf_err(stat,Status)
113 if(Status /= WRF_NO_ERR) then
114 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
115 call wrf_debug ( WARN , msg)
118 end subroutine ext_ncd_IntFieldIO
120 subroutine ext_ncd_LogicalFieldIO(IO,NCID,VarID,VStart,VCount,Data,Status)
122 use ext_ncd_support_routines
124 include 'wrf_status_codes.h'
126 character (*) ,intent(in) :: IO
127 integer ,intent(in) :: NCID
128 integer ,intent(in) :: VarID
129 integer,dimension(NVarDims) ,intent(in) :: VStart
130 integer,dimension(NVarDims) ,intent(in) :: VCount
131 logical,dimension(VCount(1),VCount(2),VCount(3)),intent(inout) :: Data
132 integer ,intent(out) :: Status
133 integer,dimension(:,:,:),allocatable :: Buffer
137 allocate(Buffer(VCount(1),VCount(2),VCount(3)), STAT=stat)
139 Status = WRF_ERR_FATAL_ALLOCATION_ERROR
140 write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__
141 call wrf_debug ( FATAL , msg)
144 if(IO == 'write') then
156 stat = NF_PUT_VARA_INT(NCID,VarID,VStart,VCount,Buffer)
158 stat = NF_GET_VARA_INT(NCID,VarID,VStart,VCount,Buffer)
161 call netcdf_err(stat,Status)
162 if(Status /= WRF_NO_ERR) then
163 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
164 call wrf_debug ( WARN , msg)
167 deallocate(Buffer, STAT=stat)
169 Status = WRF_ERR_FATAL_DEALLOCATION_ERR
170 write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__
171 call wrf_debug ( FATAL , msg)
175 end subroutine ext_ncd_LogicalFieldIO