Forums (Forecast Builder)

Back

RE: Adding Buttons to Analyze/Adjust Step

MR
Michael Rehnberg, modified 1 Year ago.

Adding Buttons to Analyze/Adjust Step

Youngling Posts: 2 Join Date: 12/16/20 Recent Posts

Hi all,

 

I'm trying to add a local tool to our Analyze/Adjust step in ForecastBuilder.  In the ForecastBuilderNationalConfig file there's documentation on using the varDict['Additional Buttons in Analyze/Adjust Step'] entry to append new tools.  However, when I append a tool inside our SITE-level ForecastBuilderConfig as described in the documentation, all it does is remove some of the other buttons that are supposed to be there, without adding the one I specified.  I am guessing that somehow the addition of the custom tool is failing and preventing additional buttons from being added to the list down the line, but I can't figure out what I'm doing wrong.

For context, I'm using ForecastBuilder v11.0 installed as EXP.  I've enabled the NBM SnowLevel p-type method so my office can experiment with the SnowLevel as Guardrails technique.  I've attached images of what the Analyze/Adjust step looks like with and without the new tool added, and a copy of my ForecastBuilderConfig_EXP file in case someone sees some other conflicting setting I have in my config.  I have confirmed the SmartTool in question works properly if called outside FB.

Any help is appreciated!

 

~Mike

JT
Justin Titus, modified 1 Year ago.

RE: Adding Buttons to Analyze/Adjust Step

Padawan Posts: 33 Join Date: 10/24/15 Recent Posts
Mike, Looks like a syntax issue. I adjusted the config and attached it below...give it a try. Below the section where you add the button I wrote out a syntax guide for calling SmartTools.

Let us know if you need additional support!
Justin Titus
ForecastBuilder Tech Lead
Senior Forecaster
NWS WFO Springfield, MO


On Thu, Dec 21, 2023 at 12:54 PM Michael Rehnberg <VLab.Notifications@noaa.gov> wrote:

Hi all,

 

I'm trying to add a local tool to our Analyze/Adjust step in ForecastBuilder.  In the ForecastBuilderNationalConfig file there's documentation on using the varDict['Additional Buttons in Analyze/Adjust Step'] entry to append new tools.  However, when I append a tool inside our SITE-level ForecastBuilderConfig as described in the documentation, all it does is remove some of the other buttons that are supposed to be there, without adding the one I specified.  I am guessing that somehow the addition of the custom tool is failing and preventing additional buttons from being added to the list down the line, but I can't figure out what I'm doing wrong.

For context, I'm using ForecastBuilder v11.0 installed as EXP.  I've enabled the NBM SnowLevel p-type method so my office can experiment with the SnowLevel as Guardrails technique.  I've attached images of what the Analyze/Adjust step looks like with and without the new tool added, and a copy of my ForecastBuilderConfig_EXP file in case someone sees some other conflicting setting I have in my config.  I have confirmed the SmartTool in question works properly if called outside FB.

Any help is appreciated!

 

~Mike

Virtual Lab Message Boards https://vlab.noaa.gov/web/forecastbuilder/forums/-/message_boards/view_message/34176538VLab.Notifications@noaa.govhttp://vlab.noaa.gov
MR
Michael Rehnberg, modified 1 Year ago.

RE: Adding Buttons to Analyze/Adjust Step

Youngling Posts: 2 Join Date: 12/16/20 Recent Posts

This worked!  Thanks Justin.  And thanks for the additional documentation in the copy you shared with me, it's helpful.

 

 

~Mike

KC
Kirby Cook, modified 1 Month ago.

RE: Adding Buttons to Analyze/Adjust Step

Youngling Posts: 6 Join Date: 9/24/12 Recent Posts

I'm having a similar issue...  we are running FB v 11.3. I've tried to tailor my config entry to match wat Justin posted... and it ultimately clips out most of the buttons on the Analyze/Adjust step. I'm usually missing something that is staring me in the face... and have no doubt this will end up being the case here. Thank you in advance. 

 

Kirby

JT
Justin Titus, modified 1 Month ago.

RE: Adding Buttons to Analyze/Adjust Step

Padawan Posts: 33 Join Date: 10/24/15 Recent Posts
Kirby, I didn't notice anything obvious in your config to cause it to create a problem. If you run your cave session from a terminal with the -noredirect argument, does it give any errors?

Thanks!
Justin Titus
ForecastBuilder Tech Lead
Senior Forecaster
NWS WFO Springfield, MO


