[Thread Prev][Thread Next][Index]

Re: [ferret_users] question of filled region

Peter gave some ideas, but I just want to add some more discussion. The general technique is masking, where you somehow create a mask variable whose value is 1 in  the region where you want to do something, and missing elsewhere.  Another example is in this FAQ,
Averaging/integrating over irregular regions in Ferret at http://ferret.pmel.noaa.gov/FERRET_17sep07/FAQ/analysis/avg_integ_irreg.html

We don't have a a general way to create a mask that picks out the points inside a national boundary or other general curve. You could start with a topography dataset and regrid that to the grid of your data, and create a land-only mask in the general region of China.  Here is how to make first a land mask over the whole globe, then a rectangular mask that contains China:
yes? use etopo20
yes? use my_data

 !  first, try a land mask to see how that works:
yes? let land_mask = if rose[d=1,gxy=my_var[d=2] ] GT 0 then 1  
yes? let my_var_land = land_mask * my_var[d=2] 
yes? shade my_var_land

 ! Make a rectangular region mask
yes? let xx = x[gx=my_var]
yes? let yy = y[gy=my_var]

yes? let region_mask1 = if xx gt 70 then 1
yes? let region_mask2 = if xx lt 150 then 1

yes? let region_mask3 = if yy gt 20 then 1
yes? let region_mask4 = if yy lt 55 then 1

yes? let region_mask= region_mask1 * region_mask2* region_mask3* region_mask4
yes? shade/x=70:150/y=20:55 region_mask * my_var

 ! Overlay land outlines showing national boundaries
yes? go land 1 overlay 2

Now you can see that what you want is a mask which is 1 at each grid point inside the boundary of China. This is not something that we have a method for though.


xhbhyq11 wrote:
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!


穿 越地震带 纪念汶川地震一周年

[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement