Welcome to WEAP's Website WEAP
WEAP is an initiative of the Stockholm Environment Institute.


About WEAP

Home
Why WEAP?
Features
What's New?
Sample Screens
Demonstration
Publications
History and Credits

Using WEAP
Download
Licensing
User Guide
Tutorial
Videos (YouTube)

User Forum
Discussions
Members List
Edit Profile

Additional Support
Training
University Courses
Collaboration

About Us
SEI-US Water Resources Program
Please Contact Us

LEAP
Interested in Energy?
Read about LEAP: SEI's software for energy planning.

Link WEAP and LEAP for combined Water-Energy planning.
Watch a video demo!
   

User Forum

All Topics | Topic "Major New Version of WEAP (2021.0)"
Log in to post new messages or reply to existing messages.
 
Author Message
Mr. Jack Sieber

Subject: Major New Version of WEAP (2021.0)   
Posted: 7/18/2021 Viewed: 8248 times
A new version of WEAP is now available, with many new features and bug fixes. It is recommended for all users to get the update. As always, this new version is backwards compatible with data sets developed in earlier versions of WEAP. However, because this version uses different file formats, any data set opened in this version cannot be opened in earlier versions of WEAP.

When WEAP starts, it should automatically find this update and offer to download and install it. If you have a problem with the automatic update, you can download the full installation from https://www.weap21.org/Download There is no need to uninstall your existing version first.

What's New:

7/18/2021, Version 2021.0

- MAJOR ENHANCEMENTS:

- Climate Summary Maps and Charts: WEAP creates thematic GIS layers and charts to show how average climate varies across basin and within year. For an example, see https://www.weap21.org/Downloads/ClimateSummarySacramentoBasin.png
- Much faster: Calculate several scenarios simultaneously, up to the number of CPU cores in your computer.
- Enhanced groundwater modeling: WEAP can now use MODFLOW modules for seawater intrusion (SWI2) and groundwater evapotranspiration (EVT, ETS).
- High-resolution US climate data: historical data at 4 km spatial resolution (GridMET) now included with WEAP.
- Updated, high resolution background map layers from https://www.naturalearthdata.com/
- Extensive additions to Application Programming Interface (API).
- New database file format: WEAP now uses the NexusDB database format for improved reliability.
- New results file format: much smaller and faster to access for viewing results.


- OTHER ENHANCEMENTS:

- SCHEMATIC:

- Show Info for background GIS layers: Right click on a layer in the list of background layers and choose "Show Info" to see detailed information for the feature under the mouse cursor. You can have multiple info windows open at the same time, even for the same layer. The Climate Summary layer shows graphs of the climate averages over the year.
- Thematic maps: Change which variable to use for the thematic map for a layer – right click on the layer in the background layer list and choose "Thematic Map."
- Background GIS line layers: Line layers, such as for rivers or roads, can now use thematic coloring on the Schematic to distinguish differing values.
- Delete all points upstream or downstream of a point on the river: Right click on an existing point in the river and choose either "Delete Upstream Points" or "Delete Downstream Points" to remove all nodes and points upstream or downstream of the point clicked.


- CATCHMENT DELINEATION:

- Climate Summary Map Layers: WEAP will automatically create a map layer that summarizes the climate for each climate grid square in your basin and add it as a background layer on the schematic. The summary includes, for each climate variable, the annual average as well as average for each month. By displaying a summary attribute as a thematic map, e.g., Average July Temperature, you can quickly see how the climate varies across the basin. Right click on the background layer and select Thematic Map to easily change which climate variable is mapped.
- Catchment Climate: The climate CSV file folder now is named according to the source, e.g., ClimateData\PrincetonMonthly or ClimateData\CaliforniaPrism.
- Easier to understand how to set "Year Offset" in the catchment delineation climate source window.
- Some operations in catchment delineation mode much faster: for large model, especially those with many rivers in the background rivers layer, it is now MUCH faster (e.g., 5 seconds instead of 30 minutes!) to delete a basin, change a basin's pour point, or change the level of River Detail for a basin.
- Can now handle high resolution climate tiles for medium and large basins.
- Handle climate NetCDF files that do not include leap days


- EXPRESSIONS/FUNCTIONS:

