Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeline and dataframe fail when system:time_end is missing #45

Closed
aazuspan opened this issue Nov 24, 2021 · 0 comments
Closed

timeline and dataframe fail when system:time_end is missing #45

aazuspan opened this issue Nov 24, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@aazuspan
Copy link
Owner

Some collections (at least Landsat 7) are missing system:time_end properties for most images, even though they have system:time_start properties. This causes dataframe to fail because the fields used to initialize the pd.Dataframe are of different lengths. I'll probably drop system:time_end from dataframe since it's rarely useful and filling missing values is not supported by aggregate_array.

Reproduce

pt = ee.Geometry.Point([-121.690476, 45.432933])

(wxee.TimeSeries("LANDSAT/LE07/C01/T1_SR")
      .filterBounds(pt).timeline()
)

Traceback

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-53-af49cab8b808> in <module>
      1 pt = ee.Geometry.Point([-121.690476, 45.432933])
      2 
----> 3 (wxee.TimeSeries("LANDSAT/LE07/C01/T1_SR")
      4       .filterBounds(pt).timeline()
      5 )

~\anaconda3\envs\gee\lib\site-packages\wxee\time_series.py in timeline(self)
    151             A Plotly graph object interactive plot showing the acquisition time of each image in the time series.
    152         """
--> 153         df = self.dataframe()
    154         df["y"] = 0
    155 

~\anaconda3\envs\gee\lib\site-packages\wxee\time_series.py in dataframe(self)
    139         ends = [_millis_to_datetime(ms) for ms in ends_millis]
    140 
--> 141         df = pd.DataFrame({"id": ids, "time_start": starts, "time_end": ends})
    142         df.index.id = collection_id
    143         return df

~\anaconda3\envs\gee\lib\site-packages\pandas\core\frame.py in __init__(self, data, index, columns, dtype, copy)
    527 
    528         elif isinstance(data, dict):
--> 529             mgr = init_dict(data, index, columns, dtype=dtype)
    530         elif isinstance(data, ma.MaskedArray):
    531             import numpy.ma.mrecords as mrecords

~\anaconda3\envs\gee\lib\site-packages\pandas\core\internals\construction.py in init_dict(data, index, columns, dtype)
    285             arr if not is_datetime64tz_dtype(arr) else arr.copy() for arr in arrays
    286         ]
--> 287     return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
    288 
    289 

~\anaconda3\envs\gee\lib\site-packages\pandas\core\internals\construction.py in arrays_to_mgr(arrays, arr_names, index, columns, dtype, verify_integrity)
     78         # figure out the index, if necessary
     79         if index is None:
---> 80             index = extract_index(arrays)
     81         else:
     82             index = ensure_index(index)

~\anaconda3\envs\gee\lib\site-packages\pandas\core\internals\construction.py in extract_index(data)
    399             lengths = list(set(raw_lengths))
    400             if len(lengths) > 1:
--> 401                 raise ValueError("arrays must all be same length")
    402 
    403             if have_dicts:

ValueError: arrays must all be same length
@aazuspan aazuspan added the bug Something isn't working label Nov 24, 2021
@aazuspan aazuspan self-assigned this Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant