dleutnant / swmmr

R Interface for US EPA's SWMM
https://cran.r-project.org/package=swmmr
39 stars 15 forks source link

Input file name #72

Closed karavindan2020 closed 2 years ago

karavindan2020 commented 2 years ago

Hi, I'm a novice user of swmmr. While trying to run the model I came across an error when the input file name was separated out by a space. The R program couldn't read the input file name. Upon removing the space of the file name with an underscore the run got completed. Just wondering if issues/preference like this (appreciate it's minor) are documented within the package. If there are more such preferences that I need to be aware then could someone point/list out them please? Thanks.

dleutnant commented 2 years ago

Hi @karavindan2020 , thanks for spotting this. Indeed I can reproduce the error and will fix it in the near future. In the meanwhile, I recommend to avoid whitespaces in any file name (not only in the modelling context...)

dleutnant commented 2 years ago
library(swmmr)

model <- system.file("extdata", "Example1.inp", package = "swmmr")

file.exists(model)
#> [1] TRUE

new_dir <- tempdir()

file.copy(from = model, to = new_dir)
#> [1] TRUE

new_model <- file.path(new_dir, "Example1.inp")

file.exists(new_model)
#> [1] TRUE

new_model_with_space <- file.path(new_dir, "Example 1.inp")

file.rename(new_model, new_model_with_space)
#> [1] TRUE

file.exists(new_model_with_space)
#> [1] TRUE

tmp <- swmmr::run_swmm(new_model_with_space)

tmp$rpt |> swmmr::read_rpt()
#> $analysis_options
#> # A tibble: 18 x 2
#>    Option              Value              
#>    <chr>               <chr>              
#>  1 Flow Units          CFS                
#>  2 Process Models:     <NA>               
#>  3 Rainfall/Runoff     YES                
#>  4 RDII                NO                 
#>  5 Snowmelt            NO                 
#>  6 Groundwater         NO                 
#>  7 Flow Routing        YES                
#>  8 Ponding Allowed     NO                 
#>  9 Water Quality       YES                
#> 10 Infiltration Method HORTON             
#> 11 Flow Routing Method KINWAVE            
#> 12 Starting Date       01/01/1998 00:00:00
#> 13 Ending Date         01/02/1998 12:00:00
#> 14 Antecedent Dry Days 5.0                
#> 15 Report Time Step    01:00:00           
#> 16 Wet Time Step       00:15:00           
#> 17 Dry Time Step       01:00:00           
#> 18 Routing Time Step   60.00 sec          
#> 
#> $runoff_quantity_continuity
#> # A tibble: 6 x 3
#>   Component            Volume  Depth
#>   <chr>                 <dbl>  <dbl>
#> 1 Total Precipitation  15.7    2.65 
#> 2 Evaporation Loss      0      0    
#> 3 Infiltration Loss     9.35   1.58 
#> 4 Surface Runoff        6.30   1.06 
#> 5 Final Storage         0.081  0.014
#> 6 Continuity Error (%) NA     -0.272
#> 
#> $runoff_quality_continuity
#> # A tibble: 9 x 3
#>   Component              TSS  Lead
#>   <chr>                <dbl> <dbl>
#> 1 Initial Buildup      3433. 0    
#> 2 Surface Buildup       313. 0.086
#> 3 Wet Deposition          0  0    
#> 4 Sweeping Removal        0  0    
#> 5 Infiltration Loss       0  0    
#> 6 BMP Removal             0  0    
#> 7 Surface Runoff        431. 0.086
#> 8 Remaining Buildup    3315. 0    
#> 9 Continuity Error (%)    0  0    
#> 
#> $flow_routing_continuity
#> # A tibble: 12 x 3
#>    Component             Volume_a Volume_b
#>    <chr>                    <dbl>    <dbl>
#>  1 Dry Weather Inflow       0        0    
#>  2 Wet Weather Inflow       6.30     2.05 
#>  3 Groundwater Inflow       0        0    
#>  4 RDII Inflow              0        0    
#>  5 External Inflow          0        0    
#>  6 External Outflow         5.87     1.91 
#>  7 Flooding Loss            0.415    0.135
#>  8 Evaporation Loss         0        0    
#>  9 Exfiltration Loss        0        0    
#> 10 Initial Stored Volume    0        0    
#> 11 Final Stored Volume      0        0    
#> 12 Continuity Error (%)    NA        0.111
#> 
#> $quality_routing_continuity
#> # A tibble: 12 x 3
#>    Component                TSS   Lead
#>    <chr>                  <dbl>  <dbl>
#>  1 Dry Weather Inflow     0      0    
#>  2 Wet Weather Inflow   431.     0.086
#>  3 Groundwater Inflow     0      0    
#>  4 RDII Inflow            0      0    
#>  5 External Inflow        0      0    
#>  6 External Outflow     410.     0.082
#>  7 Flooding Loss         22.2    0.004
#>  8 Exfiltration Loss      0      0    
#>  9 Mass Reacted           0      0    
#> 10 Initial Stored Mass    0      0    
#> 11 Final Stored Mass      0      0    
#> 12 Continuity Error (%)  -0.144 -0.144
#> 
#> $highest_flow_instability_indexes
#> # A tibble: 1 x 2
#>   Link  Instability      
#>   <chr> <chr>            
#> 1 All   links are stable.
#> 
#> $routing_time_step_summary
#> # A tibble: 6 x 2
#>   Component                   Value    
#>   <chr>                       <chr>    
#> 1 Minimum Time Step           60.00 sec
#> 2 Average Time Step           60.00 sec
#> 3 Maximum Time Step           60.00 sec
#> 4 Percent in Steady State     0.00     
#> 5 Average Iterations per Step 1.49     
#> 6 Percent Not Converging      0.00     
#> 
#> $subcatchment_runoff_summary
#> # A tibble: 8 x 9
#>   Subcatchment Total_Precip Total_Runon Total_Evap Total_Infil Total_Runoff_Dep~
#>   <chr>               <dbl>       <dbl>      <dbl>       <dbl>             <dbl>
#> 1 1                    2.65           0          0        1.16              1.32
#> 2 2                    2.65           0          0        1.21              1.32
#> 3 3                    2.65           0          0        1.16              1.32
#> 4 4                    2.65           0          0        1.16              1.32
#> 5 5                    2.65           0          0        1.24              1.31
#> 6 6                    2.65           0          0        2.27              0.26
#> 7 7                    2.65           0          0        2.14              0.26
#> 8 8                    2.65           0          0        2.25              0.26
#> # ... with 3 more variables: Total_Runoff_Volume <dbl>,
#> #   Total_Peak_Runoff <dbl>, Total_Runoff_Coeff <chr>
#> 
#> $subcatchment_washoff_summary
#> # A tibble: 9 x 3
#>   Subcatchment   TSS  Lead
#>   <chr>        <dbl> <dbl>
#> 1 1             50.1 0.01 
#> 2 2             90.6 0.018
#> 3 3             25.1 0.005
#> 4 4             46.1 0.009
#> 5 5             71.2 0.014
#> 6 6             65.8 0.013
#> 7 7             26.0 0.005
#> 8 8             56.4 0.011
#> 9 System       431.  0.086
#> 
#> $node_depth_summary
#> # A tibble: 14 x 8
#>    Node  Type     Average_Depth Maximum_Depth Maximum_HGL Time_of_Max_Occurance~
#>    <chr> <chr>            <dbl>         <dbl>       <dbl>                  <int>
#>  1 9     JUNCTION          0.09          0.57       1001.                      0
#>  2 10    JUNCTION          0.32          3           998                       0
#>  3 13    JUNCTION          0.06          0.41        995.                      0
#>  4 14    JUNCTION          0.06          0.46        990.                      0
#>  5 15    JUNCTION          0.15          1.15        988.                      0
#>  6 16    JUNCTION          0.17          1.15        986.                      0
#>  7 17    JUNCTION          0.18          1.14        981.                      0
#>  8 19    JUNCTION          0.03          0.22       1010.                      0
#>  9 20    JUNCTION          0.03          0.22       1005.                      0
#> 10 21    JUNCTION          1.16          2           992                       0
#> 11 22    JUNCTION          1.11          1.58        989.                      0
#> 12 23    JUNCTION          0.05          0.35        990.                      0
#> 13 24    JUNCTION          0.18          1.14        985.                      0
#> 14 18    OUTFALL           0.17          1.07        976.                      0
#> # ... with 2 more variables: Time_of_Max_Occurance_hm <chr>,
#> #   Reported_Max_Depth <dbl>
#> 
#> $node_inflow_summary
#> # A tibble: 14 x 9
#>    Node  Type     Maximum_Lateral_Inflow Maximum_Total_Inflow Time_of_Max_Occur~
#>    <chr> <chr>                     <dbl>                <dbl>              <int>
#>  1 9     JUNCTION                   4.66                 4.66                  0
#>  2 10    JUNCTION                   4.52                 9.17                  0
#>  3 13    JUNCTION                   2.45                 2.45                  0
#>  4 14    JUNCTION                   0                    2.44                  0
#>  5 15    JUNCTION                   6.56                 9                     0
#>  6 16    JUNCTION                   0                   16.8                   0
#>  7 17    JUNCTION                   0                   18.3                   0
#>  8 19    JUNCTION                   0.79                 0.79                  0
#>  9 20    JUNCTION                   0                    0.78                  0
#> 10 21    JUNCTION                   0                    5.42                  0
#> 11 22    JUNCTION                   2.45                 7.86                  0
#> 12 23    JUNCTION                   1.5                  1.5                   0
#> 13 24    JUNCTION                   0                   18.3                   0
#> 14 18    OUTFALL                    1.33                19.6                   0
#> # ... with 4 more variables: Time_of_Max_Occurance_hm <chr>,
#> #   Lateral_Inflow_Volume <dbl>, Total_Inflow_Volume <dbl>,
#> #   Flow_Balance_Error <dbl>
#> 
#> $node_flooding_summary
#> # A tibble: 1 x 7
#>   Node  Hours_Flooded Maximum_Rate Time_of_Max_Occurance_d Time_of_Max_Occuranc~
#>   <chr>         <dbl>        <dbl>                   <int> <chr>                
#> 1 10             2.82         4.53                       0 04:01                
#> # ... with 2 more variables: Total_Flood_Volume <dbl>,
#> #   Maximum_Ponded_Volume <dbl>
#> 
#> $outfall_loading_summary
#> # A tibble: 2 x 7
#>   Outfall_Node Flow_Freq Avg_Flow Max_Flow Total_Volume Total_TSS Total_Lead
#>   <chr>            <dbl>    <dbl>    <dbl>        <dbl>     <dbl>      <dbl>
#> 1 18                72.9     2.71     19.6         1.91      410.      0.082
#> 2 System            72.9     2.71     19.6         1.91      410.      0.082
#> 
#> $link_flow_summary
#> # A tibble: 13 x 8
#>    Link  Type    Maximum_Flow Time_of_Max_Occura~ Time_of_Max_Occ~ Maximum_Veloc
#>    <chr> <chr>          <dbl>               <int> <chr>                    <dbl>
#>  1 1     CONDUIT         4.65                   0 04:01                     7.6 
#>  2 4     CONDUIT         0.78                   0 04:02                     6.11
#>  3 5     CONDUIT         0.78                   0 04:02                     8.99
#>  4 6     CONDUIT         4.93                   0 02:53                     7.01
#>  5 7     CONDUIT         5.41                   0 04:02                     7.18
#>  6 8     CONDUIT         7.85                   0 04:01                     6.84
#>  7 10    CONDUIT        18.3                    0 04:02                    10.8 
#>  8 11    CONDUIT         2.44                   0 04:01                     6.36
#>  9 12    CONDUIT         2.44                   0 04:02                     5.3 
#> 10 13    CONDUIT         8.98                   0 04:01                     6.24
#> 11 14    CONDUIT         1.49                   0 04:02                     6.12
#> 12 15    CONDUIT        16.8                    0 04:01                     9.67
#> 13 16    CONDUIT        18.3                    0 04:02                     9.87
#> # ... with 2 more variables: Maximum_Full_Flow <dbl>, Maximum_Full_Depth <dbl>
#> 
#> $conduit_surcharge_summary
#> # A tibble: 1 x 6
#>   Conduit Hours_Full_Both_En~ Hours_Full_Upst~ Hours_Full_Dnst~ Hours_Above_Ful~
#>     <int>               <dbl>            <dbl>            <dbl>            <dbl>
#> 1       6                 2.8              2.8              2.8              2.8
#> # ... with 1 more variable: Hours_Capacity_Limited <dbl>
#> 
#> $link_pollutant_load_summary
#> # A tibble: 13 x 3
#>    Link    TSS  Lead
#>    <chr> <dbl> <dbl>
#>  1 1      50.1 0.01 
#>  2 4      26.0 0.005
#>  3 5      26.0 0.005
#>  4 6     119.  0.024
#>  5 7     145.  0.029
#>  6 8     191.  0.038
#>  7 10    353.  0.071
#>  8 11     25.1 0.005
#>  9 12     25.1 0.005
#> 10 13     96.3 0.019
#> 11 14     65.7 0.013
#> 12 15    287.  0.057
#> 13 16    353.  0.071
#> 
#> $analysis_info
#> # A tibble: 3 x 1
#>   value                                       
#>   <chr>                                       
#> 1 Analysis begun on:  Wed Feb  2 11:34:26 2022
#> 2 Analysis ended on:  Wed Feb  2 11:34:26 2022
#> 3 Total elapsed time: < 1 sec                 
#> 
#> attr(,"class")
#> [1] "rpt"

Created on 2022-02-02 by the reprex package (v2.0.1)