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

Reading data from netcdf file to use in the WRF modules

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.


New member
I want to add some new variable in the WRF and calculate roughness length over the sea. Actually I want to modify a script (I don't know which script in the WRF is better for this purpose but I used solve_em.F) to read some variables every 30 minutes and take them to a modified surface layer to calculate surface roughness.
I defined my new variables in Registery:
state real HWAVE ij misc 1 - i012rhd "HWAVE" "SEA SURFACE WAVE HEIGHTS" "m"
state real LWAVEP ij misc 1 - i012rhd "LWAVEP" "SEA SURFACE PEAK WAVE LENGTH" "m"
state real PWAVE ij misc 1 - i012rhd "PWAVE" "SEA SURFACE PEAK WAVE PERIOD" "s"

Then I interpolated new variables (which I downloaded from ERA5 dataset) on WRF grids and save it in NC file using NCL and then modify solve_em.F to read data from this NC file. But now when I want to assign these values to the defined variables in the WRF, I see that the dimensions of variables in the surface layer schemes ate different.
I interpolated data on "ids, ide, jds, jde" but modules in WRF read data on "ims, ime, jms, jme".
I don’t know what is "ims, ime, jms, jme" and how to convert dimensions of new variables to these dimensions.
I want to know how to solve this problem? And is the method I used to read new data in the WRF modules correct?


I would suggest that you take a look at the option "sst_update". Please pay attention to how SST (and other data like seaice, lai, etc.) are defined in Registry and saved in wrflowinp file. You can follow the same way to read and update your data over the ocean.

Note that "ids, ide, jds, jde" are the dimensions of the entire WRF domain. "ims, ime, jms, jme" are related to domain decomposition when we run WRF in parallel mode. Please take a look a the document for detailed description:
Hi Ming Chen
Thank you for your reply. It was very helpful for me.
I added the wave parameters to initial (auxinput4) file in the Registry and those were added to wrflowinp file after running real.exe.

Please take a look at the codes: phys/module_surface_driver.F, which is the main codes to update sst during the integration.