[Thread Prev][Thread Next][Index]

Re: [ferret_users] Time regridding from descriptor file returns missing values



Hi Bill,
Your descriptor file would seem to be ok to describe the file, which are just index values t=1,2,3,...  You've specified D_TIME_UNIT = 18000.0  which would correspond to 3 hours.  Ferret seems to understand this. The dates are correct looking at,
yes? use timeseries.des
yes? list/l=1:5 t2
             VARIABLE : T2 (K)
             DATA SET : Time Regrid Issue Sample File
             FILENAME : timeseries.des
             SUBSET   : 5 points (TIME)
             X        : 100
             Y        : 100
                          100  
                           1
 01-JAN-2011 00:00 / 1:  251.3
 01-JAN-2011 03:00 / 2:  246.3
 01-JAN-2011 06:00 / 3:  248.8
 01-JAN-2011 09:00 / 4:  249.1
 01-JAN-2011 12:00 / 5:  250.5
But the coordinates in the file are still 1, 2, 3, ... 
yes? show axis/t/l=1:5 `t2,return=taxis`
 !-> show axis/t/l=1:5 TIME1
 name       axis              # pts   start                end
 TIME1     TIME               961 r   01-JAN-2011 00:00    01-MAY-2011 00:00
T0 = 01-JAN-2011 00:00:00
   Axis span (to cell edges) = 961
 
       L     T                   TBOX      TBOXLO                TSTEP ()
       1>  01-JAN-2011 00:00:00  1          31-DEC-2010 22:30:00        0
       2>  01-JAN-2011 03:00:00  1          01-JAN-2011 01:30:00        1
       3>  01-JAN-2011 06:00:00  1          01-JAN-2011 04:30:00        2
       4>  01-JAN-2011 09:00:00  1          01-JAN-2011 07:30:00        3
       5>  01-JAN-2011 12:00:00  1          01-JAN-2011 10:30:00        4

We don't have a Ferret time unit of 3hour for purposes of regridding or other analysis. The units that can be converted between axes are units of second, minute, hour, etc.  Ferret is using the information in the descriptor to translate dates but the TBOX and TSTEP values are not 3 hours long but just 1.  It tries to do the regridding but uses time grid cell sizes of the wrong length. (Actually it seems to be more than that going on, or you would get some non-missing results from the regridding.) This is something that Ferret should detect and issue an error message.

However there's an easy way to handle your files without using descriptor files. Use DEFINE AXIS to simply redefine the axis that's in the file
yes? use timeseries.nc

yes? define axis/t0=1-jan-2001/units=hours/t="1-jan-2011:00":"1-may-2011:00":3 `t2,return=taxis`
 !-> define axis/t0=1-jan-2001/units=hours/t="1-jan-2011:00":"1-may-2011:00":3 TIME
Replacing definition of axis TIME
           *** NOTE: grid GHF1 used by data set timeseries
           *** NOTE: Redefinition may alter apparent contents of data set

! Define the daily time axis
yes? define axis/t/t0="1-jan-2011:00"/t="1-jan-2011:00":"1-may-2011:00":1/edges/units=day taxday
yes? let des1day = t2[gt=taxday]

yes? list/l=1:10 des1day
             VARIABLE : T2[GT=TAXDAY]
             FILENAME : timeseries.nc
             SUBSET   : 10 points (TIME)
             X        : 100
             Y        : 100
                        100  
                         1
 01-JAN-2011 12 /  1:  250.5
 02-JAN-2011 12 /  2:  256.0
 03-JAN-2011 12 /  3:  253.7
 04-JAN-2011 12 /  4:  250.0
 05-JAN-2011 12 /  5:  241.8
...
You could replace your set of .des files with .jnl files which would initialize the datasets:
yes? go init_file_2011_a.jnl
which would open the file and give it the correct time axis.

-Ansley


On 4/19/2017 9:36 AM, Ansley C. Manke wrote:

Hi Bill,

Thank you for the report and example files; we'll have a look at it.

