From 9af95921cd6d0bf53fb2078a8edfefc4fc4a8de8 Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Mon, 11 Dec 2023 14:50:47 -0500 Subject: [PATCH 01/13] prelim timings --- xpublish_wms/wms/get_map.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index 0060385..c461ffc 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -60,6 +60,7 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: Return the WMS map for the dataset and given parameters """ # Decode request params + start_time = time.time() self.ensure_query_types(ds, query) # Select data according to request @@ -67,6 +68,7 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: da = self.select_time(da) da = self.select_elevation(ds, da) # da = self.select_custom_dim(da) + print(f'Selecting data: {(time.time()-start_time)*1000}') # Render the data using the render that matches the dataset type # The data selection and render are coupled because they are both driven by @@ -74,6 +76,7 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: # use the contoured renderer for regular grid datasets image_buffer = io.BytesIO() render_result = self.render(ds, da, image_buffer, False) + print(f'Render: {(time.time()-start_time)*1000}') if render_result: image_buffer.seek(0) @@ -241,7 +244,7 @@ def render( # return self.render_quad_grid(da, buffer, minmax_only) projection_start = time.time() da = ds.gridded.project(da, self.crs) - logger.debug(f"Projection time: {time.time() - projection_start}") + print(f"Projection time: {time.time() - projection_start}") if minmax_only: da = da.persist() @@ -271,7 +274,7 @@ def render( da.persist() da.y.persist() da.x.persist() - logger.debug(f"dask compute: {time.time() - start_dask}") + print(f"dask compute: {time.time() - start_dask}") start_shade = time.time() cvs = dsh.Canvas( @@ -303,7 +306,7 @@ def render( how="linear", span=(vmin, vmax), ) - logger.debug(f"Shade time: {time.time() - start_shade}") + print(f"Shade time: {time.time() - start_shade}") im = shaded.to_pil() im.save(buffer, format="PNG") From 6cf4cc3da2c4a945f6710ee56fea4ae4fa2105df Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Tue, 12 Dec 2023 16:19:19 -0500 Subject: [PATCH 02/13] added csv timing --- xpublish_wms/wms/get_map.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index c461ffc..6507737 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -59,16 +59,18 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: """ Return the WMS map for the dataset and given parameters """ + #self.timings.clear() # Decode request params - start_time = time.time() + #start_time = time.perf_counter() self.ensure_query_types(ds, query) # Select data according to request da = self.select_layer(ds) - da = self.select_time(da) + #da = self.select_time(da) da = self.select_elevation(ds, da) # da = self.select_custom_dim(da) - print(f'Selecting data: {(time.time()-start_time)*1000}') + #self.timings.append((time.perf_counter()-start_time)*1000) + #print(f'Selecting data: {(time.time()-start_time)*1000}') # Render the data using the render that matches the dataset type # The data selection and render are coupled because they are both driven by @@ -76,9 +78,12 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: # use the contoured renderer for regular grid datasets image_buffer = io.BytesIO() render_result = self.render(ds, da, image_buffer, False) - print(f'Render: {(time.time()-start_time)*1000}') if render_result: image_buffer.seek(0) + #self.timings.append(sum(self.timings)) + #f = open('/home/nicholas/Desktop/MQPTestingServer/get_map_results.csv', 'a') + #f.write(f"{self.timings[0]}, {self.timings[1]}, {self.timings[2]}, {self.timings[3]}, {self.timings[4]}\n") + #f.close() return StreamingResponse(image_buffer, media_type="image/png") @@ -242,9 +247,12 @@ def render( # For now, try to render everything as a quad grid # TODO: FVCOM and other grids # return self.render_quad_grid(da, buffer, minmax_only) - projection_start = time.time() - da = ds.gridded.project(da, self.crs) - print(f"Projection time: {time.time() - projection_start}") + timings=[] + projection_start = time.perf_counter() + da = ds.gridded.project(da, self.crs) # This is blocking? + #print(f"Projection time: {time.time() - projection_start}") + timings.append((time.perf_counter() - projection_start)*1000) + #self.timings[1] = (time.time() - projection_start)*1000 if minmax_only: da = da.persist() @@ -270,13 +278,15 @@ def render( else: vmin, vmax = [None, None] - start_dask = time.time() + start_dask = time.perf_counter() da.persist() da.y.persist() da.x.persist() - print(f"dask compute: {time.time() - start_dask}") + #print(f"dask compute: {time.time() - start_dask}") + #self.timings[2] = (time.time() - start_dask)*1000 + timings.append((time.perf_counter() - start_dask)*1000) - start_shade = time.time() + start_shade = time.perf_counter() cvs = dsh.Canvas( plot_height=self.height, plot_width=self.width, @@ -306,7 +316,12 @@ def render( how="linear", span=(vmin, vmax), ) - print(f"Shade time: {time.time() - start_shade}") + #print(f"Shade time: {time.time() - start_shade}") + #self.timings[3] = (time.time() - start_shade)*1000 + timings.append((time.perf_counter() - start_shade)*1000) + f = open('/home/nicholas/Desktop/MQPTestingServer/get_map_results.csv', 'a') + f.write(f"{timings[0]}, {timings[1]}, {timings[2]}, {sum(timings)}\n") + f.close() im = shaded.to_pil() im.save(buffer, format="PNG") From a0079ca14fc8cef68f9d3a52206914bfc1ff81b8 Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Mon, 22 Jan 2024 18:39:45 -0500 Subject: [PATCH 03/13] Use mask compute once in HYCOMGrid --- xpublish_wms/grid.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xpublish_wms/grid.py b/xpublish_wms/grid.py index 4b3ab72..b7b0dec 100644 --- a/xpublish_wms/grid.py +++ b/xpublish_wms/grid.py @@ -1,3 +1,4 @@ +import time from abc import ABC, abstractmethod from enum import Enum from typing import Any, Optional, Sequence, Tuple, Union @@ -557,7 +558,8 @@ def project(self, da: xr.DataArray, crs: str) -> Any: # create 2 separate DataArrays where points lng>180 are put at the beginning of the array mask_0 = xr.where(da.cf["longitude"] <= 180, 1, 0) - temp_da_0 = da.where(mask_0.compute() == 1, drop=True) + computedMask = mask_0.compute() # Compute once use twice + temp_da_0 = da.where(computedMask == 1, drop=True) da_0 = xr.DataArray( data=temp_da_0, dims=temp_da_0.dims, @@ -566,9 +568,11 @@ def project(self, da: xr.DataArray, crs: str) -> Any: attrs=temp_da_0.attrs, ) - mask_1 = xr.where(da.cf["longitude"] > 180, 1, 0) - temp_da_1 = da.where(mask_1.compute() == 1, drop=True) + #mask_1 = xr.where(da.cf["longitude"] > 180, 1, 0) + + temp_da_1 = da.where(computedMask != 1, drop=True) temp_da_1.cf["longitude"][:] = temp_da_1.cf["longitude"][:] - 360 + da_1 = xr.DataArray( data=temp_da_1, dims=temp_da_1.dims, @@ -578,7 +582,9 @@ def project(self, da: xr.DataArray, crs: str) -> Any: ) # put the 2 DataArrays back together in the proper order + #startTime = time.time() da = xr.concat([da_1, da_0], dim="X") + #print(str(time.time() - startTime)) if crs == "EPSG:4326": da = da.assign_coords({"x": da.cf["longitude"], "y": da.cf["latitude"]}) From 133ea2e808f6cb767a2c9216c17b099dbad2134d Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Tue, 23 Jan 2024 22:32:41 -0500 Subject: [PATCH 04/13] Removed mask for <500 ONLY --- xpublish_wms/grid.py | 2 +- xpublish_wms/wms/get_map.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xpublish_wms/grid.py b/xpublish_wms/grid.py index 4b3ab72..94ae53e 100644 --- a/xpublish_wms/grid.py +++ b/xpublish_wms/grid.py @@ -553,7 +553,7 @@ def mask( return da.where(np_mask.mask == 0) def project(self, da: xr.DataArray, crs: str) -> Any: - da = self.mask(da) + #da = self.mask(da) # create 2 separate DataArrays where points lng>180 are put at the beginning of the array mask_0 = xr.where(da.cf["longitude"] <= 180, 1, 0) diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index 4b2cb17..a3b1a13 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -169,6 +169,8 @@ def select_layer(self, ds: xr.Dataset) -> xr.DataArray: :param ds: :return: """ + if ds.gridded.name == 'hycom': + return ds[self.parameter][0,:-1,] return ds[self.parameter] def select_time(self, da: xr.DataArray) -> xr.DataArray: From d108e53a6892c21e9829d9fc74deac92563e707b Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Wed, 24 Jan 2024 18:25:31 -0500 Subject: [PATCH 05/13] Moved dropping last row inside project function --- xpublish_wms/grid.py | 1 + xpublish_wms/wms/get_map.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/xpublish_wms/grid.py b/xpublish_wms/grid.py index 94ae53e..ec3aa57 100644 --- a/xpublish_wms/grid.py +++ b/xpublish_wms/grid.py @@ -554,6 +554,7 @@ def mask( def project(self, da: xr.DataArray, crs: str) -> Any: #da = self.mask(da) + da = da[0,:-1,] # Drop lng>500 # create 2 separate DataArrays where points lng>180 are put at the beginning of the array mask_0 = xr.where(da.cf["longitude"] <= 180, 1, 0) diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index a3b1a13..4b2cb17 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -169,8 +169,6 @@ def select_layer(self, ds: xr.Dataset) -> xr.DataArray: :param ds: :return: """ - if ds.gridded.name == 'hycom': - return ds[self.parameter][0,:-1,] return ds[self.parameter] def select_time(self, da: xr.DataArray) -> xr.DataArray: From c4bce9801d3f66d541f7735214c6e6450bd3e425 Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Wed, 24 Jan 2024 22:08:23 -0500 Subject: [PATCH 06/13] Keep all times --- xpublish_wms/grid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xpublish_wms/grid.py b/xpublish_wms/grid.py index ec3aa57..98372ce 100644 --- a/xpublish_wms/grid.py +++ b/xpublish_wms/grid.py @@ -554,7 +554,7 @@ def mask( def project(self, da: xr.DataArray, crs: str) -> Any: #da = self.mask(da) - da = da[0,:-1,] # Drop lng>500 + da = da[0:,:-1,] # Drop lng>500 # create 2 separate DataArrays where points lng>180 are put at the beginning of the array mask_0 = xr.where(da.cf["longitude"] <= 180, 1, 0) From 996e644b75a3808c67fa241ab3d419743682f47a Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Thu, 25 Jan 2024 23:38:02 -0500 Subject: [PATCH 07/13] Remove temp data arrays in projection --- xpublish_wms/grid.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/xpublish_wms/grid.py b/xpublish_wms/grid.py index b7b0dec..80210dc 100644 --- a/xpublish_wms/grid.py +++ b/xpublish_wms/grid.py @@ -559,27 +559,12 @@ def project(self, da: xr.DataArray, crs: str) -> Any: # create 2 separate DataArrays where points lng>180 are put at the beginning of the array mask_0 = xr.where(da.cf["longitude"] <= 180, 1, 0) computedMask = mask_0.compute() # Compute once use twice - temp_da_0 = da.where(computedMask == 1, drop=True) - da_0 = xr.DataArray( - data=temp_da_0, - dims=temp_da_0.dims, - name=temp_da_0.name, - coords=temp_da_0.coords, - attrs=temp_da_0.attrs, - ) + da_0 = da.where(computedMask == 1, drop=True) #mask_1 = xr.where(da.cf["longitude"] > 180, 1, 0) - temp_da_1 = da.where(computedMask != 1, drop=True) - temp_da_1.cf["longitude"][:] = temp_da_1.cf["longitude"][:] - 360 - - da_1 = xr.DataArray( - data=temp_da_1, - dims=temp_da_1.dims, - name=temp_da_1.name, - coords=temp_da_1.coords, - attrs=temp_da_1.attrs, - ) + da_1 = da.where(computedMask != 1, drop=True) + da_1.cf["longitude"][:] = da_1.cf["longitude"][:] - 360 # put the 2 DataArrays back together in the proper order #startTime = time.time() From f22106e474a98eb7a7a9f4bec760f7f68a8205c9 Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Tue, 20 Feb 2024 22:38:06 -0500 Subject: [PATCH 08/13] Remove timing tests from HYCOM grid --- xpublish_wms/grid.py | 8 ++------ xpublish_wms/wms/get_map.py | 18 +----------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/xpublish_wms/grid.py b/xpublish_wms/grid.py index 2be37f1..50e0174 100644 --- a/xpublish_wms/grid.py +++ b/xpublish_wms/grid.py @@ -555,22 +555,18 @@ def mask( def project(self, da: xr.DataArray, crs: str) -> Any: #da = self.mask(da) - da = da[0:,:-1,] # Drop lng>500 + da = da[0:,:-1,] # Drop lng>500 # create 2 separate DataArrays where points lng>180 are put at the beginning of the array mask_0 = xr.where(da.cf["longitude"] <= 180, 1, 0) - computedMask = mask_0.compute() # Compute once use twice + computedMask = mask_0.compute() da_0 = da.where(computedMask == 1, drop=True) - #mask_1 = xr.where(da.cf["longitude"] > 180, 1, 0) - da_1 = da.where(computedMask != 1, drop=True) da_1.cf["longitude"][:] = da_1.cf["longitude"][:] - 360 # put the 2 DataArrays back together in the proper order - #startTime = time.time() da = xr.concat([da_1, da_0], dim="X") - #print(str(time.time() - startTime)) if crs == "EPSG:4326": da = da.assign_coords({"x": da.cf["longitude"], "y": da.cf["latitude"]}) diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index 4b2cb17..695f589 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -59,7 +59,6 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: """ Return the WMS map for the dataset and given parameters """ - #self.timings.clear() # Decode request params #start_time = time.perf_counter() self.ensure_query_types(ds, query) @@ -69,7 +68,7 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: #da = self.select_time(da) da = self.select_elevation(ds, da) # da = self.select_custom_dim(da) - #self.timings.append((time.perf_counter()-start_time)*1000) + #print(f'Selecting data: {(time.time()-start_time)*1000}') # Render the data using the render that matches the dataset type @@ -80,10 +79,6 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: render_result = self.render(ds, da, image_buffer, False) if render_result: image_buffer.seek(0) - #self.timings.append(sum(self.timings)) - #f = open('/home/nicholas/Desktop/MQPTestingServer/get_map_results.csv', 'a') - #f.write(f"{self.timings[0]}, {self.timings[1]}, {self.timings[2]}, {self.timings[3]}, {self.timings[4]}\n") - #f.close() return StreamingResponse(image_buffer, media_type="image/png") @@ -254,12 +249,8 @@ def render( # For now, try to render everything as a quad grid # TODO: FVCOM and other grids # return self.render_quad_grid(da, buffer, minmax_only) - timings=[] - projection_start = time.perf_counter() da = ds.gridded.project(da, self.crs) # This is blocking? #print(f"Projection time: {time.time() - projection_start}") - timings.append((time.perf_counter() - projection_start)*1000) - #self.timings[1] = (time.time() - projection_start)*1000 if minmax_only: da = da.persist() @@ -290,8 +281,6 @@ def render( da.y.persist() da.x.persist() #print(f"dask compute: {time.time() - start_dask}") - #self.timings[2] = (time.time() - start_dask)*1000 - timings.append((time.perf_counter() - start_dask)*1000) start_shade = time.perf_counter() cvs = dsh.Canvas( @@ -327,11 +316,6 @@ def render( span=(vmin, vmax), ) #print(f"Shade time: {time.time() - start_shade}") - #self.timings[3] = (time.time() - start_shade)*1000 - timings.append((time.perf_counter() - start_shade)*1000) - f = open('/home/nicholas/Desktop/MQPTestingServer/get_map_results.csv', 'a') - f.write(f"{timings[0]}, {timings[1]}, {timings[2]}, {sum(timings)}\n") - f.close() im = shaded.to_pil() im.save(buffer, format="PNG") From f8cb854c2bd05489092edd972fa30ad5d1269034 Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Tue, 20 Feb 2024 22:47:25 -0500 Subject: [PATCH 09/13] Reinsert uvicorn debug log --- xpublish_wms/wms/get_map.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index 695f589..3b2f589 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -60,7 +60,6 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: Return the WMS map for the dataset and given parameters """ # Decode request params - #start_time = time.perf_counter() self.ensure_query_types(ds, query) # Select data according to request @@ -69,8 +68,6 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: da = self.select_elevation(ds, da) # da = self.select_custom_dim(da) - #print(f'Selecting data: {(time.time()-start_time)*1000}') - # Render the data using the render that matches the dataset type # The data selection and render are coupled because they are both driven by # The grid type for now. This can be revisited if we choose to interpolate or @@ -249,8 +246,9 @@ def render( # For now, try to render everything as a quad grid # TODO: FVCOM and other grids # return self.render_quad_grid(da, buffer, minmax_only) - da = ds.gridded.project(da, self.crs) # This is blocking? - #print(f"Projection time: {time.time() - projection_start}") + projection_start = time.time() + da = ds.gridded.project(da, self.crs) + logger.debug(f"Projection time: {time.time() - projection_start}") if minmax_only: da = da.persist() @@ -276,13 +274,13 @@ def render( else: vmin, vmax = [None, None] - start_dask = time.perf_counter() + start_dask = time.time() da.persist() da.y.persist() da.x.persist() - #print(f"dask compute: {time.time() - start_dask}") + logger.debug(f"dask compute: {time.time() - start_dask}") - start_shade = time.perf_counter() + start_shade = time.time() cvs = dsh.Canvas( plot_height=self.height, plot_width=self.width, @@ -315,7 +313,7 @@ def render( how="linear", span=(vmin, vmax), ) - #print(f"Shade time: {time.time() - start_shade}") + logger.debug(f"Shade time: {time.time() - start_shade}") im = shaded.to_pil() im.save(buffer, format="PNG") From e12fc063b66f82817a5ecc2dd3e920d8fd24e786 Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Tue, 20 Feb 2024 22:54:22 -0500 Subject: [PATCH 10/13] Re enable time --- xpublish_wms/wms/get_map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index 3b2f589..4a4458f 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -64,7 +64,7 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: # Select data according to request da = self.select_layer(ds) - #da = self.select_time(da) + da = self.select_time(da) da = self.select_elevation(ds, da) # da = self.select_custom_dim(da) From 79f3d9ad7ee84c46436f306a1855b96596c2d7b5 Mon Sep 17 00:00:00 2001 From: Nicholas Markou Date: Tue, 20 Feb 2024 23:11:11 -0500 Subject: [PATCH 11/13] Moved dropping lng<500 before time selection --- xpublish_wms/grid.py | 1 - xpublish_wms/wms/get_map.py | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/xpublish_wms/grid.py b/xpublish_wms/grid.py index 50e0174..0e82095 100644 --- a/xpublish_wms/grid.py +++ b/xpublish_wms/grid.py @@ -555,7 +555,6 @@ def mask( def project(self, da: xr.DataArray, crs: str) -> Any: #da = self.mask(da) - da = da[0:,:-1,] # Drop lng>500 # create 2 separate DataArrays where points lng>180 are put at the beginning of the array mask_0 = xr.where(da.cf["longitude"] <= 180, 1, 0) diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index 4a4458f..b791967 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -64,6 +64,8 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: # Select data according to request da = self.select_layer(ds) + if ds.gridded.name == 'hycom': + da = da[0:, :-1, ] # Drop lng>500 on HYCOM Grid. This has to be done before select_time(da) is ran. da = self.select_time(da) da = self.select_elevation(ds, da) # da = self.select_custom_dim(da) From 3c717c068665678e9dcab8a8517a3ea8b6664605 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 03:04:38 +0000 Subject: [PATCH 12/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xpublish_wms/grid.py | 2 +- xpublish_wms/wms/get_map.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/xpublish_wms/grid.py b/xpublish_wms/grid.py index 0e82095..dc3ac44 100644 --- a/xpublish_wms/grid.py +++ b/xpublish_wms/grid.py @@ -554,7 +554,7 @@ def mask( return da.where(np_mask.mask == 0) def project(self, da: xr.DataArray, crs: str) -> Any: - #da = self.mask(da) + # da = self.mask(da) # create 2 separate DataArrays where points lng>180 are put at the beginning of the array mask_0 = xr.where(da.cf["longitude"] <= 180, 1, 0) diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index b791967..9c9be5d 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -64,8 +64,11 @@ def get_map(self, ds: xr.Dataset, query: dict) -> StreamingResponse: # Select data according to request da = self.select_layer(ds) - if ds.gridded.name == 'hycom': - da = da[0:, :-1, ] # Drop lng>500 on HYCOM Grid. This has to be done before select_time(da) is ran. + if ds.gridded.name == "hycom": + da = da[ + 0:, + :-1, + ] # Drop lng>500 on HYCOM Grid. This has to be done before select_time(da) is ran. da = self.select_time(da) da = self.select_elevation(ds, da) # da = self.select_custom_dim(da) From 90098ff7ae2311ade7039d133f8195a47aa9c1e7 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 23 Feb 2024 16:12:20 -0500 Subject: [PATCH 13/13] Remove import time --- xpublish_wms/grid.py | 1 - 1 file changed, 1 deletion(-) diff --git a/xpublish_wms/grid.py b/xpublish_wms/grid.py index dc3ac44..f0f4647 100644 --- a/xpublish_wms/grid.py +++ b/xpublish_wms/grid.py @@ -1,4 +1,3 @@ -import time from abc import ABC, abstractmethod from enum import Enum from typing import Any, Optional, Sequence, Tuple, Union