- Data History report: Choose the History tab in the Data View to see a customizable report of all changes made to the model, including changes to expressions and units, creating new schematic objects and branches, etc. You can filter it to show changes for one or all scenarios, branches, variables or users, or by a range of dates. The report is searchable (type search terms in the edit box below the report) and sortable (click on the column title to sort by that column), and can be saved to a file in Excel, Word, Acrobat, CSV, HTML, XML or text format. See the toolbar to the right of the report for options. Click the funnel icon to be able to filter the report for just those lines that contain the text you type in the edit box below the report.
- New branch functions for expressions: BranchLevel, NumChildren, HasTag. These can be used in a variable's default expression to create different expressions to use depending on branch level or tag.
HasTag example: the default expression for Demand Site Monthly Variation in Weaping River Basin could be set to this:
If(HasTag(Industry), Key\Monthly Variation\Industry,
HasTag(Agriculture), Key\Monthly Variation\Agricultural,
HasTag(Municipal), Key\Monthly Variation\Municipal,
100 * Days / DaysInYear)
- ReadFromFile aggregation methods: Added three new methods for aggregating data, e.g., from daily to monthly: FirstTimestep, MiddleTimestep and LastTimestep. If used, it will get the value associated with the first, middle or last timestep of the period. For example, if the CSV file is daily and the timestep is weekly, and the values for the 7 days of timestep are 2, 3, 5, 7, 11, 13, 17, then the "aggregated" values for the FirstTimestep, MiddleTimestep and LastTimestep methods would be 2, 7 and 17, respectively. If there are an even number of values, then MiddleTimestep will average the two values in the middle. Note: if some values are missing, LastTimestep will be the value from the last timestep that is not missing.
- New expression function: FirstNonZero(Expression1, Expression2, ..., ExpressionN): Return the value from the first expression that is not zero. One use is when climate data could come from one of several CSV files -- this can get the first one that is non-zero. E.g., FirstNonZero( ReadFromFile(HistoricalClimate.CSV, "Precip"), ReadFromFile(NearRealTimeClimate.CSV, "Precip"), ReadFromFile(ForecastClimate.CSV, "Precip") )
- New data variable: reach outflow to groundwater as volume: Previously, river losses to groundwater could only be modeled as a percent of flow. Now they can alternatively be entered as a volume.
- Expressions for instream flow requirements and demands are now allowed to be negative.
- Wastewater Treatment Plant Removal Rate and Outflow Concentration: These can now vary monthly.
- Optional river reach Net Solar Radiation data for water temperature calculation
- Paste array into Monthly Time Series Wizard: you can now paste an array of values, such as from Excel, into the Monthly Time Series Wizard screen.
- Paste Special: WEAP can now handle pasting an unlimited array of numbers from Excel to create a new time series expression. The previous limit was 1000 characters.
- Allow depth units in references to catchment results, e.g., Demand Sites and Catchments\Big Farm:Surface Runoff[mm]
- TotalChildren: Improved TotalChildren function to handle some specific cases that were not handled before.
- Expression Builder: Fixed bug that sometimes caused the Expression Builder to crash when opened.
- Reorder user-defined variable category buttons: If you have defined new categories for user-defined variables, you can change the order of the category. Right click on the category button and choose "Move Right" or "Move Left."
- Import Expressions from Excel: If a variable is marked as read only, you cannot change the expression by importing.
- Improved help in Expression Builder for functions.


- CALCULATIONS:

- Parallel Calculation: When calculating more than one scenario, WEAP can calculate multiple scenarios simultaneously, each in their own separate "instance" of WEAP. When WEAP asks "Do you want to recalculate now," you will have the option to turn on parallel calculation, and to set how many instances to use. (Go to Help, About to see how many CPU Cores your computer has.)
- Improvements to binary result files:
- Optimized for speed in viewing results
- Single precision option (uses half the space as double precision, with little loss of meaningful precision -- still has 7 significant digits). Go to General, Basic Parameters to set. Existing areas default to double precision; new (blank) areas will default to single precision.
- Can calculate up to 2500 years (500-3000)! (previous maximum was 500 years).
- All results for one scenario are now stored in a single binary file (.bin), even if it exceeds 1 GB
- Results for data variables now stored in same binary results files as other results
- Save Only Selected Results: New option: Saving only results used by a specified list of favorites. Go to Edit, Results Variables, Select Results to Save..., and select "Select Favorites to Save". Useful if you have large models but only need results for a small subset (e.g., 30 river flow points out of 3000). This has the possibility to make the results files much, much smaller.
- River seepage losses to groundwater modeled as a demand: To handle cases where the volume of seepage from river to groundwater exceeds the streamflow at that point in the river, WEAP will now model them as demands. Previously, they were constraints in the LP, which led to infeasibility if streamflow was too small, which WEAP handled by reducing seepage from ALL river reaches until the LP was feasible, not just on those reaches at fault.
- Reservoir water quality: "Same as Inflow" can now be used in an expression, e.g., Same as Inflow + 5 will set the reservoir's outflow concentration equal to the inflow concentration plus five.
- New result: Flow from Surface Water to Groundwater (Constrained), Flow from Surface Water to Groundwater (Unconstrained). Unconstrained shows the estimated seepage, constrained shows how much actually seeped. These will be the same, unless the estimated amount (from MODFLOW, the wedge model or entered directly as data) exceeded the streamflow in the reach, in which case the Constrained amount will be reduced.
- New water quality result: "Wastewater Treatment Plant Inflow Water Quality (Mixed)" is the average water quality concentration in the untreated wastewater inflow to a treatment plant, from all sources combined. To get the value using the API, use "Inflow Water Quality," e.g., WEAP.ResultValue("\Water Quality\Wastewater Treatment\West WWTP:Inflow Water Quality[mg/l, WQ Constituent=BOD]", 2010, 8, "Reference")
- Surface water quality calculations: If the streamflow is zero, the temperature or concentration will be set to that of the node or reach upstream.
- River temperature calculation: the lowest tier of the flow-stage-width curve will now be a rectangle instead of a triangle. The triangle was leading to numerical instability when the river stage was very small.
- Water Quality and catchments: concentration data variable is now multiplied by all outflow from catchment: Surface Runoff + Interflow + Base Flow + Flow to Groundwater.
- Fixed bug in calculation for Simple Mixing for reservoirs: reservoir initial condition for water quality concentration was being ignored.
- Faster when using a custom Working directory on a different drive, such as a RAMDisk or fast SSD. Existing binary results files are copied to working directory for faster access. Parallel calculations are done in custom Working directory.
- Increased threshold -- from 20 billion cubic meters to 100 billion -- for calculation warnings of "extremely large values that may cause problems for the linear program solver." Warn not warn if less than 100 billion.


