[ncl-talk] regridding with int2p_n_Wrap

Dennis Shea shea at ucar.edu
Wed May 11 17:05:29 MDT 2016


[1] re: "or if there are ways to conserve the mass"

Yes, read the ESMF documentation. Use "conserve" method ... not bilinear

"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.

[2] Before proceeding the general rule is that  extrapolation is dangerous:
frequently, VERY dangerous'

The extrapolation used within int2p_n is simple linear extrapolation.

The following is trivial example

Impose a constraint: Let's say the 'val' quantity should be always >= 0.

      val(3)   val at level(3)    100
      val(1)   val at level(1)      0

      val(2)= (val(1) + val(3))/2   ; toy interploation   val(2) = 50

       VAL(1) = 2*val(2)-val(3)    ; here, VAL(1)=val(1)=0
       VAL(0) = 2*val(1)-val(2)    ; extrapolate ......  VAL(0) = -50

==================================================---
[3]

Did you look at the numbers on your file? Basically all 0s

[SNIP]
    ;######################
    ; Read variable
    ;######################

        OH_in   = f->OH

printVarSummary(OH_in)

================>  source variable
Variable: OH_in
Type: float
Total Size: 45287424 bytes
            11321856 values
Number of Dimensions: 4
Dimensions and sizes:   [time | 12] x [lev | 72] x [lat | 91] x [lon | 144]
                                                           ^^^^^^^^
Number Of Attributes: 7
  add_offset :   0
  scale_factor :         1                <=== no scaling

============
printMinMax(OH_in,0)                            ;      "
Chemically produced OH (kg/m3) : min=0   max=2.0197e-13  <********

****The latter number is numerically 0.0  ... No range!
      You are essentially using a constant field ****
=================
    ;######################
    ; Regrid Horizontally
    ;######################

        OH_mid  = ESMF_regrid_with_weights(OH_in,wgtFileName,Opt)
printVarSummary(OH_mid)
printMinMax(OH_mid,0)

---
  remap :       remapped via ESMF_regrid_with_weights: Bilinear remapping
(0)     Chemically produced OH (kg/m3) : min=0   max=1.45516e-13

No negative sign but numerically all 0
----
    ;########################
    ; Interpolate Vertically
    ;########################
    ; Linear interpolation, extrapolate near surface  <=========
    OH_out               = int2p_n_Wrap(pMid, OH_mid, pOut, -1,1)
printVarSummary(OH_out)
printMinMax(OH_out,0)
[SNIP]

Variable: OH_out

Number of Dimensions: 4
Dimensions and sizes:   [time | 12] x [lev | 40] x [lat | 90] x [lon | 144]
                                                          ^^^^^^^^^
Coordinates:
            time: [ 0..8016]
            lat: [ -90..  90]
            lon: [-178.75..178.75]

(0)     Chemically produced OH (kg/m3) : min=-1.18855e-18   max=1.39631e-13

That -1.188e-18 is basically a numerical issue ... it is 0




On Tue, May 10, 2016 at 8:38 PM, Huanxin(Jessie) Zhang <huanxinz at mtu.edu>
wrote:

> Hi, All
>
> 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!
>
> Attached is the NCL script used and I have uploaded the files needed to
> run the script to *ftp.cgd.ucar.edu/incoming
> <http://ftp.cgd.ucar.edu/incoming>.* These files are:
> OH_3Dglobal.geos5.72L.2x25.hemco.nc; pressure.MERRA.nc;
> pressure.GCAP_2000s.F40.nc.
>
> p.s. I am using NCL version 6.3.0 and the system I am on is linux
> RHEL6.6x86_64.
>
> Thank you so much for your time!
> Jessie
> --
> Huanxin (Jessie) Zhang
> PhD Candidate in Environmental Engineering-Atmospheric Chemistry Modeling
> Dept. of Geological and Mining Engr. & Sciences
> Michigan Technological University
> 1400 Townsend Drive, Houghton, MI, 49931
> Email: huanxinz at mtu.edu <huanxinz at mtu.edu>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160511/a3094f44/attachment.html 


More information about the ncl-talk mailing list