On Fri, Mar 7, 2025 at 4:32 PM Kirby Cook <VLab.Notifications@noaa.gov> wrote:

I'm having a similar issue...  we are running FB v 11.3. I've tried to tailor my config entry to match wat Justin posted... and it ultimately clips out most of the buttons on the Analyze/Adjust step. I'm usually missing something that is staring me in the face... and have no doubt this will end up being the case here. Thank you in advance. 

 

Kirby

Virtual Lab Message Boards https://vlab.noaa.gov/web/forecastbuilder/forums/-/message_boards/view_message/43453162VLab.Notifications@noaa.govhttp://vlab.noaa.gov
KC
Kirby Cook, modified 1 Month ago.

RE: Adding Buttons to Analyze/Adjust Step

Youngling Posts: 6 Join Date: 9/24/12 Recent Posts

Hi Justin - 

 

It does indeed throw an error:

 

log_call: 2025/03/10 19:26:52  FBAnalyzeAdjustGUI
analyze/adjust step
log_call: 2025/03/10 19:26:52  analyzeadjust_AddOnButton
Must have at least two elements
log_call: 2025/03/10 19:26:53  analyzeadjust_AddAdjustButton
Exception in Tkinter callback
Traceback (most recent call last):
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/tkinter/__init__.py", line 1892, in __call__
    return self.func(*args)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 1095, in <lambda>
    command=lambda step=currentStep, nextStep=nextStep: self.allStepsDict[
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 219, in runStep
    self.procedure.allStepsDict[nextStep].createGUI(gridDict, varDict)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 144, in createGUI
    self._createGUICall(gridDict, varDict)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2192, in FBAnalyzeAdjustGUI
    self.analyzeadjust_AddAdjustButton(adjustGridsButtons, varDict, "Adjust:")
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2485, in analyzeadjust_AddAdjustButton
    btnName = lst[0]
IndexError: list index out of range


I've stared at this a lot... and can't see what's not right. 

 

MD
Matthew Day, modified 1 Month ago.

RE: Adding Buttons to Analyze/Adjust Step

Youngling Posts: 2 Join Date: 4/26/15 Recent Posts
Comparing what's in the template code to what we have in our config, it looks like the template code has an extra pair of square brackets. So, I tried adding that extra pair of square brackets and it did indeed give me the same error message Kirby is experiencing. So, I think if you take that first / last square bracket out, it should work.

Looking at the procedure code, this matches what I would expect. Now, why this same template worked for Michael--I'm not sure.

--Matthew

On Mon, Mar 10, 2025 at 3:43 PM Kirby Cook <VLab.Notifications@noaa.gov> wrote:

Hi Justin - 

 

It does indeed throw an error:

 

log_call: 2025/03/10 19:26:52  FBAnalyzeAdjustGUI
analyze/adjust step
log_call: 2025/03/10 19:26:52  analyzeadjust_AddOnButton
Must have at least two elements
log_call: 2025/03/10 19:26:53  analyzeadjust_AddAdjustButton
Exception in Tkinter callback
Traceback (most recent call last):
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/tkinter/__init__.py", line 1892, in __call__
    return self.func(*args)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 1095, in <lambda>
    command=lambda step=currentStep, nextStep=nextStep: self.allStepsDict[
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 219, in runStep
    self.procedure.allStepsDict[nextStep].createGUI(gridDict, varDict)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 144, in createGUI
    self._createGUICall(gridDict, varDict)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2192, in FBAnalyzeAdjustGUI
    self.analyzeadjust_AddAdjustButton(adjustGridsButtons, varDict, "Adjust:")
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2485, in analyzeadjust_AddAdjustButton
    btnName = lst[0]
IndexError: list index out of range


I've stared at this a lot... and can't see what's not right. 

 

Virtual Lab Message Boards https://vlab.noaa.gov/web/forecastbuilder/forums/-/message_boards/view_message/43500999VLab.Notifications@noaa.govhttp://vlab.noaa.gov
KC
Kirby Cook, modified 1 Month ago.

RE: Adding Buttons to Analyze/Adjust Step

Youngling Posts: 6 Join Date: 9/24/12 Recent Posts

Thank you Matthew, that did the trick. The button shows up now without wiping out the whole Analyze/Adjust dialog. My issue now (sorry) is I can't get the tool that I want to run from the button to run... 

What I am trying to do it add a button to popululate our FzLevel grids in the Analyze/Adjust Step

 

Here are the varDict entries in ForecastBuilderConfig:

varDict["Parms to Load in Analyze/Adjust"].extend(["FzLevel"])
varDict["Additional Buttons in Analyze/Adjust Step"].append(["Populate FzLevel",["self._FBUtility","callSmartToolFB",["FzLevel","FzLevelCopy","var|gridDict","var|varDict"],]])
 

Here ar the gridDict entries for FzLevel:

gridDef["Freezing Level", "gridName"] = "FzLevel"
gridDef["Freezing Level", "primaryGuidance"] = "CONSAll"
gridDef["Freezing Level", "maxTime"] = 240
gridDef["Freezing Level", "minTime"] = 0


Here is the error that I get -  

ForecastBuilder
Exception in Tkinter callback
Traceback (most recent call last):
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/tkinter/__init__.py", line 1892, in __call__
    return self.func(*args)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2600, in <lambda>
    self["command"] = lambda: self.commandWrapper(varDict, FBcommand)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2614, in commandWrapper
    error_message = command()
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2503, in <lambda>
    FBcommand=lambda arg=action: self.runFunctionsFromButton(arg),
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 6677, in runFunctionsFromButton
    error_code = func(*argList, **kwargList)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/utilities/ForecastBuilderUtility.py", line 29016, in callSmartToolFB
    trList = gridDict[gridID]["trList"]
KeyError: 'FzLevel'
 

It seems like is dying when ForecastBuilderUtility trying to pull the trList for FzLevel... am I missing a gridDef entry? 

 

Thank again for all of the help. 

 

Kirby

 

 

JT
Justin Titus, modified 1 Month ago.

RE: Adding Buttons to Analyze/Adjust Step

Padawan Posts: 33 Join Date: 10/24/15 Recent Posts
Kirby,

Sorry for the delayed response...weather has been crazy busy for the last couple weeks.

Since you defined "FzLevel" to the gridID of "Freezing level" when you defined the parameter, trying using "Freezing Level" in your smarttool call: 

varDict["Additional Buttons in Analyze/Adjust Step"].append(["Populate FzLevel",["self._FBUtility","callSmartToolFB",[ "Freezing Level","FzLevelCopy","var|gridDict","var|varDict"],]])

Justin Titus
ForecastBuilder Tech Lead
Senior Forecaster
NWS WFO Springfield, MO



On Tue, Mar 11, 2025 at 2:58 PM Kirby Cook <VLab.Notifications@noaa.gov> wrote:

Thank you Matthew, that did the trick. The button shows up now without wiping out the whole Analyze/Adjust dialog. My issue now (sorry) is I can't get the tool that I want to run from the button to run... 

What I am trying to do it add a button to popululate our FzLevel grids in the Analyze/Adjust Step

 

Here are the varDict entries in ForecastBuilderConfig:

varDict["Parms to Load in Analyze/Adjust"].extend(["FzLevel"])
varDict["Additional Buttons in Analyze/Adjust Step"].append(["Populate FzLevel",["self._FBUtility","callSmartToolFB",["FzLevel","FzLevelCopy","var|gridDict","var|varDict"],]])
 

Here ar the gridDict entries for FzLevel:

gridDef["Freezing Level", "gridName"] = "FzLevel"
gridDef["Freezing Level", "primaryGuidance"] = "CONSAll"
gridDef["Freezing Level", "maxTime"] = 240
gridDef["Freezing Level", "minTime"] = 0


Here is the error that I get -  

ForecastBuilder
Exception in Tkinter callback
Traceback (most recent call last):
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/tkinter/__init__.py", line 1892, in __call__
    return self.func(*args)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2600, in <lambda>
    self["command"] = lambda: self.commandWrapper(varDict, FBcommand)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2614, in commandWrapper
    error_message = command()
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 2503, in <lambda>
    FBcommand=lambda arg=action: self.runFunctionsFromButton(arg),
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/procedures/ForecastBuilder.py", line 6677, in runFunctionsFromButton
    error_code = func(*argList, **kwargList)
  File "/home/kirby.cook/caveData/etc/site/SEW/gfe/userPython/utilities/ForecastBuilderUtility.py", line 29016, in callSmartToolFB
    trList = gridDict[gridID]["trList"]
KeyError: 'FzLevel'
 

It seems like is dying when ForecastBuilderUtility trying to pull the trList for FzLevel... am I missing a gridDef entry? 

 

Thank again for all of the help. 

 

Kirby

 

 

Virtual Lab Message Boards https://vlab.noaa.gov/web/forecastbuilder/forums/-/message_boards/view_message/43520437VLab.Notifications@noaa.govhttp://vlab.noaa.gov