Re: Interpolation error using the linint2 of NCL

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 15 2012 - 07:57:23 MDT

When you did psfc = f->psfc(::-1)
the data array and the latitude coordinates associated with the psfc
variable were
properly reversed. The following works.

======
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

   fP = addfile("gfs.t00z.pgrb2f00.nc","r")
   psfc = fP->PRES_P0_L1_GLL0(::-1,:)
   printVarSummary(psfc)
   print("psfc: min="+min(psfc)+" max="+max(psfc))

   fC = addfile("./cami_1980-01-01_0.47x0.63_L26_c071226_org.nc", "r")
   LON = fC->lon
   LAT = fC->lat

   PSFC = linint2_Wrap(psfc&lon_0,psfc&lat_0,psfc,True,LON,LAT,0)
   printVarSummary (PSFC)
   print("PSFC: min="+min(PSFC)+" max="+max(PSFC))

On 6/15/12 2:43 AM, ±èÀοø wrote:
> Hello Dennis
>
> I'm In-Won
>
> I modified code like this.
>
> when I print the lat, these are 90. 89.5.......-89.5 -90.
>
> As you said, xi,yi,xo,yo have to increase.
>
> I really thank you for your help.
>
> And I have one more question
>
> *Before I asked pres2hybrid and I transfer the gfs.t00z.pgrb2f00.nc
> <http://gfs.t00z.pgrb2f00.nc/>, gfs_sfc_pressure.nc
> <http://gfs_sfc_pressure.nc/>,
> cami_1980-01-01_0.47x0.63_L26_c071226_org.nc
> <http://cami_1980-01-01_0.47x0.63_l26_c071226_org.nc/>*
>
> Did you checked these?
>
> I'll wait to your reply.
>
> Regards
> *
> *
> *Detailed code*
> =======================================
> begin
>
> fP = addfile("./gfs.t00z.pgrb2f00.nc <http://gfs.t00z.pgrb2f00.nc>","r")
>
> *psfc = fP->PRES_P0_L1_GLL0(::-1,:)*
> lon = fP->lon_0
> *lat = fP->lat_0*-1.*
> psfc@_FillValue=-999.
>
> fC = addfile("./cami_1980-01-01_0.47x0.63_L26_c071226_org.nc
> <http://cami_1980-01-01_0.47x0.63_L26_c071226_org.nc>","r")
> LON = fC->lon
> LAT = fC->lat
>
> fo=linint2(lon,lat,psfc,False,LON,LAT,0)
>
> ; printVarSummary (fo)
> ; printVarSummary (psfc)
> print (fo)
>
> end
>
>
>
> 2012/6/15 ±èÀοø <rladlsdnjs88@gmail.com <mailto:rladlsdnjs88@gmail.com>>
>
> Hello
>
> I tried to interpolate using linear interpolation (the linint2) but,
> failed.
> There appears warning.
>
> warning: linint2: xi, yi, xo, and yo must be monotonically increasing.
>
> However, I checked xi,yi,xo,yo through the print, they are
> monotonically increasing
>
> When I print the output(fo), value is -999.
>
> How do i modify code to interpolate?
>
> *(xi, yi)*
> =======================================================
> Variable: psfc
> Type: float
> Total Size: 1039680 bytes
> 259920 values
> Number of Dimensions: 2
> *Dimensions and sizes: [lat_0 | 361] x [lon_0 | 720]*
> Coordinates:
> lat_0: [90..-90]
> lon_0: [ 0..359.5]
> Number Of Attributes: 12
> initial_time : 06/06/2011 (00:00)
> forecast_time : 0
> level : 0
> level_type : Mean sea level (Pa)
> parameter_template_discipline_category_number : ( 0, 0, 3, 1 )
> parameter_discipline_and_category : Meteorological products, Mass
> grid_type : Latitude/longitude
> _FillValue : -999
> units : Pa
> long_name : Pressure reduced to MSL
> production_status : Operational products
> center : US National Weather Service - NCEP (WMC)
>
> *(xo,yo)*
> =========================================================
> Variable: fo
> Type: float
> Total Size: 884736 bytes
> 221184 values
> Number of Dimensions: 2
> *Dimensions and sizes: [384] x [576]*
> Coordinates:
> Number Of Attributes: 1
> _FillValue : -999
> =========================================================
>
>
> *Detailed code*
> =========================================================
> begin
>
> fP = addfile("./gfs.t00z.pgrb2f00.nc <http://gfs.t00z.pgrb2f00.nc>","r")
>
> psfc = fP->PRMSL_P0_L101_GLL0
> lon = fP->lon_0
> lat = fP->lat_0
> psfc@_FillValue=-999.
>
> fC = addfile("./cami_1980-01-01_0.47x0.63_L26_c071226_org.nc
> <http://cami_1980-01-01_0.47x0.63_L26_c071226_org.nc>","r")
> LON = fC->lon
> LAT = fC->lat
>
> fo=linint2(lon,lat,psfc,False,LON,LAT,0)
>
> print (fo)
>
> end
>
>
> --
> --
> In-Won Kim
> Intergrated Climate System Modeling Lab.
> Department of Environmental Atmospheric Sciences
> 599-1 Daeyeon-dong, Nam-gu
> Pukyong National University,
> Busan, S.Korea
>
> Tel. +82-51-629-6643
> Fax +82-51-629-7991
>
>
>
>
> --
> --
> In-Won Kim
> Intergrated Climate System Modeling Lab.
> Department of Environmental Atmospheric Sciences
> 599-1 Daeyeon-dong, Nam-gu
> Pukyong National University,
> Busan, S.Korea
>
> Tel. +82-51-629-6643
> Fax +82-51-629-7991
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 15 07:57:36 2012

This archive was generated by hypermail 2.1.8 : Fri Jun 15 2012 - 14:51:31 MDT