Skip to content

Commit

Permalink
fix(sia): handles files with final 'a', 'b' and 'c'
Browse files Browse the repository at this point in the history
  • Loading branch information
luabida committed Sep 20, 2023
1 parent 0300efb commit 3e73ece
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/source/tutorials/Dengue.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
}
],
"source": [
"munrj = gpd.read_file('../data/rj-municipalities.json')\n",
"munrj = gpd.read_file('data/rj-municipalities.json')\n",
"munrj.plot();"
]
},
Expand Down
6 changes: 4 additions & 2 deletions pysus/ftp/databases/sia.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ def describe(self, file: File) -> dict:

def format(self, file: File) -> tuple:
if file.extension.upper() in [".DBC", ".DBF"]:
year, month = file.name[-4:-2], file.name[-2:]
group, _uf = file.name[:-6].upper(), file.name[-6:-4].upper()
digits = ''.join([d for d in file.name if d.isdigit()])
chars, _ = file.name.split(digits)
year, month = digits[:2], digits[2:]
group, _uf = chars[:-2].upper(), chars[-2:].upper()
return group, _uf, zfill_year(year), month
return ()

Expand Down

0 comments on commit 3e73ece

Please sign in to comment.