Skip to content

Commit

Permalink
update coordinate assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqi-tori committed Oct 30, 2024
1 parent 459cd43 commit e4777e9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions city_metrix/layers/cams.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,11 @@ def get_data(self, bbox):
else dataarray
for dataarray in dataarray_list
]
# drop coordinate ['latitude','longitude'] if uses 360 degree system
# assign coordinate with last dataarray to fix 1) use 360 degree system issue 2) slightly different lat lons
dataarray_list = [
dataarray.drop_vars(['latitude', 'longitude'])
if (dataarray['longitude'].values > 180).any()
else dataarray
dataarray.assign_coords(dataarray_list[-1].coords)
for dataarray in dataarray_list
]
dataarray_list[0] = dataarray_list[0].assign_coords(dataarray_list[1].coords)
data = xr.merge(dataarray_list)

# unit conversion
Expand Down

0 comments on commit e4777e9

Please sign in to comment.