Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Interpolate WRF data to observational data

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

lquitian

Member
Hi everyone,

I have a txt file with observational 2-metre temperature data (I enclose it here). In it, it is specified the specific lat/lon coordinates, date-time, and 2m temperature values. On the other hand, I have a grid simulated with WRF for the same period and variable. I would need to know the best WRF-NCL function in order to interpolate the WRF lat/lon coordinates to the ones specified in the observational txt file. I have thought about using a neighbor interpolation but I am open to suggestions.

Thanks in advance.

Best regards,
Lara
 

Attachments

  • OBS_BUFR_num_2mT.txt
    13.5 KB · Views: 62
Hi Lara,

If you want to pull out the time series from the wrf data for each lat/lon location you can use this function:

http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_ll_to_xy.shtml

You give the lat/lon you want and it gives you the xy coordinate in the wrf domain where you can then pull the data.

However, if you are wanting to interpolated the data in your text file to be on the same wrf grid, I might recommend looking at the first example on this page:

http://www.ncl.ucar.edu/Applications/rdm2grid.shtml

Let me know if you have more questions.
 
Hi!

Thanks a lot for your help.

The idea would be to obtain the lat/lon coordinates that best match those of the OBS_BUFR data, together with the 2m Temperature (t2) value in that location.

I have taken a look to that function (wrf_user_ll_to_xy). However, I would like to indicate just a pair of lat/lon and not to define a domain, by indicating min and max values as it is specified in the given example:

"Example 1"
minlat = 30
maxlat = 40
minlon = -80
maxlon = -70

opt = True
loc = wrf_user_ll_to_xy(a,(/minlon,maxlon/),(/minlat,maxlat/),opt)


Moreover, I would like to obtain the value of t2 in that lat/lon location and not to define a subdomain, as it is specified in the given example:

;---Just for fun, pick a variable and take a subdomain of it.
tc2 = wrf_user_getvar(a,"T2",0) ; T2 in Kelvin
printMinMax(tc2,0)

tc2_sub = tc2(loc(1,0):loc(1,1),loc(0,0):loc(0,1))
tc2_sub@description = tc2@description + " (subdomain)" ; just an example
printMinMax(tc2_sub,0)


Do you know how to obtain that?

Thanks in advance.

Best regards,
Lara
 
Top