<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">I am having a problem with the wrf_cape_3d code. When I run it, I get the following error:&nbsp;</div><div class=""><br class=""></div><div class=""><font face="Courier" class="">"If p,q,t,z are 3-dimensional (time x lev x lat x lon), psfc,zsfc must be 2-dimensional (lat x lon)"</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class="">However, my p,q,t,and z variables are all 3-D and my psfc, and zsfc, are 2-D (as required).&nbsp;</div><div class=""><br class=""></div><div class="">I am running NCL Version 6.2.1</div><div class=""><br class=""></div><div class="">Below is a copy of my code:</div><div class=""><br class=""></div><div class=""><font face="Courier" class="">;-------------------------------------------------------------------------------</font><br class=""><font face="Courier" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</font><br class=""><font face="Courier" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</font><br class=""><font face="Courier" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</font><br class=""><font face="Courier" class="">;-------------------------------------------------------------------------------</font><br class=""><font face="Courier" class="">begin</font><br class=""><font face="Courier" class="">;-------------------------------------------------------------------------------</font><br class=""><font face="Courier" class="">; Read netCDF files and extract variables</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;h48_t_file = addfile("/Users/andrea/Documents/gigaLES/data/TWPICE_gigaLES_3D_TABS_0000086400.nc","r")</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;h48_q_file = addfile("/Users/andrea/Documents/gigaLES/data/TWPICE_gigaLES_3D_QV_0000086400.nc","r")</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;h48_t = rm_single_dims(h48_t_file-&gt;TABS)&nbsp; &nbsp; &nbsp;&nbsp;; Read in variables and remove</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;h48_q = rm_single_dims(h48_q_file-&gt;QV)&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;; singleton time dimension</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;p = h48_t_file-&gt;pres</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;x = h48_t_file-&gt;x</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;y = h48_t_file-&gt;y</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;z = h48_t_file-&gt;z</font><br class=""><font face="Courier" class="">;-------------------------------------------------------------------------------</font><br class=""><font face="Courier" class="">; Moisture is in specific humidity. Need to convert to mixing ratio</font><br class=""><font face="Courier" class="">;&nbsp;&nbsp;&nbsp;r = q / (1 - q)</font><br class=""><font face="Courier" class="">;-------------------------------------------------------------------------------</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;h48_r = h48_q&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;; Copy metadata</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;h48_q_mask = h48_q<span class="Apple-tab-span" style="white-space:pre">                </span>; Copy metadata</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;</font><font face="Courier" class="">h48_q_mask@_FillValue = 0.0&nbsp;&nbsp;&nbsp;; Set FillValue to 0 to minimize computational problems with CAPE function</font></div><div class=""><font face="Courier" class="">&nbsp; h48_q_mask = mask(h48_q,h48_q.eq.1,False)&nbsp;&nbsp; &nbsp;&nbsp;; Mask values of 1 to avoid dividing by zero</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;h48_r = (/ h48_q / (1 - h48_q_mask) /)&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;; Do math on values only</font><br class=""><font face="Courier" class="">;-------------------------------------------------------------------------------</font><br class=""><font face="Courier" class="">; NCL CAPE function requires two additional values, which we define here</font><br class=""><font face="Courier" class="">; 1. Surface height</font><br class=""><font face="Courier" class="">&nbsp; &nbsp; &nbsp;zsf = 0.0</font><br class=""><font face="Courier" class="">; 2. Surface pressures</font><br class=""><font face="Courier" class="">&nbsp; &nbsp; &nbsp;psf = 1013.25</font><br class=""><font face="Courier" class="">;-------------------------------------------------------------------------------</font><br class=""><font face="Courier" class="">; Scalar values need to be conformed to a grid in order to be used by the function</font><br class=""><font face="Courier" class="">; First, the surface height and pressure become 2D</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;ny = dimsizes(h48_t(:,0,0))&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;; Find size of each dimension</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;nx = dimsizes(h48_t(0,:,0))</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;nz = dimsizes(h48_t(0,0,:))</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;zsf_grid1 = conform_dims( (/ny,nx,1/) , zsf , 2 )</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;psf_grid1 = conform_dims( (/ny,nx,1/) , psf , 2 )</font><br class=""><br class=""><font face="Courier" class="">; Remove the singleton dimension</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;zsf_grid = rm_single_dims(zsf_grid1)</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;psf_grid = rm_single_dims(psf_grid1)</font><br class=""><br class=""><font face="Courier" class="">; Second, the pressure and height become 3D</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;p_3d = conform_dims( (/ny,nx,nz/) , p , 2 )</font><br class=""><font face="Courier" class="">&nbsp;&nbsp;z_3d = conform_dims( (/ny,nx,nz/) , z , 2 )</font><br class=""><br class=""><br class=""><font face="Courier" class="">;-------------------------------------------------------------------------------</font><br class=""><font face="Courier" class="">; Calculate CAPE and CIN using NCL's wrf_cape_3d function</font><br class=""><br class=""><font face="Courier" class="">&nbsp;&nbsp;cape_cin48 = wrf_cape_3d(p_3d,h48_t,h48_r,z_3d,zsf_grid,psf_grid,False)</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class="">This is where I run into errors. Doing a printVarSummary on all of the variables used in the wf_cape_3d function gives:</div><div class=""><br class=""></div><div class=""><font face="Menlo" style="font-size: 11px;" class="">Variable: zsf_grid<br class="">Type: float<br class="">Total Size: 16777216 bytes<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;4194304 values<br class="">Number of Dimensions: 2<br class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space: pre;">        </span>[2048] x [2048]<br class="">Coordinates:&nbsp;<br class=""><br class="">Variable: psf_grid<br class="">Type: float<br class="">Total Size: 16777216 bytes<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;4194304 values<br class="">Number of Dimensions: 2<br class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space: pre;">        </span>[2048] x [2048]<br class="">Coordinates:&nbsp;<br class=""><br class="">Variable: p_3d<br class="">Type: double<br class="">Total Size: 8556380160 bytes<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;1069547520 values<br class="">Number of Dimensions: 3<br class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space: pre;">        </span>[2048] x [2048] x [255]<br class="">Coordinates:&nbsp;<br class=""><br class="">Variable: z_3d<br class="">Type: double<br class="">Total Size: 8556380160 bytes<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;1069547520 values<br class="">Number of Dimensions: 3<br class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space: pre;">        </span>[2048] x [2048] x [255]<br class="">Coordinates:&nbsp;<br class=""><br class="">Variable: h48_t<br class="">Type: float<br class="">Total Size: 4278190080 bytes<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;1069547520 values<br class="">Number of Dimensions: 3<br class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space: pre;">        </span>[y | 2048] x [x | 2048] x [z | 255]<br class="">Coordinates:&nbsp;<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;y: [&nbsp;&nbsp;50..204750]<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;x: [&nbsp;&nbsp;50..204750]<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;z: [&nbsp;&nbsp;25..26685.83203]<br class="">Number Of Attributes: 1<br class="">&nbsp;&nbsp;time :<span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;20<br class=""><br class="">Variable: h48_r<br class="">Type: float<br class="">Total Size: 4278190080 bytes<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;1069547520 values<br class="">Number of Dimensions: 3<br class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space: pre;">        </span>[y | 2048] x [x | 2048] x [z | 255]<br class="">Coordinates:&nbsp;<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;y: [&nbsp;&nbsp;50..204750]<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;x: [&nbsp;&nbsp;50..204750]<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;z: [&nbsp;&nbsp;25..26685.83203]<br class="">Number Of Attributes: 2<br class="">&nbsp;&nbsp;_FillValue :<span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;0<br class="">&nbsp;&nbsp;time :<span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;20</font><br class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class="">Thank you!</div><div class=""><br class=""></div><div class="">Andrea</div></body></html>