[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VisAD to netCDF CF




Don Murray wrote:
> Okay, I figured out that I have to call write.  Why are all the
> write methods based on the variable name instead of:
> 
> write(Variable, Array)
> 
> 

probably no good reason

> 
> Also, for the write method:
> 
> public void write(java.lang.String varName,
>                   int[] origin,
>                   Array values)
> 
> if I have:
> 
> T(time, z, y, x)
> 
> and I'm looping over time to write out the data, would my
> origins be:
> 
> {0,0,0,0}
> {1,0,0,0}
> {2,0,0,0}
> ....
> {ntime, 0,0,0}
> 
> for ntime times?

yes. Your values array must have shape (1, nz, ny, nx). If you need to, you can 
reshape with
array.reshape(). But better to declare it that way.


> 
> Thanks.
> 
> Don
> 
> Don Murray wrote:
>> John-
>>
>> I've been working on the VisAD grids to netCDF CF, but
>> I can't seem to write out the values.  Here's what
>> I'm doing:
>>
>> Create a NetcdfFileWriteable:
>>
>>         NetcdfFileWriteable ncfile =
>> NetcdfFileWriteable.createNew(filename,false);
>>
>> Add the dimensions, coordinate variables and data variables.
>> Call:
>>
>>         ncfile.create();
>>
>> Fill in the values with:
>>
>> v.setCachedData(Array, false)
>>
>> for each coordinate and data variable.
>>
>> Call ncfile.finish();
>>
>> However, when I do a dump on the file, all the values are 0.
>>
>> What am I missing?
>>
>> Don
>> *************************************************************
>> Don Murray                               UCAR Unidata Program
>> address@hidden                        P.O. Box 3000
>> (303) 497-8628                              Boulder, CO 80307
>> http://www.unidata.ucar.edu/staff/donm
>> *************************************************************
>