Hi Simon,
The problem is that you aren't mapping the variables between grids explicitly. Ferret is making its best guess (hence the warning about ambiguous grids) but not making the right choice. The repeated changing of regions is also confusing, especially the time index. The region is only evaluated when making the plot so your first set/region does precisely nothing.
When defining variables from a combination of sources make sure that the grids are compatible.
So rather than
let rf_100 = rainfall[d=1] * mask1
you should use (assuming the mask is time invariant)
let rf_100 = rainfall[d=1,gxy=mask1]*mask1[l=1] ! put on the topography grid
or
let rf_100 = rainfall[d=1]*mask1[gxy=rainfall[d=1],l=1] ! put on the rainfall grid.
If the grids are aligned but of different sizes then the @NRST regridding is possibly the most appropriate transform.
I'd also omit the set region statements and plot things explicitly. Setting regions when you have mixed grids often leads to problems and it's
probably best not to get into the habit of automatically setting regions unless you are sure that it's safe and that you cancel the region as soon as it's not needed.
plot/x=74E:81E/y=8N:15N/l=1:365 rf_100[x=@ave,y=@ave]
Cheers,
Russ
On 17/10/15 22:10, simon EK wrote:
SimonRegardskindly help.I could not much understand the errors.(the journal file and the errors & warnings are listed below:Dear Andre/ ferret users,I downloaded .25x.25 grid topography dataset and tried with one mask as adviced by you::
!====================================================================
!topo-rf.jnl
!====================================================================
use spi-rf.nc ! Rainfall data on .25x.25 grid - variable name 'rainfall'
set region/x=74E:81E/y=8N:15N/l=1:365 ! selected 365 days data from ~ 100 years data
use elev.0.25-deg.nc ! elevation on .25x.25 grid - variable name 'data'
set region/x=74E:81E/y=8N:15N/l=1
let mask1 = IF (data GE 0 AND data LT 100) THEN 1 else 1/0
let rf_100 = rainfall[D=1] * mask1
plot rf_100[x=@ave,y=@ave,l=1:365] ! plotting 365 days xy spacially averaged data
!====================================================================
Error
yes? go topo-rf.jnl
use spi-rf.nc ! Rainfall data on .25x.25 grid
set region/x=74E:81E/y=8N:15N/l=1:365 ! selected 365 days data from ~ 100 years data
use elev.0.25-deg.nc ! elevation on .25x.25 grid - variable name 'data' - got dataset from site.
*** NOTE: Axis coordinates are decreasing-ordered. Reversing ordering for axis lat
set region/x=74E:81E/y=8N:15N/l=1
let mask1 = IF (data GE 0 AND data LT 100) THEN 1 else 1/0
!let mask2 = IF (data GE 100 AND data LT 500) THEN 1 else 1/0
let rf_100 = rainfall[D=1] * mask1
!let rain_500 = rainfall * mask2
plot rf_100[x=@ave,y=@ave,l=1:365]
*** NOTE: Ambiguous coordinates on X axis: RAINFALL[D=1] * MASK1
*** NOTE: Ambiguous coordinates on Y axis: RAINFALL[D=1] * MASK1
*** NOTE: Ambiguous coordinates on T axis: RAINFALL[D=1] * MASK1
**ERROR: inconsistent sizes of data regions: X axis
MASK1 has 28 points (I=297:324)
_expression_ has 29 points (I=31:59)
plot rf_100[x=@ave,y=@ave,l=1:365]
Command file, command group, or REPEAT execution aborted
yes?
=================================================================
On Sat, Oct 17, 2015 at 9:58 AM, simon EK <simonambat@xxxxxxxxx> wrote:
SimonRegardsThanking you so much,(The rainfall data is on 1/4 deg xy grid with daily data for about 100 years).Can you please help me in regridding 1 minute grid to 1/4 (0.25) deg as in rainfall data.Dear Andre,I saw the mail of Jorg and got the background information. Now I have to regrid the topo data to 1/4deg as in the rain data and proceed with the masking as clearly given in your mail.
On Fri, Oct 16, 2015 at 10:04 PM, Andre Paim <paim.oceano@xxxxxxxxx> wrote:
Did you see Joerg's answer in you other e-mail? If you manage to have both data sets on the same grid, this should be easy enough to go from there.
About the masking, you would need to do something like:(assuming you have topography variable called "topo")
let mask1 = IF (topo GE 0 AND topo LT 100) THEN 1 else 1/0let mask2 = IF (topo GE 100 AND topo LT 500) THEN 1 else 1/0
Then you need to create a new variable containing only the data in the level you want:(assuming a variable called "rain")
let rain_100 = rain * mask1let rain_500 = rain * mask2
Now all you need to do is compute your average anyway you want.
Let me know if you have more questions.
Best regards,Andre
On 16 October 2015 at 05:38, simon EK <simonambat@xxxxxxxxx> wrote:
SimonRegardsCan you pl. help me?I have seen certain ferret scripts using masking, etc.and above 1000 meters.500 to 1000 meters100 to 500 meters0 to 100 metersI would like to study the impact of altitude on rainfall. Hence I would like to get spacial averages of rainfall over different altitude regions, sayI have a topography dataset with 1 minute resolution.Dear Ferret users,I have a daily rainfall dataset on .25x.25 grid and