Using wrf_user_interp3d with large # of vertical grid points

The NCL graphics package.

Using wrf_user_interp3d with large # of vertical grid points

Postby LarissaR » Tue Oct 18, 2016 4:28 pm

This is a pro tip suggestion in case others out there ever run in to problems with this function.

When using the wrf_user_interp3d function to interpolate 3-D arrays in to 2-D vertical cross sections, the function decides for you that you only want to interpolate to 100 evenly-spaced points in the vertical. In V6.3.0, that happens on line 382 in WRFUserARW.ncl

Code: Select all
dz = 0.01 * z_max

So, if your model top is, say, 22,000 m (22 km), your data will be interpolated to points every 220 m in the vertical. This can be problematic, especially if you have lots of grid points in the vertical (I personally run at 50m grid spacing in the lowest 1500m). In the case that your original vertical grid spacing in the area of interest is < 1% of your model top, you will experience significant degradation of data resolution. Luckily, the fix is simple! You can increase the number of grid points by 10 or 100 fold without much additional computational time required. Just change the above line of code to

Code: Select all
dz = (1/1000) * z_max

for 1000 grid points or

Code: Select all
dz = (1/10000) * z_max

for 10,000 points.

This simple change should result in improved representation of the data, especially in the boundary layer where grid points are normally more closely packed.

If you don't have root access to your NCL build, such as the case where NCL is installed on a central location on an offsite server or cluster (i.e. Yellowstone or some other supercomputer), you can copy $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl to somewhere on your home directory, modify it, then load that file at the beginning of your cross section code like:

Code: Select all
load "[your home directory]/WRFUserARW.ncl"

instead of
Code: Select all
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

I hope this can help people in the future!
Posts: 4
Joined: Wed Feb 27, 2013 7:10 pm

Re: Using wrf_user_interp3d with large # of vertical grid po

Postby michellgermano » Sat Sep 01, 2018 3:09 pm

Dear Larissa,

I do not know if you'll see it since you posted your solution a long time, but thank you very much for sharing your solution! It helped me a lot!

I'm working with boundary layer processes and I was having trouble to represent the first few meters of the atmosphere. Perhaps, I think your solution should be posted on the INTERP3d function documentation since lots of people are still running into the same problem.

It took me some good hours until I found your solution. Again, thank you for sharing it with the community :D !

Best regards,
Michell Germano
Posts: 1
Joined: Sat Sep 01, 2018 3:02 pm
Location: São Paulo, Brazil

Re: Using wrf_user_interp3d with large # of vertical grid po

Postby pegahfar_naf » Mon Oct 29, 2018 2:14 am

In plotting cross section using angle and pivot point, the number of horizontal points are variable. How to fixed the number of horizontal points to be able to average from various angles?
Posts: 20
Joined: Sat Sep 29, 2018 9:10 am

Return to NCL

Who is online

Users browsing this forum: No registered users and 3 guests