- RESULTS:

- Animated GIFs: When exporting result charts or maps, there is now an option to save to an animated GIF file, to show how the results change over time. For charts, this option is available only if the chart does not have years as the X axis or legend. Examples from Weaping River Basin.: https://www.weap21.org/downloads/Flows.gif https://www.weap21.org/downloads/GroundwaterCellHead3-D.gif https://www.weap21.org/downloads/GroundwaterCellHead2-D.gif https://www.weap21.org/downloads/SupplyRequirementAnimation.gif https://www.weap21.org/downloads/GroundwaterAnimation.gif
- Long form result export to CSV: Save results in a format more suitable to Tableau and other visualization tools, with each result value on a separate line of the CSV file. Click the CSV button to the right of the results table and select "Long format (one value per line)." (You might need to uncheck "ReadFromFile format" first.) This is also available via the WEAP.ExportResults API -- set the 6th parameter to True: WEAP.ExportResults(CSVFilename, IncludeTitle, IncludeColumnTitles, Transpose, ReadFromFileFormat, LongFormat)
- User-defined result variable categories: You may create your own result variable categories for your user-defined result variables. Edit the user-defined variable and in the category dropdown box choose < Edit Categories > to go to the "Manage Result Categories" screen, where you can create new categories and choose where in the results hierarchy to place them.
- New options for "Grp" (Group) button on the chart toolbar: choose how many of the largest values to show; option to not show "All Others" at all; option to show only the smallest values. This last option could be useful for focusing on indicators, such as coverage, where the smallest values are most important.
- Two new color palettes for charts and maps: Moisture (from red to green) and Temperature (from blue to red). These are automatically used when showing the climate summary layer for precipitation and temperature.
- Optimized display of data variables in Results View.


- MODFLOW:

