Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
aazuspan committed Aug 27, 2022
1 parent 1eb98c1 commit ee0f422
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions wxee/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ def _millis_to_datetime(millis: str) -> datetime.datetime:

def _replace_if_null(val: Union[ee.String, ee.Number], replacement: Any) -> Any:
"""Take an Earth Engine object and return either the original non-null object or the given replacement if it is null."""
is_null = ee.Algorithms.IsEqual(val, None)
return ee.Algorithms.If(is_null, replacement, val)
return ee.Algorithms.If(val, val, replacement)


def _format_date(d: ee.Date) -> ee.String:
Expand Down

0 comments on commit ee0f422

Please sign in to comment.