Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

[netcdf-java] ArrayChar problem

Hi all
   I'm having this problem: I'm trying to write a string data, so I tried
what appears in this example:
http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg02393.html


Basically: I create an ArrayChar and then write it with nc.writeStringData,
but I get an exception: Must be of type String

if (values.getElementType() != String.class)
      throw new IllegalArgumentException("Must be ArrayObject of String ");


I took a look into the code and ArrayChar returns char:
The code for getElementType() is:

 /** Return the element class type */
  public Class getElementType() { return char.class; }

So, I tried to use ArrayObject ...

java.lang.IllegalArgumentException: variable INSI is not type CHAR
this is because of this:

 if (v2.getDataType() != DataType.CHAR)
      throw new IllegalArgumentException("variable " + varName + " is
not type CHAR");


Ok, I had the var created with dataType.String, So I changed it to Char

My question is: is this ok? should I create a var of type char then create
an ArrayObject of Strings and then write that using writeStringData?
  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: