[Thread Prev][Thread Next][Index]

Re: [ferret_users] Extrapolate over land.



HI, All
Thanks for your kind help. I could use your points to fulfill the need.

On Thu, Feb 18, 2016 at 6:17 AM, Ansley C. Manke <ansley.b.manke@xxxxxxxx> wrote:
Hi,
I imagine that a better answer would be to find a dataset that has wind values over land. 

However you asked about the arguments to FILL_XY.  Here is the documentation for the function. 
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/appendix-a-external-functions/fill_xy

 Often you can "ask Ferret" what it's doing - Make a set of plots to show you the result of changing the argument.

yes? use coads_climatology
yes? let mask = 0*missing(uwnd,0)+1

! show the original data, then filled with different values of N

yes? set view ul; shade/title="uwnd, no filll"/x=60:170/y=-40:0/l=1 uwnd; go land

yes? let wx = fill_xy(uwnd,mask,1)
yes? set view ur;  shade/title="fill, cycle=1"/x=60:170/y=-40:0/l=1 wx; go land

yes? let wx = fill_xy(uwnd,mask,2)
yes? set view ll;  shade/title="fill, cycle=2"/x=60:170/y=-40:0/l=1 wx; go land

yes? let wx = fill_xy(uwnd,mask,4)
yes? set view lr;  shade/title="fill, cycle=4"/x=60:170/y=-40:0/l=1 wx; go land



On 2/16/2016 9:44 PM, Sangeeth M wrote:
Hi Martin,
Thanks for your detailed reply. I am trying to use the COADS monthly climatology data for forcing my model and you are absolutely right that model needs reasonable values over the land preferably the values extrapolated from ocean. I will try with your tips and inform you. I have one more doubt that, the third argument of the fill_xy function, how can I decide the proper value for it?

On Wed, Feb 17, 2016 at 2:43 AM, Martin Schmidt <martin.schmidt@xxxxxxxxxxxxxxxxx> wrote:
Sangeeth,
which data are you using? If they are defined on a regular grid there are also grid points over land. I guess, the data are set to "missing" there. This may confuse your ocean model, since the "missing" may be interpreted as some valid number, say some really high wind speed. This could crash the model. If you interpolate such data onto your model grid the missing values have to be considered carefully.

So you may want to replace the missing values by some reaonable number, say 0, before you interpolate or read the data into your model. This is simple.

use your_file.nc

let wx = missing(windx,0)
let wy = missing(windy,0)

save/file=your_new_file.nc/clobber wx, wy

I expect the data set is large.  So you may want to save time step by time step or allocate more memory:
sp rm your_new_file.nc
repeat/l=1:some_large_number  save/append/file=your_new_file.nc wx, wy

This shows the principle. Getting the number of time steps is easy, just issue "show data". You may also read the maximum number of time steps from the data set, but I recommend to read through the manual and the tutorial anyway.

Recent versions of ferret write real*8 output. To save disk space you may specify

save/file=your_new_file.nc/clobber/outtype=float wx, wy

This may solve your problem. But I guess, your input data need interpolation to the model grid. Having zeros there, leads to reduced winds near the coast with a lot of consequences for near-shore currents.

So you need to make a decision what to do with coastal points:
- set the winds to some reasonable value for land points. How to, just described...
- extrapolate the ocean values into land, before you interpolate onto the model grid. ferret has nearest neighbour fillers @fnr but these are working only in one direction. See the manual. An alternative is fill_xy, which extrapolates into land by replacing land with averages over all valid neighbour points. Doing this repeatedly may give very smoothed extrapolation. Especially, value may never run away. This sounds difficult, but is simple. Use the coads winds as example

yes? use coads_climatology
! the function needs a mask, that is 1, where filling is allowed. Below we generate a field on the wind grid that is 1 everywhere.
yes? let mask = 0*missing(uwnd,0)+1
yes? let wx = fill_xy(uwnd,mask,1)                     ! fill in one cycle only

yes? shade /l=1 wx

shows the wind field, where one coastal point is filled. Now you may play around with the number of cycles:
yes? let wx = fill_xy(uwnd,mask,5)                     ! fill now in five cycles
yes? shade /l=1 wx

I think this shows the ideas and I hope this helps to get you started.

Greetings,
Martin




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

Privacy Policy | Disclaimer | Accessibility Statement