<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>It is hard to follow a code with many randomly commented lines. My  guess:</div><div><br></div><div>You have: <br></div><div>  b1 = addfile(ncar_rea,"r")<br>  lat  = b1->lat                    ;;---Change (likely)<br>  lon  = b1->lon                   ;;---Change (likely)  <b><=== *** ORIGINAL: 0 -> 357.5   [??]</b></div><div><br>...</div><div><br></div><div>  nc  = b1->air              ; FYI when reading an entire array, it is more efficient to *not* use(:,:,:)<br></div><div>  nc = nc - 273.15<br>  nc  = lonFlip(nc)   ; change longitude (0;360) -> <b>(-180;180)</b></div><div><br></div><div><b>At this point, the 'lon' variable should be replaced with the new 'flipped' longitude values</b><br></div><div>  lon = nc&lon                   ; extract the reordered lon<br></div><div><br></div><div>Without inputting the 'new'  (-180 - 180) longitudes, the function would use the original 0-360 longitudes.</div><div><br></div><div>nc_regrid = rgrid2rcm_Wrap(lat,<b> lon,</b> nc_avg_subset, dst_lat, dst_lon, 0)</div><div><br></div><div>Assuming the '<b>dst_lon</b>' are negative, the function is, in a sense,  telling you there are no 'nearby' points.</div><div><br></div><div><br></div><div><br></div><div>-----------------------</div><div>Minor comments</div><div>------------------------<br></div><div>I have no idea what version of NCL you are using but generally, NCL does not require that many of the  libraries be loaded.<br></div><div><br></div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"   ; <=== still needed</div><div><br></div><div>;;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"                  <=== the following can be eliminated<br>;;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<br>;;load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"<br>;;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br><br><br>begin   ; optional; can be eliminated for main script<br></div><div> ...<br></div><div>end      ; if 'begin' is eliminated then the corresponding 'end' must be removed<br></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 8, 2019 at 10:30 AM Mauro Morichetti <<a href="mailto:s1073755@pm.univpm.it">s1073755@pm.univpm.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>
<div style="overflow-wrap: break-word;">
<div dir="auto" style="overflow-wrap: break-word;">
<div dir="auto" style="overflow-wrap: break-word;">
<div dir="auto" style="overflow-wrap: break-word;">
Hi all,
<div><br>
</div>
<div>I would like use the function “rgrid2rcm_Wrap” to regrid a monthly NCAR/NCEP reanalysis temperature in a WRF grid.</div>
<div><br>
</div>
<div>The problem I have this error:</div>
<div><br>
</div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>check_for_y_lat_coord: Warning: Data either does not contain</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>a valid latitude coordinate array or doesn't contain one at all.</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>A valid latitude coordinate array should have a 'units'</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>attribute equal to one of the following values: </span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>    'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>check_for_lon_coord: Warning: Data either does not contain</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>a valid longitude coordinate array or doesn't contain one at all.</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>A valid longitude coordinate array should have a 'units'</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>attribute equal to one of the following values: </span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>    'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">warning:ContourPlotInitialize: no valid values in scalar field; ContourPlot not possible:[errno=1101]</span></div>
<div><br>
</div>
<div>I know it is an error referred to the coordinates units, but I can not solve, because I think it is a coordinate problem (I mean the coordinates are not well declared). </div>
<div><br>
</div>
<div>This is the variable to plot:</div>
<div><br>
</div>
<div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">Variable: nc_regrid</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">Type: float</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">Total Size: 6774768 bytes</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">            1693692 values</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">Number of Dimensions: 3</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">Dimensions and sizes:<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>[Time | 12] x [south_north | 329] x [west_east | 429]</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">Coordinates: </span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">            Time: [1902192..1910208]</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">Number Of Attributes: 25</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  long_name :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>WRFChem</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  FieldType :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>104</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  MemoryOrder :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>XY </span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  description :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>TEMP at 2 M</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  units :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>[degC]</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  stagger :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span></span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  coordinates :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>XLONG XLAT XTIME</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  Time :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>  0</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  NCL_tag :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>calculate_monthly_values: arith=avg</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  _FillValue :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>9.96921e+36</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  time :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>1902192</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  precision :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>2</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  least_significant_digit :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>1</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  GRIB_id :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>11</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  GRIB_name :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>TMP</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  var_desc :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>Air temperature</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  dataset :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>NCEP Reanalysis Daily Averages</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  level_desc :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>2 m</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  statistic :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>Mean</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  parent_stat :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>Individual Obs</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  valid_range :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>( 150, 400 )</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  actual_range :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>( 177.35, 317.15 )</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  lonFlip :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>longitude coordinate variable has been reordered via lonFlip</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  missing_value :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>-9.96921e+36</span></div>
<div style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:Courier;background-color:rgb(215,211,183)">
<span style="font-variant-ligatures:no-common-ligatures">  ncl :<span class="gmail-m_2046250784692130588x_Apple-tab-span" style="white-space:pre-wrap">
</span>rgrid2rcm used for interpolation</span></div>
</div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">and attached the script.</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">Could someone help me thanks</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div>Regards,</div>
<div>
<div><br class="gmail-m_2046250784692130588x_webkit-block-placeholder">
</div>
<div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
---------</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br>
</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
Eng. Mauro Morichetti</div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
Department of Industrial Engineering and Mathematical Science<br>
Marche Polytechnic University, Ancona, Italy<br>
<a href="mailto:m.morichetti@pm.univpm.it" target="_blank">m.morichetti@pm.univpm.it</a></div>
</div>
</div>
<br>
</div>
<div></div>
</div>
</div>
</div>
</div>
<div style="overflow-wrap: break-word;">
<div dir="auto" style="overflow-wrap: break-word;">
<div dir="auto" style="overflow-wrap: break-word;">
<div dir="auto" style="overflow-wrap: break-word;">
<div></div>
</div>
</div>
</div>
</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>
</blockquote></div>