[ncl-talk] Plotting Composite radar data -- how to?

Barry Lynn barry.h.lynn at gmail.com
Fri Sep 23 08:16:57 MDT 2022


Hi:

That was very helpful, thank you.  I can now read the data and create
lat/lon coordinates.

I am still left with one error, though, which is quite vexing.*  I need to
give the radar variable coordinate *information so I can map it.  The
typical warning is shown in the last set of yellowed  lines,

The code reads as immediately below, and the error when I try to run it by
adding coordinate variable information is specified in the last of the
second set of yellowed lines, bolded).

CODE!

   filename_b="20120415-080000.netcdf"

   b = addfile(filename_b,"r")

   print(b)

   xs = b->mrefl_mosaic

   xs at _FillValue = toshort(b at MissingData)    ; MissingData is not standard

   xf = short2flt( xs )

   delete(xs)

   printVarSummary(xf)

   printMinMax(xf,False)

   radar = xf(5,:,:)

   printVarSummary(radar)

   lat_center = 40

   lon_center = -110

   lats = lat_center + todouble(ispan(-1000, 1000, 1)/100)

   lons = lon_center + todouble(ispan(-1000, 1000, 1)/100)

  *res              = True*

*  res&lats at units = "degrees_north"   ;  GIVES "compilation" ERROR
(Specified BELOW)*

*  res&lons at units = "degrees_east"*

Here's the compilation error (bolded below).

Variable: radar

Type: float

Total Size: 16016004 bytes

            4004001 values

Number of Dimensions: 2

Dimensions and sizes: [Lat | 2001] x [Lon | 2001]

Coordinates:

Number Of Attributes: 3

  _FillValue : -999

  _FillValue_original : -999

  Units : dBZ

*fatal:(lats) is not a named dimension in variable (res).*

*fatal:["Execute.c":8575]:Execute: Error occurred at or near line 44 in
file ./obs_radar.ncl*

Without this coordinate information, I get:


*fatal:(lats) is not a named dimension in variable (res).*

(0) check_for_y_lat_coord: Warning: Data either does not contain a valid
latitude coordinate array or doesn't contain one at all.

(0) A valid latitude coordinate array should have a 'units' attribute equal
to one of the following values:

(0)     'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'

(0) check_for_lon_coord: Warning: Data either does not contain a valid
longitude coordinate array or doesn't contain one at all.

(0) A valid longitude coordinate array should have a 'units' attribute
equal to one of the following values:


On Fri, Sep 23, 2022 at 12:01 AM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> Oops.  The center grid point is at (1001, 1001), not (1000, 1000).  But
> those offset formulas are correct as shown.
>
>
> On Thu, Sep 22, 2022 at 1:53 PM Dave Allured - NOAA Affiliate <
> dave.allured at noaa.gov> wrote:
>
>> Barry, this file lacks the coordinate variables that are normally
>> provided in most published Netcdf data sets.  However, there appears to be
>> almost enough information in the global attributes to construct grid
>> coordinates.  There are reference latitude and longitude, and the X and Y
>> grid spacing.
>>
>> The reference coordinates are ambiguous.  My guess is they are probably
>> grid center coordinates, but not sure.  With odd numbers for both X and Y
>> dimensions, that suggests that the center grid point (1000, 1000) is right
>> at (40N, 110W).
>>
>> So just calculate X and Y coordinate vectors centered on the reference
>> coordinates, attach them to the data variable, then plot normally.  To
>> minimize precision loss, use *ispan* and divide by 100 as the final
>> step, because 0.01 step size is not exactly representable in floating
>> point.  (Not very important.)  E.g.:
>>
>>       lats  = lat_center  + (double (ispan (-1000, 1000, 1)) / 100)
>>       lons = lon_center + (double (ispan (-1000, 1000, 1)) / 100)
>>
>>
>> On Thu, Sep 22, 2022 at 11:28 AM Barry Lynn via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Hello:
>>>
>>> I am wondering if there is a simple way to plot this radar data
>>> correctly on a grid.
>>>
>>> I can extract the radar data, no problem, but am wondering how to
>>> specify the lat/lon of the data.  Can it be obtained from the radar data
>>> itself?
>>>
>>> Thank you.
>>>
>>> Variable: b
>>>
>>> Type: file
>>>
>>> filename: 20120415-080000
>>>
>>> path: 20120415-080000.netcdf
>>>
>>>    file global attributes:
>>>
>>>       TypeName : mrefl_mosaic
>>>
>>>       DataType : LatLonHeightGrid
>>>
>>>       Time : 1334476800
>>>
>>>       FractionalTime :  0
>>>
>>>       MissingData : -999
>>>
>>>       RangeFolded : -1000
>>>
>>>       Latitude : 40
>>>
>>>       Longitude : -110
>>>
>>>       Height : 500
>>>
>>>       LatGridSpacing : 0.01
>>>
>>>       LonGridSpacing : 0.01
>>>
>>>       attributes :
>>>
>>>    dimensions:
>>>
>>>       Ht = 31
>>>
>>>       Lat = 2001
>>>
>>>       Lon = 2001
>>>
>>>    variables:
>>>
>>>       short mrefl_mosaic ( Ht, Lat, Lon )
>>>
>>>          Units : dBZ
>>>
>>>          Scale : 10
>>>
>>>
>>>       float Height ( Ht )
>>>
>>>          Units : Meters
>>> --
>>> Barry H. Lynn, Ph.D
>>> Senior Scientist, Lecturer,
>>> The Institute of Earth Sciences,
>>> The Hebrew University of Jerusalem,
>>> Givat Ram, Jerusalem 91904, Israel
>>> Tel: 972 547 231 170
>>> Fax: (972)-25662581
>>>
>>> Weather It Is, LTD
>>> Weather and Climate Focus
>>> https://weather-it-is.com <http://weather-it-is.com>
>>> Jerusalem, Israel
>>> Local: 02 930 9525
>>> Cell: 054 7 231 170
>>> Int-IS: x972 2 930 9525
>>>
>>

-- 

Barry H. Lynn, Ph.D
Senior Scientist, Lecturer,
The Institute of Earth Sciences,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

Weather It Is, LTD
Weather and Climate Focus
https://weather-it-is.com <http://weather-it-is.com>
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220923/9257829e/attachment.htm>


More information about the ncl-talk mailing list