[ncl-talk] Map Reprojection, Spatial Aggregation and Regridding
Scott Capps
scapps at atmosdatasolutions.com
Fri Dec 7 12:47:03 MST 2018
Thank you. Yes, I have lat and lon values and could use the ESMF
regridding functions. However, these lat lons are on different map
projections and I wondering if the necessary reprojection is handled using
the ESMF regridding software.
On Fri, Dec 7, 2018 at 9:29 AM Bill Ladwig <ladwig at ucar.edu> wrote:
> Hi Scott,
>
> You know what, I think you already have the lat/lon values for both your
> source and destination grids at each grid point, so you can bypass that map
> projection stuff and go right to the ESMF regridder. There's plenty of
> examples here: https://www.ncl.ucar.edu/Applications/ESMF.shtml. You'll
> be going from a rectilinear grid to a curvilinear grid. This example is
> similar, but you'll want to go in the opposite direction:
> https://www.ncl.ucar.edu/Applications/Scripts/ESMF_all_5.ncl
>
> Hope this helps,
>
> Bill
>
> On Thu, Dec 6, 2018 at 7:06 PM Scott Capps <scapps at atmosdatasolutions.com>
> wrote:
>
>> 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
>>
>>
--
*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/20181207/33e204fb/attachment.html>
More information about the ncl-talk
mailing list