1717@app .cell
1818def _ ():
1919 import os
20+ from pathlib import Path
2021
2122 import matplotlib as mpl
2223 import matplotlib .pyplot as plt
2324 import matplotx
2425 import polars as pl
25- from upath import UPath
2626
2727 import marimo as mo
2828
@@ -33,11 +33,11 @@ def _():
3333 mpl .rcParams ["figure.figsize" ] = (10 , 5 )
3434 mpl .rcParams ["figure.dpi" ] = 150
3535 mpl .style .use (matplotx .styles .onedark )
36- return UPath , mo , os , pl , plt
36+ return Path , mo , os , pl , plt
3737
3838
3939@app .cell
40- def _ (UPath , os , pl ):
40+ def _ (Path , os , pl ):
4141 def get_pudl (table_name : str ) -> pl .DataFrame :
4242 """Read a PUDL table from local storage if possible, and S3 nightlies if not.
4343
@@ -49,21 +49,13 @@ def get_pudl(table_name: str) -> pl.DataFrame:
4949 """
5050 pudl_output = os .environ .get ("PUDL_OUTPUT" , False )
5151 local_parquet_path = (
52- UPath (pudl_output ) / f"parquet/{ table_name } .parquet"
53- if pudl_output
54- else None
55- )
56- s3_parquet_path = (
57- UPath ("s3://pudl.catalyst.coop/nightly" ) / f"{ table_name } .parquet"
52+ Path (pudl_output ) / f"parquet/{ table_name } .parquet" if pudl_output else None
5853 )
54+ s3_parquet_url = f"s3://pudl.catalyst.coop/nightly/{ table_name } .parquet"
5955
6056 if (local_parquet_path is not None ) and (local_parquet_path .exists ()):
6157 return pl .read_parquet (local_parquet_path )
62- if s3_parquet_path .exists ():
63- return pl .read_parquet (s3_parquet_path )
64- raise FileNotFoundError (
65- f"Could not find { table_name } .parquet in either local or S3 path."
66- )
58+ return pl .read_parquet (s3_parquet_url )
6759
6860 return (get_pudl ,)
6961
0 commit comments