[Thread Prev][Thread Next][Index]
Re: [ferret_users] question of filled region
- To: xhbhyq11 <xhbhyq11@xxxxxxx>
- Subject: Re: [ferret_users] question of filled region
- From: Peter Szabo <szabpet83@xxxxxxxxx>
- Date: Thu, 21 May 2009 15:51:43 +0200
- Cc: ferret_users <ferret_users@xxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=ocUzwCCUtdrE41ArUiTEL1NfSmYjgymSsD7sWZbWZfk=; b=XEFNkqDEcJtb8FRUciEnCz98XHhqNawUBo2RBBl1z2I/AOZt1crJsMFU/Ru2Yvi761 IF3JfJaYk4qFaYxJOzmtU4Fip3cziotUAaAMNS7HM2OnQFFh6775uuCCnDV7DCTsffF5 UPWjuKhVHCWJqaCxAMfk1YybBngg7kmn9YiLU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=ikm3PC/+nHs7W6ys70GfMqjxiA67Vj/u/jLOiBtGz+MUzuvvjFQdDa56nquPT/cGRX TplymYWOmji689TdXLX6PzIEIdFJDstHtklJwvS88YGtcS73dvgVQz3mAkGH+dvqbRzm ZfrGlzJtUCVAwGk7PwnnL0pfTZMNPOKPdQSa8=
- In-reply-to: <31545478.452681242898978185.JavaMail.coremail@xxxxxxxxxxxxxxxxxxx>
- References: <31545478.452681242898978185.JavaMail.coremail@xxxxxxxxxxxxxxxxxxx>
- Sender: owner-ferret_users@xxxxxxxx
Hello Xhb,
i am doing masking with a fortran code (if you have the coordinates for the border of China), but you can do that also in ferret. Though its more complicated.
The methodology: you need to have a rectangle over China, then use IF conditions to decide whether the grid cell is out of China or not, finally apply that mask on your global data.
I am showing how i did this earlier (after some mailing-list help) for Hungary.
1) this is the rectangle with the grid cell size and define the points in there
let xlo=16.75
let xhi=22.75
let dx=0.5
let ylo=46.25
let yhi=48.25
let dy=0.5
let xpts=x[x=`xlo`:`xhi`:`dx`] + 0*y[y=`ylo`:`yhi`:`dy`]
let ypts=0*x[x=`xlo`:`xhi`:`dx`] + y[y=`ylo`:`yhi`:`dy`]
2) x21 is my variable and nothere is used for points outside of China (missing)
let nothere=`x21,r=bad`
3) use IF conditions to decide wether a point is in the interested region.
let x1=if x[gx=xpts] le 16.75 and y[gy=xpts] le 46.25 then nothere else xpts
let x2=if x[gx=xpts] ge 20.25 and y[gy=xpts] le 46.25 then nothere else x1
let x3=if x[gx=xpts] le 19.25 and y[gy=xpts] ge 48.25 then nothere else x2
let x4=if x[gx=xpts] ge 21.75 and y[gy=xpts] le 46.75 then nothere else x3
let x5=if x[gx=xpts] ge 22.25 and y[gy=xpts] le 47.25 then nothere else x4
let x6=if x[gx=xpts] ge 22.75 and y[gy=xpts] le 47.75 then nothere else x5
let y6=x6*0+ypts
4) make this 1 dimensional, select the good points and have the variable only with the points of interest. now you can contour etc.
let xpts_1d=xsequence(x6)
let xpts_comp=compressi(xpts_1d)
let xpts_good=xpts_comp[i=1:`xpts_comp[i=@ngd]`]
let ypts_1d=xsequence(y6)
let ypts_comp=compressi(ypts_1d)
let ypts_good=ypts_comp[i=1:`ypts_comp[i=@ngd]`]
let hupoints21=samplexy(x21,xpts_good,ypts_good)
Basicaly the 1) and 3) should be different for you.
If the question is simpler, the answer is also (i mean if you want to fill a rectangle and not using a mask).
Hope, this is what you wanted :)
Have a nice day,
Peter
2009/5/21 xhbhyq11
<xhbhyq11@xxxxxxx>
Hi :
I want to fill only in China, but my data is global. How can I do to fill value only in China?
Thanks in advance!
Xhb
2009.05.21
穿越地震带 纪念汶川地震一周年
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Privacy Policy | Disclaimer | Accessibility Statement