[Thread Prev][Thread Next][Index]

Re: [ferret_users]: time interpolation from files with different time axes fails



Hi Fabian and Martin,
                                          In Martins case, I guess the variable lwdn_ber do have a valid
time axis. According to me, the problem lies in the fact that, you are doing a time-axis
regridding and writing out data within a time-repeat loop. Remember that Ferret is not
a immediate mode evaluator and hence the requested linear interpolation is being done
when the respective variable hits an action command (see user manual, Ch3 Sec2.
EXPRESSIONS) ie. save.

 The solution is to make the repeat loop over any other axis than time. See case 2 (in
Tricks)  in the following post,

http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2007/msg00489.html

Please let me know if you have any questions.

Thanks and Regards,

Jaison


On Wed, Jul 8, 2009 at 9:18 AM, Fabian Lienert <cccma-student-003@xxxxxxxx> wrote:
Hi Martin,

Appending lwdn_ber to a netcdf file inside a loop should work if lwdn_ber has a time axis.

If lwdn_ber does not have a time axis, the only way I could come up with is to add some
other variable with a time axis, multiplied by zero, so that the variable is being redefined
inside the loop. See my message in the ferret users archive, the second part might help you:
http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2009/msg00401.html

Hope this helps.
Fabian



Martin Schmidt wrote:
Hi,
I am trying to use ferret to calculated downward longwave radiation from air-temperature, cloudiness and relative humidity.
All data are given 6 hourly, but cloudiness times are shifted by 3 hours agains air-temperature and relative humidity.
I would like hourly radiation values and interpolate input data.

My script looks like follows:
use "/DATABASE/2000/cloud.dta.nc"
use "/DATABASE/2000/tair.dta.nc"
use "/DATABASE/2000/rhumi.dta.nc"

!Define a new time axis ( the input data cover dec 1999 and  jan 2001)
define axis/t=1-dec-1999:31-jan-2001:1/unit=hours/t0=1-jan-1955/cal=julian time
define grid/t=time tgrid
let tdummy=0*t[gt=tgrid]

! for shorter notation
let ta =   tair[d=2]
let rh =  rhumi[d=3]
let cl =  cloud[d=1]

!linearly interpolate to a hourly common time basis
let ta_net = ta[gt=tdummy@lin]-273.15
let rh_net = rh[gt=tdummy@lin]
let cloud_net = cl[gt=$1@lin]

Now these quantities are used to calculate the radiation by simple operations.
Shading (l=something or x=something) prior writing to a file gives reasonable output.
The problem is now, that the amount of data is huge. With a limited area output can be written in one step

sp rm lwdn_ber.mom.dta.nc
save/append/file="lwdn_ber.dta.nc" lwdn_ber

This gives reasonable results.

For the full data set I try to write time step after time step
sp rm lwdn_ber.dta.nc
let lmax=`tdummy,return=lend`
repeat/l=1:`lmax` (save/append/file="lwdn_ber.dta.nc" lwdn_ber)

This generates an output file of correct size. For some periods (days) data are correct, but there
are also periods, where every fourth dataset is filled with missing values.

Does anyone have an idea, what I am doing wrong?

Best,
Martin Schmidt

--
Fabian Lienert                  |  Canadian Centre for Climate Modelling and Analysis
PhD Student                     |  Meteorological Service of Canada
phone: +1(250)721-7211          |  University of Victoria
cccma-student-003@xxxxxxxx      |  P.O. Box 1700
http://www.cccma.bc.ec.gc.ca    |  Victoria, BC,  V8W 2Y2, Canada


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement