From e4777e9911b318f20c7504e7f2e868180b64dfd4 Mon Sep 17 00:00:00 2001 From: weiqi-tori Date: Wed, 30 Oct 2024 18:19:58 +0800 Subject: [PATCH] update coordinate assignment --- city_metrix/layers/cams.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/city_metrix/layers/cams.py b/city_metrix/layers/cams.py index 5a27dd8..ff62e9e 100644 --- a/city_metrix/layers/cams.py +++ b/city_metrix/layers/cams.py @@ -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