Re: byte2flt v5.2.1 & v6.0.0 issues

From: <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 01 2012 - 13:07:23 MST

One thing has changed.

All NCL versions thru v5.2.1 only allowed a a *signed* byte (-128 to 127].
Version v6.0.0 introduced a number of new numeric types. See
   http://www.ncl.ucar.edu/current_release.shtml
Specifically,
   Change to byte and character types, new unsigned byte type added
   http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclDataTypes.shtml

To support netCDF-4 a new *unsigned* byte was introduced. This ranges
from 0-255.

I speculate that the data is being read as an unsigned byte.
There is no way to determine if the variable of type byte
should be a signed or unsigned.

A work around:

    var = "ir"
    var_type = getfilevartypes(infile,var)

    if (var_type.eq."byte") then
        ir = short2flt(infile->$var$(0,:,:)) ; variable of type 'byte'

    else if (var_type.eq."ubyte") then
        iru = infile->$var$(0,:,:)
        ir = tobyte(iru-128B)
        copy_VarMeta(iru, ir)
        delete(iru)
    else
        ir = infile->$var$(0,:,:)
    end if
    end if
    end if

    printVarSummary(ir)

plotData = byte2flt(infile->ir(0,:,:))

>
> Hi,
>
> I am plotting the NASA merged ir data, saved as a bytes in a netcdf
> file, with a +75 offset. When using NCL version 5.2.1, and reading the
> data in using byte2flt the data is fine, when using ncl 6.0.0 with the
> same script the values are offset (not by 75) and below ~ -52 (Kelvin
> ??) is wrapped to ~ 200.
>
> Is this a known issue with ncl 6.0.0 and I need to adjust my script or
> is something going wrong in 6.0.0 with this.
>
> Hope this is clear.
>
>
> NCL script and outputs from 5.2.1 and 6.0.0 are available at
> http://www.atmos.albany.edu/student/abrammer/ncl_plots/
>
>
>
>
> Thanks.
>
> Alan Brammer
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 2 01:07:32 2012

This archive was generated by hypermail 2.1.8 : Thu Feb 02 2012 - 03:10:31 MST