[ncl-talk] hdf confusion

Marston Johnston shejo284 at gmail.com
Tue Jun 13 14:54:46 MDT 2017


Hi,

It would be good to know how the mask is stored, i.e., whether as bit information in which case you need to do bitwise shift to see if the flag is set or not.

Without knowing how the information is stored, it is hard to help. I made the assumption that the mask is stored as a ushort which was scaled and stored for compression.

But that assumption might not be true. I don’t know how MODIS stored the information. Can you read up on it to ensure the ushort variable has a scale and offset attribute?

/M

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Marston S. Johnston, PhD

Department of Earth Sciences

University of Gothenburg, Sweden

Email: marston.johnston at gu.se

SkypeID: marston.johnston 

Phone: +46-31-7864901 

Only the fruitful thing is true!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

 

From: Michael Notaro <mnotaro at wisc.edu>
Date: Tuesday, 13 June 2017 at 22:46
To: Marston Johnston <shejo284 at gmail.com>, "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] hdf confusion

 

Thanks.  I tried the following and only end up with a 2d grid of values like 2066, 18709, etc.

How can I retrieve slot [11-13] land/water flag with values like 000, 001, 010, etc?

Michael

 

aa=addfile("h10v04_yellowstone/MOD13Q1.A2012001.h10v04.006.2015236172021.hdf.hdfeos","r")

lat2d=doubletofloat(aa->GridLat_MODIS_Grid_16DAY_250m_500m_VI(::-1,:))

lon2d=doubletofloat(aa->GridLon_MODIS_Grid_16DAY_250m_500m_VI(::-1,:))

lat2d!0="nlat"

lat2d!1="nlon"

lon2d!0="nlat"

lon2d!1="nlon"

land=short2flt_hdf(aa->250m_16_days_VI_Quality_MODIS_Grid_16DAY_250m_500m_VI)

print(land)

 

 

Michael Notaro

Associate Director

Nelson Institute Center for Climatic Research

University of Wisconsin-Madison

Phone: (608) 261-1503

Email: mnotaro at wisc.edu

 

From: Marston Johnston <shejo284 at gmail.com>
Sent: Tuesday, June 13, 2017 3:37 PM
To: Michael Notaro; ncl-talk at ucar.edu
Subject: Re: [ncl-talk] hdf confusion 

 

Hi,

 

Try this function: http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt_hdf.shtml

short2flt_hdf - ncl.ucar.edu
www.ncl.ucar.edu
NCL Home > Documentation > Functions > Type converters short2flt_hdf. Converts values of type short to values of type float using the "scale" and "offset" attributes ...
 

 

/M

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Marston S. Johnston, PhD

Department of Earth Sciences

University of Gothenburg, Sweden

Email: marston.johnston at gu.se

SkypeID: marston.johnston 

Phone: +46-31-7864901 

Only the fruitful thing is true!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

 

From: <ncl-talk-bounces at ucar.edu> on behalf of Michael Notaro <mnotaro at wisc.edu>
Date: Tuesday, 13 June 2017 at 22:33
To: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
Subject: [ncl-talk] hdf confusion

 

Sorry for the ignorant question but I am having trouble figuring out

how to properly retrieve the land-lake-ocean mask off this MODIS hdf file.

If I ncl_filedump *hdf, it shows the variable as ushort.  If I ncl_filedump *hdf.hdfeos,

it shows the variable as short.  Which should I use in addfile and how do I 

retrieve the values of 001=land, 000=ocean, etc?

Michael

 

 

ncl_filedump h10v04_yellowstone/MOD13Q1.A2012001.h10v04.006.2015236172021.hdf.hdfeos

 

    short 250m_16_days_VI_Quality_MODIS_Grid_16DAY_250m_500m_VI ( YDim_MODIS_Grid_16DAY_250m_500m_VI, XDim_MODIS_Grid_16DAY_250m_500m_VI )

         coordinates :

GridLat_MODIS_Grid_16DAY_250m_500m_VI, GridLon_MODIS_Grid_16DAY_250m_500m_VI

         hdfeos_name :

250m 16 days VI Quality

         projection :

Sinusoidal

         unsigned :

True

         Legend :

Bit Fields Description (Right to Left): 

[0-1] : MODLAND_QA [2 bit range] 

00: VI produced, good quality 

01: VI produced, but check other QA 

10: Pixel produced, but most probably cloudy 

11: Pixel not produced due to other reasons than clouds 

[2-5] : VI usefulness [4 bit range] 

0000: Highest quality 

0001: Lower quality  

0010..1010: Decreasing quality 

1100: Lowest quality 

1101: Quality so low that it is not useful 

1110: L1B data faulty 

1111: Not useful for any other reason/not processed 

[6-7] : Aerosol quantity [2 bit range] 

00: Climatology 

01: Low 

10: Average 

11: High (11) 

[8] : Adjacent cloud detected; [1 bit range] 

1: Yes 

0: No 

[9] : Atmosphere BRDF correction performed [1 bit range] 

1: Yes 

0: No 

[10] : Mixed clouds  [1 bit range] 

1: Yes 

0: No 

[11-13] : Land/Water Flag [3 bit range] 

000: Shallow ocean 

001: Land (Nothing else but land) 

010: Ocean coastlines and lake shorelines 

011: Shallow inland water 

100: Ephemeral water 

101: Deep inland water 

110: Moderate or continental ocean 

111: Deep ocean 

[14] : Possible snow/ice [1 bit range] 

1: Yes 

0: No 

[15] : Possible shadow [1 bit range] 

1: Yes 

0: No

         _FillValue :

-1

         valid_range :

( 0, -2 )

         units :

bit field

         long_name :

250m 16 days VI Quality

 

ncl_filedump h10v04_yellowstone/MOD13Q1.A2012001.h10v04.006.2015236172021.hdf

 

      ushort 250m_16_days_VI_Quality ( YDim_MODIS_Grid_16DAY_250m_500m_VI, XDim_MODIS_Grid_16DAY_250m_500m_VI )

         long_name :

250m 16 days VI Quality

         units :

bit field

         valid_range :

( 0, 65534 )

         _FillValue :

65535

         Legend :

Bit Fields Description (Right to Left): 

[0-1] : MODLAND_QA [2 bit range] 

00: VI produced, good quality 

01: VI produced, but check other QA 

10: Pixel produced, but most probably cloudy 

11: Pixel not produced due to other reasons than clouds 

[2-5] : VI usefulness [4 bit range] 

0000: Highest quality 

0001: Lower quality  

0010..1010: Decreasing quality 

1100: Lowest quality 

1101: Quality so low that it is not useful 

1110: L1B data faulty 

1111: Not useful for any other reason/not processed 

[6-7] : Aerosol quantity [2 bit range] 

00: Climatology 

01: Low 

10: Average 

11: High (11) 

[8] : Adjacent cloud detected; [1 bit range] 

1: Yes 

0: No 

[9] : Atmosphere BRDF correction performed [1 bit range] 

1: Yes 

0: No 

[10] : Mixed clouds  [1 bit range] 

1: Yes 

0: No 

[11-13] : Land/Water Flag [3 bit range] 

000: Shallow ocean 

001: Land (Nothing else but land) 

010: Ocean coastlines and lake shorelines 

011: Shallow inland water 

100: Ephemeral water 

101: Deep inland water 

110: Moderate or continental ocean 

111: Deep ocean 

[14] : Possible snow/ice [1 bit range] 

1: Yes 

0: No 

[15] : Possible shadow [1 bit range] 

1: Yes 

0: No

         hdf_name :

250m 16 days VI Quality

 

 

Michael Notaro

Associate Director

Nelson Institute Center for Climatic Research

University of Wisconsin-Madison

Phone: (608) 261-1503

Email: mnotaro at wisc.edu

_______________________________________________ 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/20170613/0cfb86b7/attachment.html 


More information about the ncl-talk mailing list