[Thread Prev][Thread Next][Index]

Re: [ferret_users] Extrapolate over land.



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