In Ferret v7+  you have the option of the TSERIES (alias for DEFINE DATA/AGGREGATE/T), which acts like a descriptor file does to aggregate timeseries datasets, but it is much more flexible.  It handles irregular or missing time steps which descriptor files do not. It reads and analyzes the time axis information in the files, so you start with files that have good time axis definitions. I don't know whether this would be useful to you or whether it relates to what you're seeing, but I want to point it out to you.

-Ansley


On 4/18/2017 2:56 PM, Gustafson, William I wrote:

Hi,

 

I discovered an odd inconsistency when time regridding with Ferret that is most likely a bug, or at least an annoying feature, assuming I am not doing something wrong. Attached is a script and data files necessary to reproduce the issue. If I read a variable directly from a netcdf file, assign a time axis to it, and then regrid to a second time axis I get the desired result. In my case, the data in the netcdf file is every 3 hours and I would like to regrid to daily data. So far so good. Next, I wrap the netcdf file with a descriptor file to take care of mapping the 3-hourly time axis for the data in the netcdf file. Then, I do the same time regridding to the daily time axis. This time the result is missing values instead of daily data.

 

For the attached simplified case, there is the trivial fix of not using the des file. However, in production situations, this complicates things a lot for me. Is this "missing value" feature a bug? Am I doing something wrong? I have been able to reproduce the problem in both Ferret v6.9.3 and v7.1 on a Linux box.

 

Thanks for any suggestions.

 

-Bill

 

 

The script that produces the error:

 

---SCRIPT BEGIN---

! Script demonstrating a Ferret bug/feature when doing time interpolation

! from input directly from a netCDF file vs. input that has been read via

! a descriptor file. For some reason, when regridding data read via the

! descriptor file results in all missing values. However, bypassing the

! des file and assigning the time grid from the Ferret command line

! before doing the regridding works.

! William.Gustafson@xxxxxxxx, 18-Apr-2017

 

use timeseries.nc

use timeseries.des

 

! Define needed time axes

define axis/t/t0="1-jan-2011:00"/t="1-jan-2011:00":"1-may-2011:00":3/units=hour tax3h

define axis/t/t0="1-jan-2011:00"/t="1-jan-2011:00":"1-may-2011:00":1/edges/units=day taxday

 

! Set up daily data from 3-hourly data via nc file. First, map the data

! to the 3-h grid, and then regrid to the final daily grid. This works.

let nc3h = t2[gt=tax3h@asn,d=1]

let nc1day = nc3h[gt=taxday]

 

! Set up daily data from 3-hourly data via des file. The descriptor file

! is responsible for putting the data on the 3-h grid this time. Then,

! we regrid to the daily grid. This returns missing values.

let des3h = t2[d=2]  !des file defines this as 3-hourly

let des1day = des3h[gt=taxday]

 

list nc1day, des1day

 

---SCRIPT END---

 

 

---TRUNCATED OUTPUT FROM SCRIPT BEGIN---

             TIME: 01-JAN-2011 00:00 to 01-MAY-2011 00:00

             X: 100

             Y: 100

Column  1: NC1DAY is NC3H[GT=TAXDAY]

Column  2: DES1DAY is DES3H[GT=TAXDAY]

                     NC1DAY  DES1DAY

01-JAN-2011 12 /   1:  250.5 ....

02-JAN-2011 12 /   2:  256.0 ....

03-JAN-2011 12 /   3:  253.7 ....

04-JAN-2011 12 /   4:  250.0 ....

05-JAN-2011 12 /   5:  241.8 ....

06-JAN-2011 12 /   6:  237.3 ....

07-JAN-2011 12 /   7:  251.9 ....

08-JAN-2011 12 /   8:  247.3 ....

09-JAN-2011 12 /   9:  247.0 ....

---TRUNCATED OUTPUT FROM SCRIPT END---

___________________________________________________________________

 

William I. Gustafson Jr., Ph.D.

Scientist


ATMOSPHERIC SCIENCES AND GLOBAL CHANGE DIVISION


Pacific Northwest National Laboratory

P.O. 999, MSIN K9-30

Richland,WA  99352

Tel: 509-372-6110

 

William.Gustafson@xxxxxxxx

http://www.pnnl.gov/atmospheric/staff/staff_info.asp?staff_num=5716

http://www.researcherid.com/rid/A-7732-2008




[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement