[ncl-talk] writing out ushort and uint to netcdf4
David Brown
dbrown at ucar.edu
Thu Nov 5 15:59:30 MST 2015
Hi Archana,
Can you send us the script you used to write this data to NetCDF4? Thank you.
-dave
On Wed, Nov 4, 2015 at 5:30 PM, Archana Dayalu <adayalu at seas.harvard.edu> wrote:
> Hi there,
> I am trying to write out some MODIS09A1 variables (QA flags) to netcdf4 (not
> the classic model). The QA flag and SQA flag are in uint and ushort format
> respectively. I am using NCLv6.2.1. I've correctly set my file option to
> NetCDF4 prior to creating the ncdf file.
> The problem is, in its native hdf format and when I read it in to ncl I get
> the following:
>
> ;;;;;;;;;;;;;;;;;;;;; QAFLAG ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> Variable: QAFLAG
> Type: uint
> Total Size: 645120000 bytes
> 161280000 values
> Number of Dimensions: 2
> Dimensions and sizes: [YDim_MOD_Grid_500m_Surface_Reflectance | 9600] x
> [XDim_MOD_Grid_500m_Surface_Reflectance | 16800]
> Coordinates:
> Number Of Attributes: 7
> _FillValue : 4294967295
> long_name : Surface_reflectance_500m_quality_control_flags
> units : bit field
> valid_range : ( 0, 4294966531 )
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;; SQAFLAG ;;;;;;;;;;;;;;;;;;;;;;;
> Variable: SQAFLAG
> Type: ushort
> Total Size: 322560000 bytes
> 161280000 values
> Number of Dimensions: 2
> Dimensions and sizes: [YDim_MOD_Grid_500m_Surface_Reflectance | 9600] x
> [XDim_MOD_Grid_500m_Surface_Reflectance | 16800]
> Coordinates:
> Number Of Attributes: 7
> _FillValue : 65535
> long_name : Surface_reflectance_500m_state_flags
> units : bit field
> valid_range : ( 0, 57343 )
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> But, when I write out these variables to netcdf4 and then view them using
> ncl_filedump, they are output as QAFLAG as float (and I don't specify this
> anywhere) and SQAFLAG as something else (doesn't look like float?):
>
> ;;;;;;;;;;;;;;;;;;;;; QAFLAG ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> Variable: QAFLAG
> Type: uint
> Total Size: 161280000 values
> 645120000 bytes
> Number of Dimensions: 2
> Dimensions and sizes: [ 9600 <YDim> x 16800 <XDim> ]
> Coordinates:
> Number of Attributes: 8
> missing_value : -1
> _FillValue : -1
> long_name : sur_refl_qc_500m
> units : bit field
> valid_range : ( 0, -765 )
>
> ;;;;;;;;;;;;;;;;;;;;; SQAFLAG ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> Variable: SQAFLAG
> Type: ushort
> Total Size: 161280000 values
> 322560000 bytes
> Number of Dimensions: 2
> Dimensions and sizes: [ 9600 <YDim> x 16800 <XDim> ]
> Coordinates:
> Number of Attributes: 8
> missing_value :
> _FillValue :
> long_name : sur_refl_state_500m
> units : bit field
> valid_range : ( 0, -8193 )
> QA_bitmap_index :
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> However, when I read these converted .nc files *back* into NCL, it's all
> fine ... and looks like the output from the native hdf file. Could you
> explain why this is happening? Does it have something to do with the data
> compression? I just want to make sure it is not impacting the contents of
> the variables.
>
> (On a side note, the reason I am going through all this is I am eventually
> reading these objects into R to QC filter my MODIS reflectance data. Is
> there pre-existing NCL code that allows for application of QC criteria
> within ncl? It might be faster and would avoid all this ... )
>
> Thanks for any help!
>
> Regards,
> Archana
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
More information about the ncl-talk
mailing list