<div dir="ltr">Hi Dennis, <div><br></div><div>Thank you so much for your reply and I really appreciate it!</div><div><br></div><div>[2] so the routine int2n_p itself doesn't have the constraint? if we want to avoid the negatives values, should we manually set some constraints or what is the best way to do it? </div><div><br></div><div>[3]<span style="font-size:12.8px">============</span></div><div style="font-size:12.8px">printMinMax(OH_in,0) ; "<br>Chemically produced OH (kg/m3) : min=0 max=2.0197e-13 <********<br><br></div><div style="font-size:12.8px">****The latter number is numerically 0.0 ... No range!<br> You are essentially using a constant field ****</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">just wondering how do you know the max = 2.0197e-13 is a numerical issue? I am little bit confused. Here It is the OH concentration in kg/m3. I just did a quick conversion, typical OH concentration in the atmosphere is about 10e5 molecules/cm3, to covert it to kg/m3, it is OH_new= (10e5/(6.022e23/17e-3)) * 1e6, then the magnitude of the new concentration in kg/m3 is roughly about 1e-14 kg/m3, therefore, I think the max values is not a numerical issue?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thank you so much for your time!</div><div style="font-size:12.8px">Jessie</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 11, 2016 at 7:05 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>[1] re: "or if there are ways to conserve the mass"<br><br></div><div>Yes, read the ESMF documentation. Use "conserve" method ... not bilinear<br><br>"conserve" - 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'<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's say the 'val' quantity should be always >= 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->OH<br><br>printVarSummary(OH_in) <br><br></div><div>================> 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 <=== no scaling<br><br>============<br>printMinMax(OH_in,0) ; "<br>Chemically produced OH (kg/m3) : min=0 max=2.0197e-13 <********<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 <=========<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"><div><div class="h5">On Tue, May 10, 2016 at 8:38 PM, Huanxin(Jessie) Zhang <span dir="ltr"><<a href="mailto:huanxinz@mtu.edu" target="_blank">huanxinz@mtu.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><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'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><font color="#888888"><div>Jessie</div></font></span></div><span><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. & 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></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Huanxin (Jessie) Zhang<div>PhD Candidate in Environmental Engineering-Atmospheric Chemistry Modeling</div><div>Dept. of Geological and Mining Engr. & 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>
</div>