Open DavidWang505 opened 3 years ago
Hi @DavidWang505, Would you mind pointing me to the source code you were looking at? I can't find the code myself based on the information here or in the prior issue from 2017, but would like to take a closer look at it.
Hi @DavidWang505, Would you mind pointing me to the source code you were looking at? I can't find the code myself based on the information here or in the prior issue from 2017, but would like to take a closer look at it.
The code can be found in the DCOMPUTEUVMET subroutine in the wrf_user.f90 FORTRAN code. https://github.com/NCAR/wrf-python/blob/develop/fortran/wrf_user.f90. Is this what WRF-Python uses to turn grid-relative winds into earth-relative winds?
Hi @DavidWang505, I have created a pull request that should address this issue. If you would like to take a look at the changes and test them with your code, the PR has been linked/mentioned above this comment!
Hi @michaelavs ,
I did a test before by plotting the WRF-Python-derived earth-relative winds (using 'uvmet') to that manually derived using David Oven's suggested equations (https://www-k12.atmos.washington.edu/~ovens/wrfwinds.html). I didn't see any noticeable differences between the two, so I guess the 'uvmet' function in my build of WRF-Python was actually rotating the winds from grid-relative to earth-relative OK. Sorry I didn't let you know about this earlier. Perhaps WRF-Python calculates the angle terms (i.e, longca, longcb) a bit differently than WRF itself (the cosalpha and sinalpha fields) so that even though the signs of the equations are different, they ultimately produce the same results. I wasn't really sure about this, so that's why I asked.
I can't access the actual FORTRAN source codes via my build of WRF-Python, as the FORTRAN codes are compiled into a .pyd file named _wrffortran, which I don't know how to open to see the codes inside.
I was also wondering if the wind rotation process in WRF-Python's 'uvmet' can be simplified into just using David Oven's suggested equations since the cosalpha and sinalpha terms are usually given in WRF outputs by default?
Hi,
I am a WRF-python user. I was wondering what equation WRF-python uses in dcomputeuvmet to derive the earth-relative wind components from the grid-relative winds? It seems from the source code that it uses the following:
uvmet(i,j,1) = vlongcb + ulongca # I believe this is the u-earth component uvmet(i,j,2) = vlongca - ulongcb # I believe this is the v-earth component
where,
longcb = longcaconerpd longca = COS(longcb) longcb = SIN(longcb)
However, from David Oven's website, he says that the correct formula are the following:
Uearth = Ucosalpha - Vsinalpha Vearth = Vcosalpha + Usinalpha
and that 'NOTE: this is the correct version of these equations. Some sources on the Web incorrectly reverse the signs on the sinalpha terms.'
This seems to suggest the formula in the WRF-Python internal dcomputeuvmet is incorrect? Sorry, I am quite confused now.
Related to this post https://github.com/NCAR/wrf-python/issues/13. Bill also suggests using:
u_earth = u COSALPHA - v SINALPHA v_earth = v COSALPHA + u SINALPHA
Any advice would be appreciated,
David