<div dir="ltr"><div>[1] re: &quot;or if there are ways to conserve the mass&quot;<br><br></div><div>Yes, read the ESMF documentation. Use &quot;conserve&quot; method ... not bilinear<br><br>&quot;conserve&quot; - this method will typically have a larger
interpolation error than the previous two methods, but will do a much
better job of preserving the value of the integral of data between the
source and destination grid.
<br></div><div><br>[2] Before proceeding the general rule is that  extrapolation is dangerous: frequently, VERY dangerous&#39;<br><br></div><div>The extrapolation used within int2p_n is simple linear extrapolation. <br><br>The following is trivial example<br><br>Impose a constraint: Let&#39;s say the &#39;val&#39; quantity should be always &gt;= 0.<br><br></div><div>      val(3)   val at level(3)    100<br></div><div>      val(1)   val at level(1)      0<br><br></div><div>      val(2)= (val(1) + val(3))/2   ; toy interploation   val(2) = 50<br><br></div><div>       VAL(1) = 2*val(2)-val(3)    ; here, VAL(1)=val(1)=0<br></div><div>       VAL(0) = 2*val(1)-val(2)    ; extrapolate ......  VAL(0) = -50<br></div><div> <br>==================================================---<br></div><div>[3] <br><br>Did you look at the numbers on your file? Basically all 0s<br>          <br></div><div>[SNIP]<br>    ;######################<br>    ; Read variable<br>    ;######################<br><br>        OH_in   = f-&gt;OH<br><br>printVarSummary(OH_in)                       <br><br></div><div>================&gt;  source variable<br></div><div>Variable: OH_in<br>Type: float<br>Total Size: 45287424 bytes<br>            11321856 values<br>Number of Dimensions: 4<br>Dimensions and sizes:   [time | 12] x [lev | 72] x [lat | 91] x [lon | 144]<br>                                                           ^^^^^^^^<br>Number Of Attributes: 7<br>  add_offset :   0<br>  scale_factor :         1                &lt;=== no scaling<br><br>============<br>printMinMax(OH_in,0)                            ;      &quot;<br>Chemically produced OH (kg/m3) : min=0   max=2.0197e-13  &lt;********<br><br></div><div>****The latter number is numerically 0.0  ... No range!<br>      You are essentially using a constant field ****<br></div><div>=================<br>    ;######################<br>    ; Regrid Horizontally<br>    ;######################<br><br>        OH_mid  = ESMF_regrid_with_weights(OH_in,wgtFileName,Opt)<br>printVarSummary(OH_mid)<br>printMinMax(OH_mid,0)<br><br>---<br>  remap :       remapped via ESMF_regrid_with_weights: Bilinear remapping<br>(0)     Chemically produced OH (kg/m3) : min=0   max=1.45516e-13<br><br></div><div>No negative sign but numerically all 0<br></div><div>----<br>    ;########################<br>    ; Interpolate Vertically<br>    ;########################<br>    ; Linear interpolation, extrapolate near surface  &lt;=========<br>    OH_out               = int2p_n_Wrap(pMid, OH_mid, pOut, -1,1)<br>printVarSummary(OH_out)<br></div><div>printMinMax(OH_out,0)<br></div><div>[SNIP]<br><br>Variable: OH_out<br><br>Number of Dimensions: 4<br>Dimensions and sizes:   [time | 12] x [lev | 40] x [lat | 90] x [lon | 144]<br>                                                          ^^^^^^^^^<br>Coordinates: <br>            time: [ 0..8016]<br>            lat: [ -90..  90]<br>            lon: [-178.75..178.75]<br><br>(0)     Chemically produced OH (kg/m3) : min=-1.18855e-18   max=1.39631e-13<br><br></div><div>That -1.188e-18 is basically a numerical issue ... it is 0<br><br><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 10, 2016 at 8:38 PM, Huanxin(Jessie) Zhang <span dir="ltr">&lt;<a href="mailto:huanxinz@mtu.edu" target="_blank">huanxinz@mtu.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, All<div><br></div><div>I have tried to do some vertical regridding work with NCL function int2p_n_wrap. I am trying to regrid the OH concentration (in kg/m3)  from MERRA 2x2.5 grid (144x91x72) to GISS ModelE F40 (144x90x40). However, I have found some negative values in the regridded grid when I set linlog = -1. The negative values only happen on the first two levels near the surface and the rest of the levels seem to be fine.  I think it is mainly because of the extrapolation near the surface. If I set linlog = 1, there will be some missing values in the first several levels near the surface then. I also tried to regrid other units such as mixing ratio and the same thing happens. I am not sure if it is because that the units can not just be interpolated or if there are ways to conserve the mass? I just started to learn how to use NCL and I couldn&#39;t figure out how to solve this. If anyone has some comments on how to address this, I would really appreciate it! </div><div><div><br></div><div>Attached is the NCL script used and I have uploaded the files needed to run the script to <i style="color:rgb(0,0,0)"><a href="http://ftp.cgd.ucar.edu/incoming" target="_blank">ftp.cgd.ucar.edu/incoming</a>.</i><span style="color:rgb(0,0,0)"> These files are: </span><font color="#000000"><a href="http://OH_3Dglobal.geos5.72L.2x25.hemco.nc" target="_blank">OH_3Dglobal.geos5.72L.2x25.hemco.nc</a>; <a href="http://pressure.MERRA.nc" target="_blank">pressure.MERRA.nc</a>; <a href="http://pressure.GCAP_2000s.F40.nc" target="_blank">pressure.GCAP_2000s.F40.nc</a>. </font></div><div><font color="#000000"><br></font></div><div><font color="#000000">p.s. I am using NCL version 6.3.0 and the system I am on is linux RHEL6.6x86_64.</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Thank you so much for your time!</font></div><span class="HOEnZb"><font color="#888888"><div>Jessie</div></font></span></div><span class="HOEnZb"><font color="#888888">-- <br><div><div dir="ltr">Huanxin (Jessie) Zhang<div>PhD Candidate in Environmental Engineering-Atmospheric Chemistry Modeling</div><div>Dept. of Geological and Mining Engr. &amp; Sciences</div><div>Michigan Technological University</div><div>1400 Townsend Drive, Houghton, MI, 49931</div><div><a href="mailto:huanxinz@mtu.edu" target="_blank">Email: huanxinz@mtu.edu</a></div></div></div>
</font></span></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>