Re: Save problem?

Eugene,

>Date: Mon, 31 Jan 2000 10:19:09 +1100 (AEDT)
>From: Eugene Tan <chet@xxxxxxxxxx>
>Organization: .
>To: visad-list@xxxxxxxxxxxxx
>Subject: Re: Save problem?
>Keywords: 200001302324.QAA05731

In the above message, you wrote:

> I tried to save my FieldImpl to a netcdf file but it keeps crashing out
> with the following exception:
> 
> java.lang.ClassCastException: visad.Irregular1DSet
>         at
> visad.data.netcdf.out.VisADAdapter.define1DDim(VisADAdapter.java:388)
>         at
> visad.data.netcdf.out.VisADAdapter.defineSampledSetDim(VisADAdapter.java:361)
>         at visad.data.netcdf.out.VisADAdapter.visit(VisADAdapter.java:269)
>         at visad.data.netcdf.out.VisADAdapter.visit(VisADAdapter.java:112)
>         at visad.data.netcdf.out.VisADAdapter.<init>(VisADAdapter.java:68)
>         at visad.data.netcdf.Plain.save(Plain.java:86)
>         at newTest.main(newTest.java:42)
> 
> The code looks like this:
> 
> Plain plain = new Plain();
> plain.save("toGraph.nc", field, true);
> 
> field is a FieldImpl.
> 
> I found out that it works if I don't resample the field first. The saving
> stops working after I resample my field. (I use an Irregular1DSet in the
> resampling).

The netCDF export module can only save a subset of all possible VisAD
data objects.  One of the objects it can't save is a FieldImpl with a
Irregular1DSet domain.  The reason for this is because the coordinate
variables in a netCDF dataset should be sorted.

I'm going to modify the code so that Plain.save(String) throws a
BadFormException in this case.

In any case, you should modify your code so that the FieldImpl has a
Gridded1DSet for the domain.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>