-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: read blank lines and blank cells in CSV files (#309)
Fixes #308 Co-authored-by: Chris Campbell <[email protected]>
- Loading branch information
1 parent
624118a
commit 1a9fa37
Showing
9 changed files
with
102 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
c,C1,C2 | ||
B1,1,2 | ||
B2,3,ZERO | ||
B3,5,6 | ||
h, | ||
A,1 | ||
B,2 | ||
, | ||
C,3 | ||
D,4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
c,C1,C2 | ||
B1,1,2 | ||
B2,3,ZERO | ||
B3,5,6 |
21 changes: 21 additions & 0 deletions
21
models/directconst_invalidcell/directconst_invalidcell.dat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
c[B1,C1] | ||
0 1 | ||
c[B1,C2] | ||
0 2 | ||
c[B2,C1] | ||
0 3 | ||
c[B2,C2] | ||
0 0 | ||
c[B3,C1] | ||
0 5 | ||
c[B3,C2] | ||
0 6 | ||
FINAL TIME | ||
0 1 | ||
INITIAL TIME | ||
0 0 | ||
SAVEPER | ||
0 1 | ||
1 1 | ||
TIME STEP | ||
0 1 |
51 changes: 51 additions & 0 deletions
51
models/directconst_invalidcell/directconst_invalidcell.mdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{UTF-8} | ||
DimB: B1, B2, B3 ~~| | ||
DimC: C1, C2 ~~| | ||
|
||
c[DimB, DimC] = | ||
GET DIRECT CONSTANTS( | ||
'data/c.csv', | ||
',', | ||
'B2' | ||
) | ||
~ | ||
~ This csv file has a cell that does not contain a number so that we can check that | ||
SDE does not throw an error in this case. Note that Vensim will raise an error if | ||
a cell in the csv file does not contain a number, so to run this test in Vensim, | ||
temporarily change cell C3 to 0 in `c.csv`. | ||
~:SUPPLEMENTARY| | ||
|
||
******************************************************** | ||
.Control | ||
********************************************************~ | ||
Simulation Control Parameters | ||
| | ||
|
||
INITIAL TIME = 0 ~~| | ||
FINAL TIME = 1 ~~| | ||
TIME STEP = 1 ~~| | ||
SAVEPER = TIME STEP ~~| | ||
|
||
\\\---/// Sketch information - do not modify anything except names | ||
V300 Do not put anything below this section - it will be ignored | ||
*View 1 | ||
$0-0-0,0,|0||0-0-0|0-0-0|0-0-0|0-0-0|0-0-0|0,0,100,0 | ||
///---\\\ | ||
:L<%^E!@ | ||
9:directconst | ||
15:0,0,0,0,0,0 | ||
19:100,0 | ||
27:2, | ||
34:0, | ||
5:FINAL TIME | ||
35:Date | ||
36:YYYY-MM-DD | ||
37:2000 | ||
38:1 | ||
39:1 | ||
40:2 | ||
41:0 | ||
42:1 | ||
24:0 | ||
25:0 | ||
26:0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters