Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: Why?

Hi Eugene,

> OK...I've tried using Gridded1DSet with the following constructor:
> 
> //field1 is a FieldImpl with FunctionType (Real):
> //(Time) -> (MinTemp, MaxTemp)
> Gridded1DSet validSet = Gridded1DSet(field1.getDomainSet().getType(),
>                                      field1.getDomainSet().getSamples(),
>                                      field1.getDomainSet().getLength());
> 
> And then resampled like this:
> 
> field1 = (FieldImpl)field1.resample(validSet, Data.WEIGHTED_AVERAGE,
>                                     Data.NO_ERRORS);
> 
> We were trying to create an identical field to the original one to learn
> how to use the resample function but it seems to fail because all the
> values that we get in the field become NaN.
> 
> Our data (with one NaN) looks like this:
> 
> time = 0, 10800, 21600, 32400, 43200, 54000, 64800, 75600, 86400, 97200,
>        108000, 118800, 129600, 140400, 151200, 162000;
> MinTemp = 33,32,37,23,30,30,32,30,31,31,31,31,18,21,12,12;
> MaxTemp = 30,NaN,20,25,25,20,25,27,28,29,30,29,27.5,30,30.4,15;
> 
> But our output is this:
> 
> time = 0, 10800, 21600, 32400, 43200, 54000, 64800, 75600, 86400, 97200,
>        108000, 118800, 129600, 140400, 151200, 162000;
> MinTemp = NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN,
>           NaN, NaN, NaN;
> MaxTemp = NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN,
>           NaN, NaN, NaN;

Two suggestions:

1. First try resampling to:

  Set validSet = field1.getDomainSet();

2. Second, try using Gridded1DDoubleSet instead of
Gridded1DSet, and getDoubles() instead of getSamples().

If that doesn't fix it, then you'll have to put your code
and data somewhere that I get them to run your application
myself.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690