Re: HDF -> NC

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue, 26 Aug 2008 14:50:35 -0600

Hi Michael,
I was finally able to track this problem down. In fact, the example
file that I downloaded had
3 variables that had _FillValue attributes where the type of the
_FillValue and the type of
the variable were different. Unlike HDF, neither NCL nor NetCDF allow
the _FillValue to be of a
different type from the variable it belongs to. All the variables
with the problematic _FillValues
are of type 'byte' and the _FillValue is of type 'short'. 'short'
cannot automatically be coerced to
'byte' in NCL and hence the warning message.

I have modified ncl_convert2nc to recognize this situation and, when
it is found, to
substitute the default _FillValue for the variable type. It prints a
WARNING about each
instance found. It would probably be better if we could force a type
conversion, even though
there would then be the possibility of overflow. However, this is not
so easy to do in a general
way in NCL right now. I am hoping to solve this problem soon though.

I am attaching the modified version of ncl_convert2nc. It prints out
the following warnings for
the example file:

WARNING: Type mismatch between CMG_0_05_Deg_16_days_pixel_reliability
and its _FillValue attribute: not permitted: using default _FillValue
for variable type
WARNING: Type mismatch between CMG_0_05_Deg_16_days_1km_pix_30deg_VZ
and its _FillValue attribute: not permitted: using default _FillValue
for variable type
WARNING: Type mismatch between CMG_0_05_Deg_16_days_1km_pix_used and
its _FillValue attribute: not permitted: using default _FillValue for
variable type

  -dave

On Aug 14, 2008, at 10:18 AM, Michael Notaro wrote:

> On this website, there are many hdf files of Enhanced Vegetation
> Index from MODIS,
> available through EOS.
> ftp://e4ftl01u.ecs.nasa.gov/MOLT/MOD13C1.005/
>
> I want to convert them to netcdf.
>
> I tried ncl_convert2nc and it does create a nc file, but gives this
> error.
>
> ncl_convert2nc MOD13C1.A2000049.005.2006271195746.hdf -L
> Processing file: MOD13C1.A2000049.005.2006271195746.hdf...
> Copyright (C) 1995-2007 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.0.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> fatal:Type Mismatch: The type of missing value could not be
> converted to type of variable (dumAtts)
> fatal:Execute: Error occurred at or near line 337 in file /tmp/
> tmp12473.ncl
>
> What did I do wrong?
>
> Thanks,
> Michael_______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue Aug 26 2008 - 14:50:35 MDT

This archive was generated by hypermail 2.2.0 : Wed Aug 27 2008 - 10:22:45 MDT