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

Please help! WRF-python MYNN TKE budget extraction

zhw

New member
Dear Users,

I hope you're doing well.

I am using the em_real configuration with the MYNN in WRF. In my namelist.input, I have set the following:


bl_mynn_tkebudget = 1, 1, 1, ! Export components of TKE budget
bl_mynn_tkeadvect = .false., .false., .false., ! Disable TKE advection in the MYNN scheme

Is there a way to extract the tkebudget information using WRF-Python? If existing Python code examples are available, I would greatly appreciate your guidance.

Thank you!

Best regards,
zhw
 
As long as the variable name exists in your wrf output file you can use the wrf.getvar command in wrf-python to extract it.
Dear Sir

I tried to extract TKE directly using tke = getvar(ncfile, "tke", units="m2s-2") in wrf-python.

It gave an error:
raise ValueError("'{}' is not a valid variable name".format(varname))
ValueError: 'tke' is not a valid variable name.

May I know if you know how can I extract the tke values out?

Thank you for your help in advance!

best regards
 
@zhw
Please check whether 'tke' is available in your wrfout files. If not, then wrf-python cannot extract this variable.

If you run with mynn, I would suggest that you look at 'qke', which is twice tke. I believe 'qke' should be included in wrfout.

Please let me know if you still have issues.
 
@zhw
Please check whether 'tke' is available in your wrfout files. If not, then wrf-python cannot extract this variable.

If you run with mynn, I would suggest that you look at 'qke', which is twice tke. I believe 'qke' should be included in wrfout.

Please let me know if you still have issues.
Dear Sir,

Thank you for your suggestions! I still face the problem that eke is not a valid variable name problem.May I know how I can check if 'qke' or 'tke' is available in my wrf files?
File "tke_sample.py", line 137, in <module>


qke = getvar(ncfile_with_farm, "qke", units = "m2s-2")

in getvar, raise ValueError("'{}' is not a valid variable name".format(varname))

ValueError: 'qke' is not a valid variable name




Thank you for your help!

Best regards
zhw
 
please issue the command:

ncdump -h wrfout_file > log

here wrfout_file should be a single wrfout file from your case.

Then upload your namelist.input and this log file for me to take a look. By the way, which version of WRF did you run?
 
please issue the command:

ncdump -h wrfout_file > log

here wrfout_file should be a single wrfout file from your case.

Then upload your namelist.input and this log file for me to take a look. By the way, which version of WRF did you run?
Dear Sir,

Thank you for your instructions and help! I am able to extract the information out using 'QKE' in capital letters.

I am using WRF 4.3.

Best regards,
zhw
 
Thanks for the update. Many software packages are case sensitive, --- we have to pay attention to such details.
 
Thanks for the update. Many software packages are case sensitive, --- we have to pay attention to such details.
Dear Sir,

I hope this message finds you well. May I know if there is a way to output the number of turbines in a cell grid using WRF-python or any other means? Thank you ! :)

Best regards,
 
This should be doable using NCL or Python. Unfortunately we don't have a sample script to do so at present.

Here is an example to plot station locations using NCL.

wrf-python script can be modified to produce scatter plot, too.
 
Top