[ncl-talk] SST plot with strange range

Dennis Shea shea at ucar.edu
Thu Nov 12 10:14:42 MST 2015


Of course, NCL could automatically unpack the variables also.

One reason why NCL does not automatically unpack variables with
CF/COARDS attributes 'scale_factor' and 'add_offset'  is the we don't
know if a user may want alter the original
short or byte variable ... perhaps to overwrite the original variable.

===
My personal bias is that requiring the user to explicitly invoke
'short2flt' is good!!

     x = short2flt( f->xShort )   ; clearly indicate the the data is
to be unpacked
===

I speculate that a 'setfileoption' could be created (say)

     setfileoption("nc", "UnPack", "ShortByte")       ; x =
xShort*scale_factor + addOfffset

or somebody could create a generic function

     function getVar(f, varName[1]:string)   ; is type 'file' or 'list'

===

Note: HDF has no universal convention to follow. Some HDF equivalents
we have encountered are:

          ; names to check
 oNames = (/"add_offset", "offset", "OFFSET", "Offset", "_offset" \
           ,"Intercept", "intercept", "scalingIntercept", "INTERCEPT" \
           ,"add_off"                                             /)
 sNames = (/"scale", "SCALE", "Scale", "_scale", "scale_factor"   \
           ,"Scale_factor", "Slope" , "slope", "ScaleFactor"      \
           ,"Scale_Factor", "scalingSlope", "SCALING_FACTOR"      \
           ,"SCALE_FACTOR", "SLOPE"                             /)

They may use a different formula than the COARDS/CF requirement

      x = xShort*scale_factor  +  add_offset       <== COARDS/CF

HDF, possibly

     x = (x+add_offset)*scale_factor                  <=== alternate

     x = short2flt_hdf( f->xShort)                        <==== use
alternative formula


D




On Thu, Nov 12, 2015 at 9:24 AM, Guilherme Martins <jgmsantos at gmail.com> wrote:
> Or try
>
> line 12:
>
>  oisst   = short2flt(in_oisst_f->sst)
>
> Guilherme
>
>
>
> Em qui, 12 de nov de 2015 às 14:20, Arne Melsom <arne.melsom at met.no>
> escreveu:
>>
>> So, simply replace the line
>>  oisst          = in_oisst_f->sst
>> by
>>  scale  = in_oisst_f->sst at scale_factor
>>  offset = in_oisst_f->sst at add_offset
>>  oisst  = scale*in_oisst_f->sst + offset
>>
>>
>> ----- Original Message -----
>> > Sorry, I didn't look at your attachments and now that I have, the data
>> > are definitely packed in shorts:
>> >
>> >       short sst(time, lat, lon) ;
>> >               sst:standard_name = "sea_surface_temperature" ;
>> >               sst:long_name = "Monthly Mean of Sea Surface Temperature"
>> > ;
>> >               sst:units = "degC" ;
>> >               sst:add_offset = 0.f ;
>> >               sst:scale_factor = 0.01f ;
>> >               sst:_FillValue = 32767s ;
>> >               sst:missing_value = 32767s ;
>> >               sst:unpacked_valid_range = -5.f, 40.f ;
>> >               sst:actual_range = -1.8f, 35.31f ;
>> >               sst:precision = 2s ;
>> >               sst:least_significant_digit = 2s ;
>> >               sst:var_desc = "Sea Surface Temperature" ;
>> >               sst:dataset = "NOAA Optimum Interpolation (OI) SST V2" ;
>> >               sst:level_desc = "Surface" ;
>> >               sst:statistic = "Mean" ;
>> >               sst:parent_stat = "Weekly Mean" ;
>> >               sst:cell_methods = "time: mean (monthly from weekly values
>> > interpolated to daily)" ;
>> >
>> > In your script, call:
>> >
>> > oisst         = short2flt(in_oisst_f->sst)
>> >
>> > when you read in the data.  Ferret must automatically apply the
>> > scale/offset - NCL doesn't.
>> >
>> > Don
>> >
>> > On 11/12/15 9:07 AM, Izidine Pinto wrote:
>> > > Dear NCL users,
>> > >
>> > > I was wondering if anyone can help me solving my problem. It might be
>> > > simple but I'm missing something.
>> > > When I plot it in NCL I get big numbers of SSTs but when I plot in
>> > > ferret I get what I expect (temperature range -2:34 degC)
>> > > Please see attached the working example and the figure.
>> > >
>> > >
>> > > Thank you
>> > > Izidine
>> > >
>> > >
>> > >
>> > >
>> > > _______________________________________________
>> > > ncl-talk mailing list
>> > > ncl-talk at ucar.edu
>> > > List instructions, subscriber options, unsubscribe:
>> > > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> > >
>> >
>> > --
>> > Don Murray
>> > NOAA/ESRL/PSD and CU-CIRES
>> > 303-497-3596
>> > http://www.esrl.noaa.gov/psd/people/don.murray/
>> > _______________________________________________
>> > ncl-talk mailing list
>> > ncl-talk at ucar.edu
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> ------------------------------------------------------------------------------------------
> Guilherme Martins
> Instituto Nacional de Pesquisas Espaciais (INPE)
> Centro de Ciência do Sistema Terrestre (CCST) - Prédio CES
> Grupo de Superfície-Biosfera-Atmosfera (GSBA)
> Telefone (INPE/CP): +55 12 3186-9520  ||  Celular (TIM): +55 12 98152-8580
> E-mail: guilherme.martins at inpe.br  ||  jgmsantos at gmail.com
> Skype: guilherme.martins.
> Homepage: https://sites.google.com/site/jgmsantos
> Currículo Lattes: http://lattes.cnpq.br/5997657584785803
> ------------------------------------------------------------------------------------------
>
> _______________________________________________
> 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