[ncl-talk] MODIS variable not plotting

Mary Haley haley at ucar.edu
Sun May 7 08:37:39 MDT 2017


Hi Nisha,

To add to what Adam said, you might need to "unpack" the data before you
can plot it.

There are two pages you should visit:

http://www.ncl.ucar.edu/Applications/HDF.shtml
http://www.ncl.ucar.edu/Applications/plot_data_on_map.shtml

On the HDF page, use your browser search to search for the word "modis".
You'll see a few examples that read MODIS files.

One of the examples makes use of attributes "Slope" and "Intercept" to
properly scale the variable before you plot it. For example:

   f      = addfile (diri+fili, "r")
   L3M    = f->l3m_data
   L3M at _FillValue = integertoshort( -1 )

   l3m    = new ( dimsizes(L3M), "integer", -1)
   l3m    = L3M
   l3m    = where(l3m.lt.0, (65535+l3m)   , l3m)

   X      = (l3m*f at Slope) + f at Intercept

Another one uses scale_factor and add_offset:

;*************************************************************
; Read in cloud temperature
;*************************************************************
  wv1s = f->Cloud_Top_Temperature
  wv2s = g->Cloud_Top_Temperature
  wv3s = h->Cloud_Top_Temperature
  wv4s = j->Cloud_Top_Temperature

; Apply scale and offset and convert to double
  wv1 =  wv1s at scale_factor*1.d * (wv1s - wv1s at add_offset)
  wv2 =  wv2s at scale_factor*1.d * (wv2s - wv2s at add_offset)
  wv3 =  wv3s at scale_factor*1.d * (wv3s - wv3s at add_offset)
  wv4 =  wv4s at scale_factor*1.d * (wv4s - wv4s at add_offset)

In the "plotting data on a map" page, this explains in general terms what
might be wrong if you are trying to plot data over a map and nothing is
showing up. It mentions "unpacking" as well.

--Mary


On Fri, May 5, 2017 at 1:32 PM, Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Nisha,
> Are you getting any error messages? If not, it would help to see your
> script. Also, it might be helpful to run the data array that you are
> plotting through stat_dispersion so that you are aware of what your data
> (in a general sense) looks like:
> https://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.
> shtml
> As always, please respond to the ncl-talk email list with any followup
> correspondance..
> Adam
>
>
> On Fri, May 5, 2017 at 12:39 PM, Manisha Ganeshan <
> manisha.ganeshan86 at gmail.com> wrote:
>
>> Hello,
>>
>> I'm trying to plot cloud fraction by reading from a MODIS hdf file. I am
>> able to view contour plots of lat and lon, but not cloud fraction. I've
>> tried converting it from byte to float/double. I only see a blank viewport
>> without any contours. Any suggestions?
>>
>> Thanks,
>> Nisha
>>
>> --
>> 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
>>
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726 <(303)%20497-1726>
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
> _______________________________________________
> 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/20170507/4e0b68dc/attachment.html 


More information about the ncl-talk mailing list