[ncl-talk] Map Reprojection, Spatial Aggregation and Regridding

Scott Capps scapps at atmosdatasolutions.com
Thu Dec 6 19:06:32 MST 2018


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

wgsfile = addfile("./territory_slope_2km_epsg4326.nc","r")
x = wgsfile->lon
y = wgsfile->lat
printVarSummary(x) ; [lon | 385]
printVarSummary(y) ; [lat | 359]
; To reproject to WRF, must relabel as spherical lat/lon (even though the
file is in WGS84 ellipsoid):
SrcProjStr = "+proj=latlong +a=6370 +b=6370 +towgs84=0,0,0 +no_defs"
; LCC WRF using truelats, center_lons, etc..
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"

transform_coordinate(SrcProjStr, DestProjStr, x, y, z)

On Thu, Dec 6, 2018 at 1:53 PM Bill Ladwig <ladwig at ucar.edu> wrote:

> Hi Scott,
>
> See this:
> http://mailman.ucar.edu/pipermail/ncl-talk/2016-October/007059.html
>
> 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.
>
> Hope this helps,
>
> Bill
>
>
> On Wed, Dec 5, 2018 at 1:58 PM Scott Capps <scapps at atmosdatasolutions.com>
> wrote:
>
>>
>> I have created a NetCDF file with data (terrain slope) on the WGS84 4326
>> map projection (ncdump -h output shown below):
>>
>> dimensions:
>> lon = 27382 ;
>> lat = 25569 ;
>> variables:
>> char crs ;
>> crs:grid_mapping_name = "latitude_longitude" ;
>> crs:long_name = "CRS definition" ;
>> crs:longitude_of_prime_meridian = 0. ;
>> crs:semi_major_axis = 6378137. ;
>> crs:inverse_flattening = 298.257223563 ;
>> 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\"]]"
>> ;
>> crs:GeoTransform = "-121.3651264724438 0.0002790528478797247 0
>> 39.07036311976184 0 -0.0002790528478797247 " ;
>> double lat(lat) ;
>> lat:standard_name = "latitude" ;
>> lat:long_name = "latitude" ;
>> lat:units = "degrees_north" ;
>> double lon(lon) ;
>> lon:standard_name = "longitude" ;
>> lon:long_name = "longitude" ;
>> lon:units = "degrees_east" ;
>> float Band1(lat, lon) ;
>> Band1:long_name = "GDAL Band Number 1" ;
>> Band1:_FillValue = -9999.f ;
>> Band1:grid_mapping = "crs" ;
>>
>> // global attributes:
>> :GDAL_AREA_OR_POINT = "Area" ;
>> :Conventions = "CF-1.5" ;
>> :GDAL = "GDAL 2.3.2, released 2018/09/21" ;
>> :history = "Wed Dec 05 11:41:45 2018: GDAL CreateCopy(
>> territory_epsg4326_slope.nc, ... )" ;
>> }
>>
>> And, I would like to calculate the average terrain slope in each grid
>> cell on my coarser WRF domain (2km resolution).
>>
>> Can NCL correctly handle the re-projection from the file above:
>>
>> Geodetic CRS: WGS84
>> Datum: World Geodetic System 1984
>> Ellipsoid: WGS 84
>> Prime Meridian: Greenwich
>>
>> to my WRF Lambert Conformal Conic projection while calculating the
>> average terrain slope in each overlapping, coarser resolution WRF
>> gridcell?
>>
>> Any help or suggestions are appreciated.
>>
>> Thank you,
>>
>> Scott
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>

-- 
*Scott Capps*
Principal
Atmospheric Data Solutions <http://www.atmosphericdatasolutions.com>
scapps at atmosdatasolutions.com
cell: (949) 910-4385
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181206/2de633c8/attachment.html>


More information about the ncl-talk mailing list