- Seawater Intrusion (MODFLOW SWI2 Package): WEAP can now link to MODFLOW's SeaWater Intrusion (SWI2) Package, for modeling of three-dimensional vertically integrated variable-density groundwater flow and seawater intrusion in coastal multiaquifer systems. If using this package, you can see results for the Zeta Surface Elevation as a 3-dimension surface for each active surface. (Each surface separates different variable density zones.) In addition, WEAP will adjust the fluxes in the cell-by-cell flow file by the terms SWIADDTOFLF, SWIADDTOFRF, and SWIADDTOFFF (which are computed by the SWI2 package), for the lower face (LF), right face (RF), and front face (FF), respectively, as well as using the new SWIADDTOCH term to correct the CONSTANT HEAD volume.
- MODFLOW Groundwater Evapotranspiration: WEAP can now link to MODFLOW's EVT and ETS packages. Evapotranspiration will come directly from the groundwater node, and be included in the Groundwater Inflows and Outflow results. There are also two new MODFLOW results in the Results View: MODFLOW Evapotranspiration Volume and MODFLOW Evapotranspiration Depth. Note: There is no interaction with catchments (if they exist in the WEAP model).
- Increased consistency with MODFLOW results: For MODFLOW models that have more than one timestep per stress period, WEAP will now read and average the results over all MODFLOW timesteps. Previously, WEAP was reading the stress period results from the final timestep only. Depending on the number of MODFLOW timesteps and rate of change, flows from the final timestep might not have been representative of flows over the entire stress period.
- The version of MODFLOW 2005 included with WEAP has been updated from version 1.11 (2013) to 1.12 (2017). Note: this version only runs on 64-bit versions of Windows, yet it is compatible with WEAP, which is 32-bit.
- The version of MODFLOW-NWT included with WEAP has been updated from version 1.1.4 (4/1/2018) to 1.2 (3/1/2020).
- Groundwater storage when linked to MODFLOW: Groundwater storage can be less than zero only for groundwater nodes linked to any MODFLOW cells. (Previously, if a WEAP model was linked to MODFLOW, all groundwater nodes were allowed to go negative regardless of whether they were linked to any MODFLOW cells.)
- MODFLOW General Head Boundary Stress Period data: Option to use some or all of the stress period data in the GHB file. By default, as with all MODFLOW packages, WEAP will only use the first stress period of data from the GHB file. However, the GHB package has the option of using some or all of the subsequent stress period data. This could be useful in cases where there are measured or modeled variations in these parameters over time. To use these stress period data, insert one or more comments at the top of the GHB file, using the following syntax. (All MODFLOW comments start with # in column one, and must be the first lines in the file.)

# WEAPOPTION:STRESSPERIOD:FIRST:<stress period number>
This option tells WEAP to start with the stress period number listed.

# WEAPOPTION:STRESSPERIOD:LAST:<stress period number>
This option tells WEAP to stop with the stress period number listed. Use -1 to indicate the last stress period in the file.

# WEAPOPTION:STRESSPERIOD:ALL
Use data from every stress period in the file. If there are fewer stress periods than WEAP timesteps in the full planning horizon (Base Year to End Year), WEAP will default to using the last stress period's data for all subsequent WEAP timesteps (defaults to REPEATLAST option). This is equivalent to FIRST:1 and LAST:-1

# WEAPOPTION:STRESSPERIOD:ANNUAL
Use data from the first twelve stress periods in the file (or however many WEAP timesteps are in one year), and repeat it for each year (defaults to CYCLE option). This is equivalent to FIRST:1 and LAST:12 and CYCLE (for a monthly model)

# WEAPOPTION:STRESSPERIOD:CYCLE
This option tells WEAP to repeat the stress periods' data, in conjunction with the ALL or ANNUAL or FIRST or LAST options.

# WEAPOPTION:STRESSPERIOD:REPEATLAST
This option tells WEAP to use the final stress period's data for all subsequent WEAP timesteps if there are fewer stress periods of data in the file than WEAP timesteps. This is the default setting (except if using ANNUAL).

The ALL and ANNUAL options are mutually exclusive, as are the CYCLE and REPEATLAST options.

Some examples and the resulting sequences of stress period data to use (all assuming 18 stress periods of data in the GHB file, and a monthly WEAP model from 2020-2023):

No options specified. Note: this is equivalent to FIRST:1 and LAST:1
1,1,1,1,1,1,...

# WEAPOPTION:STRESSPERIOD:ALL
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,18,18,18,... (defaults to REPEATLAST)

# WEAPOPTION:STRESSPERIOD:ALL
# WEAPOPTION:STRESSPERIOD:CYCLE
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,1,2,3,4,5,6,7,8,9,...

# WEAPOPTION:STRESSPERIOD:ANNUAL
1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,... (defaults to CYCLE)

# WEAPOPTION:STRESSPERIOD:ANNUAL
# WEAPOPTION:STRESSPERIOD:REPEATLAST
1,2,3,4,5,6,7,8,9,10,11,12,12,12,12,12,12,...

# WEAPOPTION:STRESSPERIOD:FIRST:7
7,8,9,10,11,12,13,14,15,16,17,18,18,18,18,18,...

# WEAPOPTION:STRESSPERIOD:LAST:6
1,2,3,4,5,6,6,6,6,6,6,...

# WEAPOPTION:STRESSPERIOD:FIRST:7
# WEAPOPTION:STRESSPERIOD:LAST:12
7,8,9,10,11,12,12,12,12,12,12,...

# WEAPOPTION:STRESSPERIOD:FIRST:7
# WEAPOPTION:STRESSPERIOD:LAST:12
# WEAPOPTION:STRESSPERIOD:CYCLE
7,8,9,10,11,12,7,8,9,10,11,12,7,8,9,...

# WEAPOPTION:STRESSPERIOD:FIRST:7
# WEAPOPTION:STRESSPERIOD:LAST:-1
# WEAPOPTION:STRESSPERIOD:CYCLE
7,8,9,10,11,12,13,14,15,16,17,18,7,8,9,10,11,12,13,14,15,16,17,18,7,8,...


- SCRIPTING/APPLICATION PROGRAMMING INTERFACE (API):

- Save Area as Visual Basic Script (VBS): on the menu, go to Area, Save as Visual Basic Script... to create a script that will recreate the current area's schematic and expressions. Note: not all information in the area is saved to the script, e.g., area bounds, background layers, CSV files, user-defined variables or units, favorites, etc.
- Before MODFLOW Calculation Event: WEAP now calls this event script (if specified) after the MODFLOW input files are created but before MODFLOW is run. This will allow the user to make modifications to the MODFLOW input files.
- NameList: All collections now have NameList as a property, to get a comma-separated list of items: WEAP.Areas.NameList, WEAP.Favorites.NameList, WEAP.Scenarios.NameList, WEAP.TagCategories.NameList, WEAP.Tags.NameList, WEAP.Timesteps.NameList, WEAP.Versions.NameList, WEAP.WQConstituents.NameList, WEAP.Branch("South City").Variables.NameList
- API and calculations: Several API commands are not safe to call during calculation, such as SaveArea, AddBranch, etc. WEAP now will stop with an error if an attempt is made to call them during calculations.
- Adding tags: Much faster to add many tags via the API in a script.

- WEAPApplication API:
- WEAP.BranchesOfType(BranchTypeOrID): Get the WEAPBranches collection of all branches of the specified type, e.g., WEAP.BranchesOfType("Catchment"). For a given type, equivalent to each of the type-specific functions: WEAP.CatchmentInflowNode, WEAP.Catchments, WEAP.DemandSites, WEAP.DiversionNodes, WEAP.Diversions, WEAP.FlowRequirements, WEAP.Gauges, WEAP.GroundwaterNodes, WEAP.OtherSupplyNodes, WEAP.Reservoirs, WEAP.ReturnFlowLinks, WEAP.ReturnFlowNodes, WEAP.RiverReaches, WEAP.Rivers, WEAP.RunoffInfiltrationLinks, WEAP.RunoffInfiltrationNodes, WEAP.RunOfRiverHydropowerNodes, WEAP.TransmissionLinks, WEAP.TributaryNodes, WEAP.WastewaterTreatmentPlants, WEAP.WithdrawalNodes. In addition, there are function to access the subset of reservoir on and off a river: WEAP.LocalReservoirs and WEAP.RiverReservoirs. Note: only includes top-level branches for Demand Sites and Catchments, not their descendants.
- WEAP.Choose(Title, Options, InitiallySelected, ListSeparator): Ask user to choose one or more items from a list of options. If the optional parameter InitiallySelected is given, it lists the options that are initially checked. The return value is the list of options selected. Multiple items are separated by the character specified by optional parameter ListSeparator (which defaults to comma). E.g., WEAP.Choose("Choose One", "One,Two,Three")
- WEAP.ResultsExportPrecision: Set or get the digits of precision (from 1-15, default is 6) to use when exporting result values (WEAP.ResultValue, WEAP.ExportResults). It will not reduce precision before the decimal point. E.g., if precision is 5, then 12345678.901 becomes 12345679, 123.456789 becomes 123.46, and 0.123456789 becomes 0.12346. NOTE: Previously, WEAP.ResultValue always had 15 digits of precision and WEAP.ExportResults always had 6. Now, the default for both is 6, but can be changed.
- WEAP.CreateLink: New optional parameter, AddMidpoint (defaults to True), to determine whether or not to add an offset midpoint to the link in case there is already a link between the two points (to make them both visible).
- WEAP.CreateRiver: Create a river or diversion on the Schematic, e.g., WEAP.CreateRiver("River", -71, 42, -70.9, 41.8, "Yellow River", "Yellow;River")
- WEAP.ScreenUpdating: Much faster to add many scenarios or other changes in a script if you first set WEAP.ScreenUpdating = FALSE. (Make sure to set it back to TRUE when done.)
- WEAP.ScreenRefresh: Call ScreenRefresh to update the schematic when ScreenUpdating = FALSE
- WEAP.ResultSetting: New ResultSetting API properties, for customizing results via a script:
WEAP.ResultSetting("Stat") = TRUE
WEAP.ResultSetting("Group") = TRUE
WEAP.ResultSetting("GroupNum") = 9
WEAP.ResultSetting("GroupLargest") = TRUE
WEAP.ResultSetting("GroupAllOthers") = TRUE
- WEAP.ExportResults: Now works in the Data View, as well as the Results View and Scenario Explorer View.
- WEAP.LoadFavorite: You can now specify which scenario to load in WEAP.LoadFavorite, using either the scenario's name or index (1 to number); use "All" or 0 to change the legend to all scenarios. E.g., WEAP.LoadFavorite("Groundwater Storage", "Demand Measures") WEAP.LoadFavorite("Groundwater Storage", "All")
- WEAP.AddResultFileToTransfer: WEAP.AddResultFileToTransfer can be used in an event script (after a scenario is calculated during parallel calculations) to add files to be transferred to Manager, e.g., a CSV file that the script has created. Can be called several times to add several files to be transferred. Add one named "$No_Binary_Results$" to prevent binary result files from being transferred. Will be reset at the start of each scenario calculation. Here's an example:
Filename = WEAP.TempDirectory + "Scenario" + Right(FormatNumber(1000 + WEAP.ActiveScenario.ID, 0), 3) + "GW.csv" ' Unique filename, based on the ID code for a scenario. Pad left with 0's, so that they alphabetize
CALL WEAP.LoadFavorite("Groundwater Storage") ' Load GW storage chart
CALL WEAP.ExportResults(Filename, TRUE, TRUE) ' Export to CSV
CALL WEAP.AddResultFileToTransfer(Filename) ' Transfer the CSV file back to main
CALL WEAP.AddResultFileToTransfer("$No_Binary_Results$") ' Do not transfer the binary results files
- WEAP.TempPath: WEAP.TempPath gets the full path of the WEAP temp directory, e.g., C:\Users\Jack\Documents\WEAP Areas\_Temp. Read only.

- WEAPBranches API:
- WEAPBranches.FilterByName(Names): Gets subset of branches in the collection whose name matches one of the names in Names parameter (separated by commas). To allow partial matches, prefix with "Partial:", e.g., "Partial:Corn". To find branches that do NOT match, prefix with "Not:", .e.g., "Not:Forest". Returns a WEAPBranches collection. Read only. Note: because it returns a WEAPBranches collection, you can string together several in one statement, e.g., WEAP.Catchments.FilterByName("Partial:Fresno").FilterByScenario("Not:Current Accounts").Choose("Select Catchments to set active in Current Accounts")
- WEAPBranches.FilterByScenario(Scenarios): Gets subset of branches in the collection that are active in any of the scenarios in Scenarios parameter (separated by commas). To find branches that are NOT active in any scenario listed, prefix with "Not:", .e.g., WEAP.Branches.FilterByScenario("Not:Current Accounts,Reference") would match branches that were not active in Current Accounts or the Reference scenario. Returns a WEAPBranches collection. Read only. Note: because it returns a WEAPBranches collection, you can string together several in one statement, e.g., WEAP.DemandSites.FilterByTag("South").FilterByScenario("Not:Current Accounts").Choose("Select Demand Sites to set active in Current Accounts")
- WEAPBranches.FilterByTag(Tags): Gets subset of branches in the collection that have any of the tags in Tags parameter (separated by commas). To find branches that do NOT match, prefix with "Not:", .e.g., WEAP.Branches.FilterByTag"Not:South") would match branches that did not have a "South" tag. Returns a WEAPBranches collection. Read only. Note: because it returns a WEAPBranches collection, you can string together several in one statement, e.g., WEAP.DemandSites.FilterByTag("South").FilterByScenario("Not:Current Accounts").Choose("Select Demand Sites to set active in Current Accounts")
- WEAPBranches.FilterByType(Types): Gets subset of branches in the collection whose type matches one of the types in Types parameter (separated by commas). To find branches that do NOT match, prefix with "Not:", .e.g., WEAP.Branches.FilterByType("Not:Reservoir"). Returns a WEAPBranches collection. Read only. Note: because it returns a WEAPBranches collection, you can string together several in one statement, e.g., WEAP.Branch("Gauge 01").UpstreamNodes.FilterByType("Catchments").FilterByScenario("Not:Current Accounts").Choose("Select Catchments to set active in Current Accounts")
- WEAPBranches.FullNameList: Get a list of branch names (using the full path) separated by character specified by optional parameter ListSeparator (which defaults to comma). E.g., DSToDelete = WEAP.Choose("Choose Demand Sites to delete", WEAP.DemandSites.FullNameList)
- WEAPBranches.NameList: Get a list of branch names separated by character specified by optional parameter ListSeparator (which defaults to comma), e.g., DemandSiteArray = Split(WEAP.DemandSites.NameList, ",")
- WEAPBranches.Choose(Title, Default, MaxChoices, UseFullPath): Ask user to choose items from the branch collection. If the optional parameter Default is given, it has the comma-separated list of items that are initially checked. If the optional parameter MaxChoices is given, it has the maximum number of choices permitted. If not given or zero, there is no maximum. If the optional parameter UseFullPath is given, the branch list shown to the user will use the full branch path (e.g., \Demand Sites\South City) instead of the short name (e.g., South City). The return value is another WEAPBrances collection containing the selected items. If none were selected, the collection will be empty. Note: because it returns a WEAPBranches collection, you can string together several in one statement, e.g., WEAP.DemandSites.FilterByTag("South").FilterByScenario("Not:Current Accounts").Choose("Select Demand Sites to set active in Current Accounts").NameList

- WEAPBranch API:
- WEAPBranch.UpstreamNodes(IncludeOffstreamNodes, IncludeLinks): Gets the WEAPBranches collection of all nodes upstream of this branch, which must be a river node. If IncludeOffstreamNodes is True (optional, default is False), include Demand Sites, Catchments and Wastewater Treatment Plants that return upstream. If IncludeLinks is True (optional, default is False), include River Reaches, and, if IncludeOffstreamNodes is also True, Return Flow and Runoff/Infiltration Links. See also DownstreamNodes. Note: because it returns a WEAPBranches collection, you can string together several in one statement, e.g., WEAP.Branch("Gauge 283401").UpstreamNodes(True).FilterByType("Catchment") will get the collection of catchments upstream of the gauge.
- WEAPBranch.DownstreamNodes(IncludeOffstreamNodes, IncludeLinks): Gets the WEAPBranches collection of all nodes downstream of this branch, which must be a river node. If IncludeOffstreamNodes is True (optional, default is False), include Demand Sites and Catchments that withdraw from the river downstream. If IncludeLinks is True (optional, default is False), include River Reaches, and, if IncludeOffstreamNodes is also True, Transmission Links. See also UpstreamNodes. Note: because it returns a WEAPBranches collection, you can string together several in one statement, e.g., WEAP.Branch("Central Reservoir").DownstreamNodes(True).FilterByType("Demand Site") will get the list of all demand sites downstream of Central Reservoir.
- WEAPBranch.AddChildren(NewNames): Create branches on the Data Tree under the current branch with names from the comma separated list in NewNames. Only works for branches under Demand Sites and Catchments, Key Assumptions or Other Assumptions. If a branch under the current branch with a name already exists, a new one will not be created.
- WEAPBranch.Descendants: Get the collection of all branches at all levels underneath this branch. The list has a "depth first" ordering -- a branch's children are ordered before its siblings. Returns a WEAPBranches collection. See also WEAPBranch.Children and WEAPBranch.Leaves.
- WEAPBranch.Leaves: Gets the WEAPBranches collection of all leaves underneath this branch. (A leaf is the lowest level, with no children of its own.) See also WEAPBranch.Children and WEAPBranch.Descendants.
- WEAPBranch.NumChildren API: Get the number of children below the branch, if any.
- WEAPBranch.Level: Get the level of the branch in the tree, where the top level (e.g., Key Assumptions, Demand Sites, Supply and Resources) equals one.
- WEAPBranch.FullName: Get the full path of the current branch. Each level is separated by the "\" character. (e.g. Demand Sites\South City) Read only.
- WEAPBranch.IsRiverNode: Returns true if the branch represents a node on a river.
- WEAPBranch.Split: Subdivide a branch, creating a new child for each name in the comma separated list NewNames. If parameter DoCopyData is TRUE (optional, defaults to TRUE), copy all data from the current branch to the new branches (except Activity Level and Area). Activity Unit for the new branches will be set to percent. For example, WEAP.Branch("\Demand Sites\Industry North").Split("Manufacturing,Cooling")
- WEAPBranch.HasTag: Get or set whether the branch has a tag. E.g., WEAP.Branch("\Demand Sites\South City").HasTag("Agriculture") = FALSE
For example, here is a simple VB script to turn off all catchments that do not have a specific tag (all catchments in one basin were already tagged with this tag):
FOR EACH Br in WEAP.Branch("\Demand Sites and Catchments").Children
IF Br.TypeName = "Catchment" THEN
Br.ActiveInCurrentAccounts = Br.HasTag("San Joaquin ab Millerton")
END IF
NEXT
- WEAPBranch.HasTagCategory: Are any of the branch's tags in the category, e.g., FOR EACH Br in WEAP.Catchments Br.ActiveInCurrentAccounts = Br.HasTagCategory("Upper Watersheds") NEXT
- WEAPBranch.AddPoint: Add a point to the line (river, diversion, transmission link, return flow link, runoff/infilltration link) at location X, Y. If optional parameter AddBefore is given, add before this point (numbered 1 to N). If not given, add at end (rivers and diversions) or just before the end (links).
- WEAPBranch.NumPoints: Get the number of points on the line (river, diversion, transmission link, return flow link, runoff/infilltration link).
- WEAPBranch.TailflowNode: Get or set the tailflow node for a tributary or diversion, e.g., "Supply and Resources\River\Weaping River\Tributary Inflow\Blue River Inflow". Returns a WEAPBranch object -- use WEAPBranch.IsValid to test if valid (connected) or not (not connected). When setting, the node must already exist, and you can use either a WEAPBranch object or the branch's name. Set to "" (empty string) to disconnect. As a shortcut, you can give just the name of the node, e.g., "Blue River Inflow"
- WEAPBranch.HeadflowNode: Get or set the headflow node for a diversion, e.g., "Supply and Resources\River\Weaping River\Diversions\Grand Canal Outflow". Returns a WEAPBranch object -- use WEAPBranch.IsValid to test if valid (connected) or not (not connected). When setting, node must already exist, and you can use either a WEAPBranch object or the branch's name. Set to "" (empty string) to disconnect. As a shortcut, you can give just the name of the node, e.g., "Grand Canal Outflow"
Get or set the headflow node for a diversion, e.g., "Supply and Resources\River\Weaping River\Diversions\Grand Canal Outflow". Returns a WEAPBranch object. When setting, can use either a WEAPBranch object or the branch's name. Set to "" (empty string) to disconnect. As a shortcut, you can give just the name of the node, e.g., "Grand Canal Outflow"
- WEAPBranch.Note: Set or get the note associated with the branch in plain text format. If you want to set or get the note in rich text format, which includes text formatting codes and non-text elements such as graphics, use the NoteAsRTF property instead.
- WEAPBranch.NoteAsRTF: Set or get the note associated with the branch, in rich text format. If you want to set or get the note in plain text format, without text formatting codes and non-text elements such as graphics, use the Note property instead.
- WEAPBranch.IsValid: Return TRUE if the WEAPBranch object is assocaited with a valid WEAP branch.

