[ncl-talk] Reading binary files

Mary Haley haley at ucar.edu
Sun Jul 16 22:46:23 MDT 2017


Manisha,

If you don't have the lat/lon information, then one way you plot it in NCL
is to provide the exact map parameters, and then make sure you set:

res at tfDoNDCOverlay = True

which tells NCL not to try to transform the plot using map projection
equations, because the transformation has already been done.

You may also need to set:

res at gsnAddCyclic = False

so NCL doesn't try to add a longitude cyclic point.

There's an example on our "native grid" example page. See "native_1.ncl" at:

http://www.ncl.ucar.edu/Applications/native.shtml#ex1


Note the script has the following resources set, which defines the
projection that the data was calculated on:

; The following resources are Required to plot this projection correctly

 res at mpProjection                = "Stereographic"     ; projection

 res at mpLimitMode                 = "Corners"           ; method to zoom
 res at mpLeftCornerLatF            = lat(0,0)
 res at mpLeftCornerLonF            = lon(0,0)
 res at mpRightCornerLatF           = lat(nlat-1,nlon-1)
 res at mpRightCornerLonF           = lon(nlat-1,nlon-1)

 res at mpRelativeCenterLon         = True                 ; set a center lon
 res at mpCenterLonF                = lon((nlat/2)+1,(nlon/2)+1)  ; center lon
 res at mpRelativeCenterLat         = True        ; set a center lat
 res at mpCenterLatF                = 90.                  ; center lat
 res at tfDoNDCOverlay              = True                 ; do not transform
data

Hopefully you have this information for your own projection and can do
something similar. Note that you will need to provide the lat/lon corners
yourself. This particular example actually had the 2D lat/lon data, and
just used the end points to set the corners.

--Mary



On Thu, Jul 13, 2017 at 3:56 PM, Manisha Ganeshan <
manisha.ganeshan86 at gmail.com> wrote:

> Thanks, Dennis! I'm trying to geo reference the data to plot it on a polar
> stereographic map projection. But I only have information regarding the map
> projection and grid spacing in km (below). Can NCL perform coordinate
> transformation to estimate lat lon variables from the given information? I
> think the data is intended for use with ArcGIS and similar software so they
> don't come with lat lon coordinates.
>
> Thanks,
> Nisha
> Projection
> World Geodetic System 1984 (WGS 84) is the reference ellipsoid and datum.
> The projection is polar stereographic with a standard parallel of 71° S and
> origin of the South Pole.
>
> Grid Description
>
> The grid is a 1 km grid of 5601 by 5601 grid boxes centered symmetrically
> about the pole. Grid size of 1 km is an optimization of resolution and
> interpolated cells, resulting in less than 32 percent of grid cells having
> interpolated values.
>
> On Sun, Jul 9, 2017 at 9:18 AM, Dennis Shea <shea at ucar.edu> wrote:
>
>> The attached does a simple read-and-plot. The plot does not have any
>> geographic referencing.
>>
>> On Sat, Jul 8, 2017 at 9:01 PM, Manisha Ganeshan <
>> manisha.ganeshan86 at gmail.com> wrote:
>>
>>> Hi Barry,
>>>
>>> I found some info on ENVI header files, and was able to figure out the
>>> data format, dimensions, and read the data successfully. Still trying to
>>> figure out the map and projection details, but I think that will be easier
>>> to do. Will let you know if I have further trouble.
>>>
>>> Thanks,
>>> Nisha
>>>
>>> On Sat, Jul 8, 2017 at 9:49 PM, Manisha Ganeshan <
>>> manisha.ganeshan86 at gmail.com> wrote:
>>>
>>>> Dear NCL community,
>>>>
>>>> I'm trying to read a binary file without much success. I have tried
>>>> asciiread and fbindirread functions, but the problem is I'm not sure what
>>>> to enter in the data type field. There is not much information in the
>>>> header file nor in the data description (web link below). The variable I am
>>>> expecting to read is surface elevation (likely in meters), but no matter
>>>> what data format I attempt to read, I don't seem to get reasonable values.
>>>> Any leads on how to proceed will be much appreciated. The actual binary
>>>> data file and the header file are available for download from the weblink
>>>> below.
>>>>
>>>> Thanks,
>>>> Nisha
>>>>
>>>> Weblink describing the data
>>>> *http://nsidc.org/data/nsidc-0422 <http://nsidc.org/data/nsidc-0422>*
>>>>
>>>>
>>>> Download link for binary file and header file
>>>> *https://opendrive.gsfc.nasa.gov/shortauth/z/b3zIg8ah
>>>> <https://opendrive.gsfc.nasa.gov/shortauth/z/b3zIg8ah>*
>>>> --
>>>> Dr. Manisha Ganeshan
>>>> Universities Space Research Association
>>>> Maryland, U.S.A.
>>>>
>>>
>>>
>>>
>>> --
>>> Dr. Manisha Ganeshan
>>> Universities Space Research Association
>>> Maryland, U.S.A.
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
>
> --
> Dr. Manisha Ganeshan
> Universities Space Research Association
> Maryland, U.S.A.
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170716/2bea3e17/attachment.html 


More information about the ncl-talk mailing list