Re: [netcdf-java] How to deal with dataPacking and fillValue.

Hi John,
I had already checked that page in the past but I had not read that
carefully.
It's really what I need.
Thanks a lot.

Cheers,
Daniele

On Thu, May 14, 2015 at 11:41 PM, John Caron <caron@xxxxxxxx> wrote:

> see:
>
> http://www.unidata.ucar.edu/software/netcdf/docs/BestPractices.html#Packed
> Data Values
>
> regards,
> john
>
> On Thu, May 14, 2015 at 9:27 AM, Daniele Romagnoli <
> daniele.romagnoli@xxxxxxxxxxxxxxxx> wrote:
>
>> Hi.
>> First of all, sorry if that's not a java specific topic.
>>
>> I'm working on supporting dataPacking when storing a dataset to a NetCDF
>> output file. Suppose I have Double data in the range [-10 : 35] (as an
>> instance, a temperature in celsius degrees) where the input _fillValue is
>> -65536.
>>
>> I want to write it as packed data (as an instance, Byte... it's just an
>> example).
>> I'm using the formula provided here
>> <https://www.unidata.ucar.edu/software/netcdf/workshops/2010/bestpractices/Packing.html>
>> .
>> Therefore, I'm computing dataMin, dataMax: -10, 35 in my case (-65536 is
>> not part of the statistics computations).
>> Then, I'm using them to compute add_offset and scale_factor:
>>
>>   add_offset = dataMin
>>   scale_factor = (dataMax - dataMin) / (2^n - 1)
>>
>> I'm setting out a NetCDF Variable with short dataType and I'm rescaling
>> the values on the fly using that formula:
>>
>> packed_value = nint((unpacked_value - add_offset) / scale_factor)
>>
>> Note that I'm avoiding to apply this transformation to samples with value
>> = -65536 (being my NoData, _fillValue).
>>
>> The question is:
>> I want to setup a _fillValue in the packed dataset.
>> It need to respect the output dataType (so, it's a Byte).
>> _fillValue = -65536 won't fit in the Byte range. What is the recommended
>> approach to compute the "output" _fillValue?
>>
>> Moreover, what can I do to make sure that I still have a "reserved" value
>> in the output range, to be used to represent _fillValue without risking
>> overlaps with the converted range?
>> Should I use some additional "offsets" when computing the
>> add_offset/scale_factor to make sure as an instance, that the first value
>> of dataType range is reserved for _fillValue? (as an instance, to make sure
>> that _fillValue = 0 and valid range will be between 1 and 255)
>>
>> Please, let me know.
>> Best Regards,
>> Daniele
>>
>>
>> --
>> ==
>> GeoServer Professional Services from the experts! Visit
>> http://goo.gl/NWWaa2 for more information.
>> ==
>>
>> Ing. Daniele Romagnoli
>> Senior Software Engineer
>>
>> GeoSolutions S.A.S.
>> Via Poggio alle Viti 1187
>> 55054  Massarosa (LU)
>> Italy
>> phone: +39 0584 962313
>> fax:      +39 0584 1660272
>>
>> http://www.geo-solutions.it
>> http://twitter.com/geosolutions_it
>>
>> -------------------------------------------------------
>>
>> *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*
>>
>> Le informazioni contenute in questo messaggio di posta elettronica e/o
>> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
>> loro utilizzo è consentito esclusivamente al destinatario del messaggio,
>> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
>> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
>> darcene notizia via e-mail e di procedere alla distruzione del messaggio
>> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
>> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
>> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
>> principi dettati dal D.Lgs. 196/2003.
>>
>>
>>
>> The information in this message and/or attachments, is intended solely
>> for the attention and use of the named addressee(s) and may be confidential
>> or proprietary in nature or covered by the provisions of privacy act
>> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
>> Code).Any use not in accord with its purpose, any disclosure, reproduction,
>> copying, distribution, or either dissemination, either whole or partial, is
>> strictly forbidden except previous formal approval of the named
>> addressee(s). If you are not the intended recipient, please contact
>> immediately the sender by telephone, fax or e-mail and delete the
>> information in this message that has been received in error. The sender
>> does not give any warranty or accept liability as the content, accuracy or
>> completeness of sent messages and accepts no responsibility  for changes
>> made after they were sent or for other risks which arise as a result of
>> e-mail transmission, viruses, etc.
>>
>>
>> _______________________________________________
>> netcdf-java mailing list
>> netcdf-java@xxxxxxxxxxxxxxxx
>> For list information or to unsubscribe, visit:
>> http://www.unidata.ucar.edu/mailing_lists/
>>
>
>


-- 
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/NWWaa2 for more information.
==

Ing. Daniele Romagnoli
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility  for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: