Re: create and extract Lat lon variables netcdf data

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Apr 15 2013 - 17:02:36 MDT

Hi Royan,

We suggest new users of NCL look at this page:

and in particular the "Mini Reference Manual":

Meanwhile, if I understand your question, you simply want to open the file, read off the pixel data and the data values, and print them out?

I tried reading your data, but there were some issues with it.

First, a simple "ncdump" on the file indicates a missing value for the "SingleLayerCRefQC" array:

                :MissingData = -99900.f ;

but when I tried to use this, I found values in your variable equal to -99903, which also seems like a missing value.
So, I used -99903 instead of -99900.

Secondly, it's not clear to me how to construct your lat/lon arrays. There is this information on your file:

                :DataType = "SparseLatLonGrid" ;
                :Latitude = 7.874167 ;
                :Longitude = 93.14028 ;
                :LatGridSpacing = 0.005 ;
                :LonGridSpacing = 0.005 ;

But I'm not sure what the "Latitude" and "Longitude" attributes on the file mean.

Also, I see these dimension names:

      Lat = 935
      Lon = 940
      pixel = 70111

Here, I assume that "Lat" and "Lon" indicate the dimensions of a two-dimensional array?

You will have to provide more information about how the lat/lon arrays are supposed to be constructed. Maybe you can use something like:

   lat = a@Latitude + ispan(0,934,1)*a@LatGridSpacing
   lon = a@Longitude + ispan(0,939,1)*a@LonGridSpacing

But again, I don't know how this ties into your pixel locations.

I took a stab at guessing how the lat/lon arrays are supposed to be constructed, and even tried recreating the 2D sparse array to see what a plot looks like.

See attached image and script. You will need to look over the construction of the lat/lon arrays carefully, if the information doesn't look correct. In particular, you will need to fix these lines:

;---Construct lat/lon arrays
  nlat = 935
  nlon = 940
  lat = a@Latitude + ispan(0,nlat-1,1)*a@LatGridSpacing
  lon = a@Longitude + ispan(0,nlon-1,1)*a@LonGridSpacing

Also, I don't know for certain what xpixel and ypixel correspond to, so you may need to fix these lines as well:

  dbz2d = new((/nlat,nlon/),typeof(dbz1d))
  do n=0,npixel-1
    dbz2d(ypixel(n),xpixel(n)) = dbz1d(n)
  end do


On Apr 15, 2013, at 3:28 AM, fatkhuroyan - wrote:

> Hi all,
> Iam newbie in ncl and i have been searching far but i couldn't find !
> could someone help me how to manage and to extract lon lat variable (dbz) so I know that i coud work out manually which pixels correspond to which location and its reflectivity value ? ( I want to make and extract in : Lat-Lon-dbz value).
> Here I attach the files
> Thanks,
> Royan
> <>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Mon Apr 15 17:02:47 2013

This archive was generated by hypermail 2.1.8 : Mon Apr 15 2013 - 20:12:25 MDT