Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

convert_npy fails silently if no .npy files are found #67

Open
anweiteck opened this issue Jan 8, 2022 · 0 comments
Open

convert_npy fails silently if no .npy files are found #67

anweiteck opened this issue Jan 8, 2022 · 0 comments
Assignees

Comments

@anweiteck
Copy link
Collaborator

See TODO, line 24:

def convert_npy(date: str = None):
"""Converts all .npy files to .tsv files."""
date = date if date is not None else paths.top.latest_date()
conversion = ["x", "y", "z"]
for file in os.listdir(paths.data.raw(date)):
fields = {}
if file.endswith(".npy"):
#TODO: raise FileNotFoundError
filename = os.path.splitext(file)[0]
write.prep_dir(paths.spatial.geom_dir(filename, date))
fields[filename] = np.load(os.path.join(paths.data.raw(date), file))
for component_index in range(len(fields[filename])):
component = conversion[component_index]
for z_index in range(len(fields[filename][component_index])):
pd.DataFrame(np.flip(fields[filename][component_index][z_index])) \
.to_csv(paths.spatial.spatial_path(
filename, component, z_index, date), sep="\t", index=False
)

@anweiteck anweiteck self-assigned this Jan 8, 2022
@qitianshi qitianshi changed the title raise FileNotFound error convert_npy fails silently if no .npy files are found Jan 8, 2022
@qitianshi qitianshi changed the title convert_npy fails silently if no .npy files are found convert_npy fails silently if no .npy files are found Jan 8, 2022
@qitianshi qitianshi changed the title convert_npy fails silently if no .npy files are found convert_npy fails silently if no .npy files are found Jan 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant