2subroutine getivariablen(fileName,DateStr,dh,VarName,VarBuff,IM,JSTA_2L,JEND_2U,LM,IM1,JS,JE,LM1)
59 use ctlblk_mod,
only: me, spval, submodelname
63 character(len=256) ,
intent(in) :: fileName
64 character(len=19) ,
intent(in) :: DateStr
65 integer ,
intent(in) :: dh
66 character(*) ,
intent(in) :: VarName
67 integer,
intent(out) :: VarBuff(IM,JSTA_2L:JEND_2U,LM)
68 integer,
intent(in) :: IM,LM,JSTA_2L,JEND_2U
69 integer,
intent(in) :: IM1,LM1,JS,JE
71 integer :: WrfType,i,j,l,ll
72 integer,
dimension(4) :: start_index, end_index
73 character (len= 4) :: staggering
74 character (len= 3) :: ordering
75 character (len=80),
dimension(3) :: dimnames
76 integer,
allocatable,
dimension(:,:,:,:) :: data
79 character(len=132) :: Stagger
87 call ext_ncd_get_var_info(dh,trim(varname),ndim,ordering,stagger,start_index,end_index,wrftype,ierr)
89 if (me==0)
write(*,*)
'Error: ',ierr,trim(varname),
' not found in ',filename
93 allocate(
data (end_index(1), end_index(2), end_index(3), 1))
94 if (me==0)
write(*,*)
'WrfType in getIVariable= ',wrftype
105 call ext_ncd_read_field(dh,datestr,trim(varname),
data,wrftype,0,0,0,ordering,&
106 staggering, dimnames , &
107 start_index,end_index, &
108 start_index,end_index, &
109 start_index,end_index, &
111 IF ( ierr /= 0 )
THEN
113 write(*,*)
'Error reading ',varname,
' from ',filename
114 write(*,*)
' ndim = ', ndim
115 write(*,*)
' end_index(1) ',end_index(1)
116 write(*,*)
' end_index(2) ',end_index(2)
117 write(*,*)
' end_index(3) ',end_index(3)
118 write(*,*)
'Error reading ',varname,
' from ',filename
125 if (im1>end_index(1))
write(*,*)
'Err:',varname,
' IM1=',im1,&
126 ' but data dim=',end_index(1)
127 if (je>end_index(2))
write(*,*)
'Err:',varname,
' JE=',je,&
128 ' but data dim=',end_index(2)
129 if (lm1>end_index(3))
write(*,*)
'Err:',varname,
' LM1=',lm1,&
130 ' but data dim=',end_index(3)
132 write(*,*)
'Error: ndim = ',ndim
136 if (submodelname==
'MPAS')
then
138 call ext_ncd_get_var_ti_real(dh,
"_FillValue",trim(varname),fillvalue,1,outcount,ierr)
143 if (
data(i,j,ll,1) /= fillvalue)
then
144 varbuff(i,j,l)=
data(i,j,ll,1)
156 varbuff(i,j,l)=
data(i,j,ll,1)
166end subroutine getivariablen