- WEAPVariable API:
- WEAPVariable.ResultValues(Year1, Year2, Scenario): Get array of result values for every timestep in one or more years. If Year2 is omitted, values for Year1 are returned. If Scenario is omitted, the active scenario will be used. If the result variable is daily, then 365 (or 366 for leap years if leap days are used) values per year will be returned, regardless of the area timestep. This can be a MUCH faster way to retrieve many results in a script, instead of multiple WEAP.ResultValue calls.
- WEAPVariable.Unit: Get a string containing the units of the data value, e.g., "m^3" or "CFS".
- WEAPVariable.Scale: Get the numerical value of the scale, e.g., if ScaleUnit = "Million m^3", Scale = 1000000
- WEAPVariable.DataSourceType: Get or set the data source type (Enter Expression, Water Year Method, or Read from File) for the variable (only valid for the following inflow variables: river headflow, groundwater natural recharge, local reservoir inflow, other local supply inflow, surface water inflow) for the specified scenario (optional -- if blank it defaults to active scenario).

- WEAPScenario API:
- WEAPScenario.NeedsCalculation: You can override the setting as to whether a scenario needs calculation or not. USE WITH CAUTION -- results may be incorrect if calculations needs to be run but you mark them as calculated. For example, to set all scenarios as calculated:
FOR EACH Scen IN WEAP.Scenarios
Scen.NeedsCalculation = FALSE
NEXT

