Skip to content

Download size with MB #85

@alexisahedo

Description

@alexisahedo

Hello everyone,
Thanks a lot for all your hard work developing this tool, it has been very helpful to me in my work.

I’ll like to report a problem with the method “download_size” in the Class “Proyect.py” of “ost” directory, in my query I have a series of Sentinel-1 images that have less than 1 Gb of information, and the method cannot transform the str to a flout because mb is not deleted from the str, so it shot an error (or that's what I understand) and I’m not able to know the complete download size of my search.


Terminal error:

Traceback (most recent call last):
File "path/ost_prueba_01/ost_download_test01.py", line 120, in
ost_s1.download_size(ost_s1.refine_inventory())
File "path/envs/virtualenv/lib/python3.6/site-packages/ost/Project.py", line 330, in download_size
self.inventory["size"].str.replace(" GB", "").astype("float32").sum()
File "path/envs/virtualenv/lib/python3.6/site-packages/pandas/core/generic.py", line 5546, in astype
new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors,)
File "path/envs/virtualenv/lib/python3.6/site-packages/pandas/core/internals/managers.py", line 595, in astype
return self.apply("astype", dtype=dtype, copy=copy, errors=errors)
File "path/envs/virtualenv/lib/python3.6/site-packages/pandas/core/internals/managers.py", line 406, in apply
applied = getattr(b, f)(**kwargs)
File "path/envs/virtualenv/lib/python3.6/site-packages/pandas/core/internals/blocks.py", line 595, in astype
values = astype_nansafe(vals1d, dtype, copy=True)
File "path/envs/virtualenv/lib/python3.6/site-packages/pandas/core/dtypes/cast.py", line 995, in astype_nansafe
return arr.astype(dtype, copy=True)
ValueError: could not convert string to float: '887.4 MB'


Script of "download_size":

def download_size(self, inventory_df=None):
"""Function to get the total size of all products when extracted in GB
:param inventory_df:
:return:
"""
if inventory_df is None:
download_size = (
self.inventory["size"].str.replace(" GB", "").astype("float32").sum()
)
else:
download_size = (
inventory_df["size"].str.replace(" GB", "").astype("float32").sum()
)

    logger.info(f"There are about {download_size} GB need to be downloaded.")

I’m not a programmer so I’m not able to give more information about the issue.
Thanks a lot.

Alexis A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions