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_pnc_RealFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
38 use ext_pnc_support_routines
40 include 'wrf_status_codes.h'
41 # include "pnetcdf.inc"
42 logical ,intent(in) :: Coll
43 character (*) ,intent(in) :: IO
44 integer ,intent(in) :: NCID
45 integer ,intent(in) :: VarID
46 integer ,dimension(NVarDims),intent(in) :: VStart
47 integer ,dimension(NVarDims),intent(in) :: VCount
48 real, dimension(*) ,intent(inout) :: Data
49 integer ,intent(out) :: Status
52 integer(KIND=MPI_OFFSET_KIND), dimension(NVarDims) :: VStart_mpi, VCount_mpi
56 if(IO == 'write') then
58 stat = NFMPI_PUT_VARA_REAL_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
60 stat = NFMPI_PUT_VARA_REAL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
64 stat = NFMPI_GET_VARA_REAL_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
66 stat = NFMPI_GET_VARA_REAL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
69 call netcdf_err(stat,Status)
70 if(Status /= WRF_NO_ERR) then
71 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
72 call wrf_debug ( WARN , msg)
75 end subroutine ext_pnc_RealFieldIO
77 subroutine ext_pnc_DoubleFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
79 use ext_pnc_support_routines
81 include 'wrf_status_codes.h'
82 # include "pnetcdf.inc"
83 logical ,intent(in) :: Coll
84 character (*) ,intent(in) :: IO
85 integer ,intent(in) :: NCID
86 integer ,intent(in) :: VarID
87 integer ,dimension(NVarDims),intent(in) :: VStart
88 integer ,dimension(NVarDims),intent(in) :: VCount
89 real*8 ,intent(inout) :: Data
90 integer ,intent(out) :: Status
93 integer(KIND=MPI_OFFSET_KIND), dimension(NVarDims) :: VStart_mpi, VCount_mpi
97 if(IO == 'write') then
99 stat = NFMPI_PUT_VARA_DOUBLE_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
101 stat = NFMPI_PUT_VARA_DOUBLE(NCID,VarID,VStart_mpi,VCount_mpi,Data)
105 stat = NFMPI_GET_VARA_DOUBLE_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
107 stat = NFMPI_GET_VARA_DOUBLE(NCID,VarID,VStart_mpi,VCount_mpi,Data)
110 call netcdf_err(stat,Status)
111 if(Status /= WRF_NO_ERR) then
112 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
113 call wrf_debug ( WARN , msg)
116 end subroutine ext_pnc_DoubleFieldIO
118 subroutine ext_pnc_IntFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
120 use ext_pnc_support_routines
122 include 'wrf_status_codes.h'
123 # include "pnetcdf.inc"
124 logical ,intent(in) :: Coll
125 character (*) ,intent(in) :: IO
126 integer ,intent(in) :: NCID
127 integer ,intent(in) :: VarID
128 integer ,dimension(NVarDims),intent(in) :: VStart
129 integer ,dimension(NVarDims),intent(in) :: VCount
130 integer ,intent(inout) :: Data
131 integer ,intent(out) :: Status
134 integer(KIND=MPI_OFFSET_KIND), dimension(NVarDims) :: VStart_mpi, VCount_mpi
138 if(IO == 'write') then
140 stat = NFMPI_PUT_VARA_INT_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
142 stat = NFMPI_PUT_VARA_INT(NCID,VarID,VStart_mpi,VCount_mpi,Data)
146 stat = NFMPI_GET_VARA_INT_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Data)
148 stat = NFMPI_GET_VARA_INT(NCID,VarID,VStart_mpi,VCount_mpi,Data)
151 call netcdf_err(stat,Status)
152 if(Status /= WRF_NO_ERR) then
153 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
154 call wrf_debug ( WARN , msg)
157 end subroutine ext_pnc_IntFieldIO
159 subroutine ext_pnc_LogicalFieldIO(Coll,IO,NCID,VarID,VStart,VCount,Data,Status)
161 use ext_pnc_support_routines
163 include 'wrf_status_codes.h'
164 # include "pnetcdf.inc"
165 logical ,intent(in) :: Coll
166 character (*) ,intent(in) :: IO
167 integer ,intent(in) :: NCID
168 integer ,intent(in) :: VarID
169 integer,dimension(NVarDims) ,intent(in) :: VStart
170 integer,dimension(NVarDims) ,intent(in) :: VCount
171 logical,dimension(VCount(1),VCount(2),VCount(3)),intent(inout) :: Data
172 integer ,intent(out) :: Status
173 integer,dimension(:,:,:),allocatable :: Buffer
177 integer(KIND=MPI_OFFSET_KIND), dimension(NVarDims) :: VStart_mpi, VCount_mpi
181 allocate(Buffer(VCount(1),VCount(2),VCount(3)), STAT=stat)
183 Status = WRF_ERR_FATAL_ALLOCATION_ERROR
184 write(msg,*) 'Fatal ALLOCATION ERROR in ',__FILE__,', line', __LINE__
185 call wrf_debug ( FATAL , msg)
188 if(IO == 'write') then
201 stat = NFMPI_PUT_VARA_INT_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Buffer)
203 stat = NFMPI_PUT_VARA_INT(NCID,VarID,VStart_mpi,VCount_mpi,Buffer)
207 stat = NFMPI_GET_VARA_INT_ALL(NCID,VarID,VStart_mpi,VCount_mpi,Buffer)
209 stat = NFMPI_GET_VARA_INT(NCID,VarID,VStart_mpi,VCount_mpi,Buffer)
213 call netcdf_err(stat,Status)
214 if(Status /= WRF_NO_ERR) then
215 write(msg,*) 'NetCDF error in ',__FILE__,', line', __LINE__
216 call wrf_debug ( WARN , msg)
219 deallocate(Buffer, STAT=stat)
221 Status = WRF_ERR_FATAL_DEALLOCATION_ERR
222 write(msg,*) 'Fatal DEALLOCATION ERROR in ',__FILE__,', line', __LINE__
223 call wrf_debug ( FATAL , msg)
227 end subroutine ext_pnc_LogicalFieldIO