- WEAPWQConstituents and WEAPWQConstituent API:
- New API classes to manage the list of water quality constituents: WEAPWQConstituents and WEAPWQConstituent. See help for full details.


- MISCELLANEOUS:

- XA Solver License: New license for XA, expiring 15 July 2022.
- Manage Scenarios: The scenario tree now has checkboxes to see and select which scenarios will be calculated.
- User-defined result variables that are hidden in the Data View can now be calculated and displayed in the Results View.
- Add files to Plugins: You can now add files, such as scripts (vbs), Excel spreadsheets (xlsx) and Acrobat files (.pdf), to plugins.
- Plugins now remember if included user-defined variables were hidden.
- Minimum and maximum years: changed the allowable range of years for an area to 500-3000, with a maximum time horizon of 2500 years.
- Append preference/priority number to the transmission link's name in cases where multiple links exist between the source and destination. Note: Existing such links are NOT automatically renamed, but will be renamed whenever the priority changes, or source and destination's name changes.
- Weaping River Basin: Time horizon changed from 2010-2020 to 2020-2030. Time flies!
- Editing an event script will now trigger the need for recalculation.
- QUAL2K: Updated to using the most recent version of QUAL2K: 2.12b See http://www.qual2k.com/ for more information.
- NexusDB: Changed database file format from Paradox to NexusDB.


