Belgingur / WrfUtils

Utilities for working with wrfout files.
Other
3 stars 0 forks source link

Elevator interpolating pressure to pressure levels is not constant #20

Closed olafurrognvaldsson closed 4 years ago

olafurrognvaldsson commented 4 years ago

When testing the latest version of WrfUtils I noticed that the pressure variable is neither constant in time nor space when data is being interpolated to constant pressure levels.

Screen Shot 2019-12-31 at 11 18 14

The plot above shows an example of this, top shows a time-series for the geopotential height at 900hPa and the bottom shows a time-series (from the same location) of pressure. The bottom plot should show a flat line (more or less) and the value should be 90000 Pa, and not 900 Pa.

logi commented 4 years ago

The easiest part of this is that the unit for pressure should be hPa and not Pa.

logi commented 4 years ago

@olafurrognvaldsson how does this look for a pressure lower than 900hPa? Could this be the terrain blowing through the pressure level?

olafurrognvaldsson commented 4 years ago

@logi what should I be looking at :)

logi commented 4 years ago

Click the bottom_top value in ncview and it'll show a different vertical level.

Meanwhile I've realised that I was testing this with a tiny file and might not have any visible variability in it so I'm re-running with a 1.4GB africa-50 file.

logi commented 4 years ago

This is what I see at the 500hPa level, so it looks pretty constant except that it's constant at 514.3 - 514.4 hPa instead of 500 hPa.

mynd mynd mynd

olafurrognvaldsson commented 4 years ago

Does the geoponential_height have the same shape in this particular point (like it did for my test case)?

logi commented 4 years ago

Geopotential height in 500hPa mynd

Geopotential height in 750hPa. You can see the highest mountains as a few individual pixels (disabling interpolation in image) mynd

Geopotential height in 900hPa. A lot of the continent sticks out mynd

olafurrognvaldsson commented 4 years ago

No I meant how does the time-series for geopotential_height for point (3, 145, 43) look like?

logi commented 4 years ago

Ranges from 5620m to 5645m mynd

olafurrognvaldsson commented 4 years ago

Can you re-run the elevator script and add variables P and PB to the output file and make it available somewhere so that I can open it?

logi commented 4 years ago

sleggjan:~logi/wrfout-africa-pressure.nc4 should be ready in 10 seconds

olafurrognvaldsson commented 4 years ago

Stuck in a skype-meeting. Will take a look in 20-30 min

logi commented 4 years ago

The interpolation of geopotential_height to height above sea-level is very precisely constant and I would expect the pressure variable to be about as constant when interpolated to pressure levels. I'm going to read through some code to see if it makes any sense.

logi commented 4 years ago

OK, I've found a bug. The interpolation constants for vertically staggered or unstaggered variables are created for pressure levels from (P+PB)/100 like for heighht fro m(PH+PHB)/g but the latter is vertically staggered while the former is not, so the interpolation is slightly wrong which would explain the 514hPa issue. The 14hPa is presumably half a sigma level and varies slightly.

logi commented 4 years ago

With that fix (not committed) mynd

logi commented 4 years ago

@olafurrognvaldsson I believe this task is done and have moved it to the Done column. If you try "your thing" again and it looks correct, please close the issue.

olafurrognvaldsson commented 4 years ago

@logi should I update my WrfUtils repo? I.e. has the fix been committed ?

logi commented 4 years ago

Yup. You can also see the commit just above here as mynd

olafurrognvaldsson commented 4 years ago

Looking good, case closed !!