Skip to content

error with coarsest_resolution_finer_or_equal_ms() #127

@mbauer288

Description

@mbauer288
# Determine the STARE time resolution
#   example: times = array([1800000])
times = numpy.array([self.imerg_tstep], dtype=numpy.int64)
time_res_array = pystare.coarsest_resolution_finer_or_equal_ms(times)

# inside temporal.coarsest_resolution_finer_or_equal_ms()
milliseconds = array([1800000]) type(milliseconds) = <class 'numpy.ndarray'>
milliseconds.size = 1

Throws error, were it didn't previously with the same inputs.

  File "/Users/mbauer/SpatioTemporal/STAREPandas/starepandas/io/granules/imergl3.py", line 225, in __init__
    time_res_array = pystare.coarsest_resolution_finer_or_equal_ms(times)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  File "/Users/mbauer/SpatioTemporal/pystare/pystare/temporal.py", line 166, in coarsest_resolution_finer_or_equal_ms
    resolutions = pystare.core._coarsest_resolution_finer_or_equal_milliseconds(numpy.array([milliseconds]))[0]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
   File "/Users/mbauer/SpatioTemporal/pystare/pystare/core.py", line 286, in _coarsest_resolution_finer_or_equal_milliseconds
    return _core._coarsest_resolution_finer_or_equal_milliseconds(milliseconds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Array must have 1 dimensions.  Given array has 2 dimensions

Ah, note that

numpy.array([milliseconds]) = array([[1800000]])

which should be `array([1800000]) inside:

if milliseconds.size == 1:
        resolutions = 
         pystare.core._coarsest_resolution_finer_or_equal_milliseconds(numpy.array([milliseconds]))[0]

So I shouldn't pass a numpy.array into pystare.coarsest_resolution_finer_or_equal_ms() anymore?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions