<div dir="ltr"><div></div><div>Dear everyone,</div><div><br></div><div>It&#39;s my first time to send the email. I am trying to describe the problem briefly as possible.</div><div><br></div><div>Version:  NCL 6.3.0</div><div><br></div><div>System: Ubuntu</div><div><br></div><div>No errors.</div><div><br></div><div>Warning: dpres_plevel: At one or more grid points the sum of the layer thicknesses is not equal to (psfc-ptop). Are units of plev, psfc and ptop matching?</div><div><br></div><div>Problems: I tried to calculate the pressure layer thickness &quot;dp&quot;, using the function &quot;dpres_plevel&quot;. The input file is &quot;<a href="http://ps_qv.nc">ps_qv.nc</a>&quot;, which includes two variables, ps (surface pressure) and qv(specific humidity). I exported the result to a file named &quot;<a href="http://dp.nc">dp.nc</a>&quot;. A warning displayed as the above. I checked all of the units. It is &quot;Pa&quot;. I visualized &quot;<a href="http://dp.nc">dp.nc</a>&quot;, using ncview and found dp is about 3000 Pa on Tibet Plateau on the level of 1000 hPa where the surface pressure is about 550 hPa. There should be no value on Tibet Plateau where the surface pressure is much below 1000 hPa. In addition, there exists extreme value about 30000 pa on the top level of 700 hPa on the boundary of Tibet Plateau. The value is too big for dp. Below is my script:</div><div>--------------------------------</div><div><div>begin</div><div>   diri = &quot;./&quot;</div><div>   fili = &quot;<a href="http://ps_qv.nc">ps_qv.nc</a>&quot;</div><div>   fi   = addfile(diri+fili, &quot;r&quot;)</div><div><br></div><div>   q  = fi-&gt;qv(0,0:12,:,:) ; (levels, latitude, longitude), it will provide coordinate information for dp</div><div>     </div><div>   psfc  = fi-&gt;ps(0,:,:)   ; (lat,lon), the unit of the variable &quot;ps&quot; in the input file is Pa</div><div>   psfc@units = &quot;Pa&quot;</div><div>   printVarSummary(psfc)</div><div>   printMinMax(psfc, 0)</div><div>   </div><div>   ;isobaric levels </div><div>    plev = fi-&gt;levels(0:12) ;from 1000 to 700 hPa</div><div><span style="white-space:pre">    </span>plev = plev*100. ;the unit of plev is hPa, convert it to Pa by *100</div><div>    plev@units = &quot;Pa&quot;</div><div>    printVarSummary(plev)</div><div>    printMinMax(plev, 0)</div><div><br></div><div>    ptop= 70000         </div><div><span style="white-space:pre">    </span>ptop@units = &quot;Pa&quot;</div><div>     </div><div>    dp  = dpres_plevel(plev, psfc, ptop, 0) ; the key function</div><div><span class="" style="white-space:pre">        </span></div><div><span style="white-space:pre">    </span>copy_VarCoords(q, dp)</div><div>    printVarSummary(dp)</div><div>    printMinMax(dp, 0)</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>;output dp to a netCDF file</div><div><span class="" style="white-space:pre">        </span>system(&quot;/bin/rm -f <a href="http://dp.nc">dp.nc</a>&quot;)   ; remove any pre-existing file</div><div><span class="" style="white-space:pre">        </span>ncdf = addfile(&quot;<a href="http://dp.nc">dp.nc</a>&quot; ,&quot;c&quot;)  ; open output netCDF file</div><div><span class="" style="white-space:pre">        </span>fAtt               = True            ; assign file attributes</div><div><span class="" style="white-space:pre">        </span>fAtt@title         = &quot;NCL Simple Approach to netCDF Creation&quot;</div><div><span class="" style="white-space:pre">        </span>fAtt@source_file   =  &quot;<a href="http://original-file.nc">original-file.nc</a>&quot;</div><div><span class="" style="white-space:pre">        </span>fAtt@Conventions   = &quot;None&quot;</div><div><span class="" style="white-space:pre">        </span>fAtt@creation_date = systemfunc (&quot;date&quot;)</div><div><span class="" style="white-space:pre">        </span>fileattdef( ncdf, fAtt )            ; copy file attributes</div><div><span class="" style="white-space:pre">        </span>filedimdef(ncdf,&quot;time&quot;,-1,True)</div><div><span class="" style="white-space:pre">        </span>ncdf-&gt;dp  = dp                      </div><div>end</div></div><div>-----------------------------------</div><div><br></div><div>I couldn&#39;t find the source code of the function &quot;dpres_pleve&quot; and had no idea where the errors are.</div><div><br></div><div>I am looking forwards to your help.</div><div><br></div><div>Additions: I set the surface pressure to a constant, 101800 Pa. The result makes sense. I am wondering if the function is wrong when the surface pressure is a 2-D or 3-D array.</div><div><br></div><div>Bilbo Qiu</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div><br></div></div></div>