- BUGS FIXED:

- Automatic catchment delineation: In some cases WEAP was unable to read climate data for very small catchments (less than 4 km in either dimension) from a very large user-defined netcdf file (larger than 2 GB).
- PEST: Fixed bug with automated PEST parameter estimation procedure that was failing when using streamflow gauges for calibration.
- In catchment delineation mode, when deleting one basin out of several, WEAP would sometimes delete the rivers from upstream or downstream basins.
- In catchment delineation mode, WEAP didn't always create all land use branches even though "Including Area = 0" was turned on.
- User-defined results variables: Fixed bug that prevented removing a user-defined result variable.
- Key Assumptions results were not displayed correctly in the Results View in models with an annual timestep.
- Calculations could crash if a reach had data for reach length but the connected groundwater node did not use the wedge method.
- MODFLOW DIScretization package: Fixed problem where WEAP was not writing the correct stress period length in cases where the DIS package included EXTERNAL file references.
- Daily climate data (for Mabia and PGM) were not being graphed in the Data View.
- In the Data View, setting a tag filter would hide all Key Assumption and Other Assumption branches.
- Sometimes WEAP determined that calculations needed to be run when in fact they were already up to date.
- Handle Daymet climate files that do not include December 31 in leap years.
- Catchments with "Irrigation Demands only" method were allowed to have runoff/infiltration links, and if the irrigation fraction was less than 100%, there was some runoff or infiltration.


Jack Sieber
WEAP Developer
Stockholm Environment Institute
Topic "Major New Version of WEAP (2021.0)"