Re: writing and reading character arrays to netCDF

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu, 5 Mar 2009 14:03:44 -0700

On Mar 5, 2009, at 1:16 PM, Jonathan Vigh wrote:

>
> Hi Dave,
> Okay, thanks for letting me know. By the way, do logical values
> automatically get transmorgified into 1's and 0's when NCL writes them
> out to netCDF? I noticed that as well and was a bit mystified as to
> the
> best way to write out logical arrays to netCDF files.
>

Since NetCDF does not have a logical type, NCL writes out logical
data as
integers. When read back into NCL, there is, unfortunately, no way to
tell that these
data were logical to begin with.
However, if you read the data into a pre-defined logical array of the
correct dimensions,
I think it will be converted correctly.
  -dave

> Jonathan
>
>
> David Brown wrote:
>>
>> Hi Jonathan,
>>
>> I have reproduced your problem of have the _FillValue show up as
>> lower
>> case 'l'
>> when reading the file into NCL, while ncdump shows it as a null
>> character.
>>
>> This is a bug somewhere, probably in NCL. I will investigate.
>> -dave
>>
>>
>> On Mar 5, 2009, at 12:39 PM, Jonathan Vigh wrote:
>>
>>>
>>> Greetings,
>>> I'm using NCL to write out a character array to a netCDF flie
>>> and
>>> then read it back in for processing using a different NCL
>>> script. Some
>>> of the time my arrays are all just _FillValue, which I have set
>>> to the
>>> null character. However, if I dump the resulting netCDF file
>>> after it is
>>> written, these show up as lower case Ls (e.g. "l"). When I read the
>>> netCDF file back in using my other script, the _FillValue
>>> attribute is
>>> "l". This causes a warning message because I am trying to assign the
>>> read data to a multidimensional array which already has a
>>> _FillValue
>>> set to the null character. So I get the warning:
>>>
>>> fatal:Attribute assignment type mismatch
>>>
>>> Does anyone know about why this is happening? Does netCDF
>>> represent the
>>> null character as an "l"?
>>>
>>> Thanks,
>>> Jonathan
>>>
>>> _______________________________________________
>>> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 05 2009 - 14:03:44 MST

This archive was generated by hypermail 2.2.0 : Thu Mar 05 2009 - 15:48:48 MST