<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Thank you.  I have looked at that function and I don't think it will work.  It would need to accept as input the 1D lat (y) and lon (x) variables and output two lat2d and lon2d variables.  Not sure what the "z" input is (I was not able to find the source code for this function).  <div><br></div><div><div>wgsfile = addfile("./<a href="http://territory_slope_2km_epsg4326.nc">territory_slope_2km_epsg4326.nc</a>","r")</div><div>x = wgsfile->lon</div><div>y = wgsfile->lat</div><div>printVarSummary(x) ; [lon | 385]</div><div>printVarSummary(y) ; [lat | 359]</div><div>; To reproject to WRF, must relabel as spherical lat/lon (even though the file is in WGS84 ellipsoid):</div><div>SrcProjStr = "+proj=latlong +a=6370 +b=6370 +towgs84=0,0,0 +no_defs"</div><div>; LCC WRF using truelats, center_lons, etc..</div><div>DestProjStr = "+proj=lcc +lat_1=30.0 +lat_2=41.0 +lat_0=35.80001 +lon_0=-120.095 +a=6370 +b=6370 +towgs84=0,0,0 +no_defs"</div><div><br></div><div>transform_coordinate(SrcProjStr, DestProjStr, x, y, z)</div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Dec 6, 2018 at 1:53 PM Bill Ladwig <<a href="mailto:ladwig@ucar.edu">ladwig@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Scott,<div><br></div><div>See this: <a href="http://mailman.ucar.edu/pipermail/ncl-talk/2016-October/007059.html" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/2016-October/007059.html</a></div><div><br></div><div>Remember when setting up the Proj4 Lambert Conformal string for WRF to use a sphere with a radius of 6370000. I believe that function will give you fractional x,y values, which you'll need to do some kind of interpolation (or nearest neighbor if that's good enough) to do your computation.</div><div><br></div><div>Hope this helps,</div><div><br></div><div>Bill</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 5, 2018 at 1:58 PM Scott Capps <<a href="mailto:scapps@atmosdatasolutions.com" target="_blank">scapps@atmosdatasolutions.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div>I have created a NetCDF file with data (terrain slope) on the WGS84 4326 map projection (ncdump -h output shown below):</div><div dir="ltr"><br clear="all"><div><div>dimensions:</div><div><span style="white-space:pre-wrap">  </span>lon = 27382 ;</div><div><span style="white-space:pre-wrap">    </span>lat = 25569 ;</div><div>variables:</div><div><span style="white-space:pre-wrap">   </span>char crs ;</div><div><span style="white-space:pre-wrap">               </span>crs:grid_mapping_name = "latitude_longitude" ;</div><div><span style="white-space:pre-wrap">         </span>crs:long_name = "CRS definition" ;</div><div><span style="white-space:pre-wrap">             </span>crs:longitude_of_prime_meridian = 0. ;</div><div><span style="white-space:pre-wrap">           </span>crs:semi_major_axis = 6378137. ;</div><div><span style="white-space:pre-wrap">         </span>crs:inverse_flattening = 298.257223563 ;</div><div><span style="white-space:pre-wrap">         </span>crs:spatial_ref = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]" ;</div><div><span style="white-space:pre-wrap">               </span>crs:GeoTransform = "-121.3651264724438 0.0002790528478797247 0 39.07036311976184 0 -0.0002790528478797247 " ;</div><div><span style="white-space:pre-wrap">  </span>double lat(lat) ;</div><div><span style="white-space:pre-wrap">                </span>lat:standard_name = "latitude" ;</div><div><span style="white-space:pre-wrap">               </span>lat:long_name = "latitude" ;</div><div><span style="white-space:pre-wrap">           </span>lat:units = "degrees_north" ;</div><div><span style="white-space:pre-wrap">  </span>double lon(lon) ;</div><div><span style="white-space:pre-wrap">                </span>lon:standard_name = "longitude" ;</div><div><span style="white-space:pre-wrap">              </span>lon:long_name = "longitude" ;</div><div><span style="white-space:pre-wrap">          </span>lon:units = "degrees_east" ;</div><div><span style="white-space:pre-wrap">   </span>float Band1(lat, lon) ;</div><div><span style="white-space:pre-wrap">          </span>Band1:long_name = "GDAL Band Number 1" ;</div><div><span style="white-space:pre-wrap">               </span>Band1:_FillValue = -9999.f ;</div><div><span style="white-space:pre-wrap">             </span>Band1:grid_mapping = "crs" ;</div><div><br></div><div>// global attributes:</div><div><span style="white-space:pre-wrap">              </span>:GDAL_AREA_OR_POINT = "Area" ;</div><div><span style="white-space:pre-wrap">         </span>:Conventions = "CF-1.5" ;</div><div><span style="white-space:pre-wrap">              </span>:GDAL = "GDAL 2.3.2, released 2018/09/21" ;</div><div><span style="white-space:pre-wrap">            </span>:history = "Wed Dec 05 11:41:45 2018: GDAL CreateCopy( <a href="http://territory_epsg4326_slope.nc" target="_blank">territory_epsg4326_slope.nc</a>, ... )" ;</div><div>}</div></div><div><br></div><div>And, I would like to calculate the average terrain slope in each grid cell on my coarser WRF domain (2km resolution).  </div><div><br></div><div>Can NCL correctly handle the re-projection from the file above:</div><div><br></div><div><div>Geodetic CRS: WGS84</div><div>Datum: World Geodetic System 1984</div><div>Ellipsoid: WGS 84</div><div>Prime Meridian: Greenwich</div></div><div><br></div><div>to my WRF Lambert Conformal Conic projection while calculating the average terrain slope in each overlapping, coarser resolution WRF gridcell?  </div><div><br></div><div>Any help or suggestions are appreciated.</div><div><br></div><div>Thank you,</div><div><br></div><div>Scott</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>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><b><font size="4">Scott Capps</font></b><div>Principal</div><div><a href="http://www.atmosphericdatasolutions.com" target="_blank">Atmospheric Data Solutions</a></div><div><a href="mailto:scapps@atmosdatasolutions.com" target="_blank">scapps@atmosdatasolutions.com</a><div>cell: (949) 910-4385</div><div><br></div></div></div></div></div></div>