[Thread Prev][Thread Next][Index]

Re: [ferret_users] different results from Ferret and Matlab




Hi Russ,

Really, thank you for the detailed explanations. I believe this would help others also.

Best regards,
Fisseha


--- On Mon, 2/4/13, Russ Fiedler <russell.fiedler@xxxxxxxx> wrote:

From: Russ Fiedler <russell.fiedler@xxxxxxxx>
Subject: Re: [ferret_users] different results from Ferret and Matlab
To: "FISSEHA G. BERHANE" <fishcivilmu@xxxxxxxxx>
Cc: ansley.b.manke@xxxxxxxx
Date: Monday, February 4, 2013, 6:31 PM

(cc'ing you on this, Ansley, just to make sure I have it right)

Hi Fisseha,

I think what you want to do is a bit tricky in Ferret.
I was going to suggest that you supply a 'bounds' variable which
encloses the daily data, however Ferret doesn't handle jumps in the
axes.

http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/data-set-basics/NETCDF-DATA#_VPID_41

See section 2.2.3

"The CF standard allows for axes in a file that may have discontiguous
bounds (the upper bound of one cell is not the same as the lower bound
of the next cell). Ferret does not allow such an axis. When
discontiguous bounds are encountered in a file, we arbitrarily choose to
use the lower bounds throughout, with the upper bound of the topmost
cell to close the definition. This way all axes have contiguous upper
and lower bounds. A warning message is issued."


I think the easiest method would be to create a continuous daily axis
from 1998 to 2012 and map using the @XACT regridding. You should get
missing values for the rest of the year.

def
axis/t="01-JUN-1998":"30-SEP-2012":1/units=days/t0="make_sure_this_is
the_same_as_TDAY" tnew

let pre_xy=pre[x = x1:x2@ave,  y = y1:y2@ave]
let pre_xy_new=pre_xy[gt=tnew@XACT]
plot pre_xy_new ! Check should have missing values
let pre_xyt=pre_xy_new[l=@ave]
list pre_xyt


(Alternatively you could get the continuous time axis from the original
file and use the @XACT regridding to it).

Cheers,
Russ



On Mon, 2013-02-04 at 16:57 +1100, FISSEHA G. BERHANE wrote:
> Dear Russ,
>
> Thank you so much. As you mentioned, show grid pre shows an "i" with
> time as shown below.
> The data is summer (June-September) rains extracted from a whole year
> file. When I plot a time series over my region of study, it is
> expected to be missing data for all months excluding the summer, but
> the plot is not like that. What is happening and how can I fix it?
>
>
>  GRID GTA1
>  name       axis              # pts   start                end
>  LONGITUDE LONGITUDE         1440mr   0.125E               0.125W
>  LATITUDE61_340 LATITUDE      280 r   34.875S              34.875N
>  normal    Z
>  TDAY      TIME              1830 i   01-JUN-1998 00:00    30-SEP-2012
> 00:
>
> Thank you,
> Fisseha
>
>
> --- On Mon, 2/4/13, Russ Fiedler <russell.fiedler@xxxxxxxx> wrote:
>         
>         From: Russ Fiedler <russell.fiedler@xxxxxxxx>
>         Subject: Re: [ferret_users] different results from Ferret and
>         Matlab
>         To: "ferret" <ferret_users@xxxxxxxx>
>         Date: Monday, February 4, 2013, 12:10 AM
>         
>         
>         Hi,
>         
>         Check that the time axis really is regular by checking the
>         grid
>         
>         SHOW GRID pre
>         
>         You should get output with a lower case "r" after the number
>         of points
>         e.g.
>         
>         yes? show grid lsp     
>             GRID GEK1
>         name       axis              # pts   start                end
>         XT_OCEAN  LONGITUDE          240mr   0E                   1.5W
>         YT_OCEAN  LATITUDE           103 r   76.5S
>         76.5N
>         normal    Z
>         TIME      TIME              2920 r   01-JAN-1991 03:00
>         01-JAN-1992
>         00:00
>         
>         
>         If it is an "i" then there is something possibly wrong with
>         the time
>         axis.
>         
>         Another test would be to break up the calculation into the
>         spatial and
>         temporal averages.
>         
>         let pre_xy=pre[x = x1:x2@ave,  y = y1:y2@ave]
>         let pre_xyt=pre_xy[l=@ave]
>         list pre_xyt
>         
>         Also it useful if you let people know the version of Ferret
>         that you are
>         using. There was an old buggy version from a few years back
>         that
>         performed area integrals incorrectly. I doubt if this is the
>         case here
>         but it still helps to eliminate the possibility that it's a
>         known (or
>         related) bug.
>         
>         Cheers,
>         Russ
>         
>         
>         
>         On Mon, 2013-02-04 at 13:17 +1100, FISSEHA G. BERHANE wrote:
>         > Dear William thank you a lot for your tips.
>         >
>         >
>         > The data I have is daily concatenated precipitation of 1830
>         days.
>         >
>         > When I use "list pre[x = x1:x2@ave,  y = y1:y2@ave,
>         l=@sum]/1830"
>         > gives the same answer with Matlab but when I use "list
>         > pre[x=x1:x2@ave,y=y1:y2@ave, l=@ave]" , it gives a much
>         smaller value.
>         > Any one who can help with why this is happening would be
>         highly
>         > appreciated as it helps me to know which kinds of analyses
>         are handled
>         > in what why in ferret.
>         >
>         >
>         > Thank you,
>         > Fisseha
>         >
>         >
>         > --- On Sun, 2/3/13, William S. Kessler
>         <william.s.kessler@xxxxxxxx>
>         > wrote:
>         >         
>         >         From: William S. Kessler
>         <william.s.kessler@xxxxxxxx>
>         >         Subject: Re: [ferret_users] different results from
>         Ferret and
>         >         Matlab
>         >         To: "FISSEHA G. BERHANE" <fishcivilmu@xxxxxxxxx>
>         >         Cc: "Ferret" <ferret_users@xxxxxxxx>
>         >         Date: Sunday, February 3, 2013, 1:37 AM
>         >         
>         >         
>         >         On Feb 2, 2013, at 9:23 PM, FISSEHA G. BERHANE
>         wrote:
>         >         
>         >         > Dear Ferreters,
>         >         >
>         >         > I have daily precipitation data over a given
>         geographic
>         >         location. I am getting different mean values of the
>         data in
>         >         Ferret and in Matlab (5.7mm/day and 7.0 mm/day,
>         respectively).
>         >         Which is correct, may some one help me with what is
>         the cause
>         >         of the difference?
>         >         >
>         >         > Thank you,
>         >         > Fisseha
>         >         
>         >         Are the timesteps regular? Ferret will recognize if
>         they are
>         >         not, and @ave will correctly weight the time ranges.
>         >         
>         >         Try plotting the time series with each tool (with
>         the same
>         >         plot ranges and aspect ratio). Are there
>         differences?
>         >         
>         >         With a simple time series like this, you could
>         simply list a
>         >         small subset of values (say 10). Compute the mean by
>         hand,
>         >         then (over the same time range) from Ferret and
>         Matlab. Are
>         >         these 3 identical? If not, can you see the problem
>         looking at
>         >         a manageable number of points?
>         >         
>         >         BK
>         
>         
>         



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

Privacy Policy | Disclaimer | Accessibility Statement