Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

subset_spatial op very slow with non-trivial polygons #508

Closed
forman opened this issue Jan 14, 2018 · 1 comment
Closed

subset_spatial op very slow with non-trivial polygons #508

forman opened this issue Jan 14, 2018 · 1 comment

Comments

@forman
Copy link
Member

forman commented Jan 14, 2018

Problem

subset_spatial op is very slow (too slow) with mask=True and region being a non-trivial polygons and when many grid cells have to be compared.

This is probably because we compare for each grid cell individually if it intersects the polygon. Would be more efficient if we create the mask by rendering the polygon as a masked numpy array (binary image).

Steps

In Cate Desktop:

  1. Select operation read_necdf and add step with with file name e.g. "20100401120000-ESACCI-L4_GHRSST-SSTdepth-OSTIA-GLOB_LT-v02.0-fv01.1.nc"
  2. From countries layer select Germany (yes, SST is an ocean product, but still there are many coastal cells this way)
  3. Select operation subset_spatial and add step with ds_1, the selected POLYGON and mask on.

This actually computes forever.

Specifications

Cate 1.1 dev1

@JanisGailis
Copy link
Member

Note to self - start with profiling the code

JanisGailis pushed a commit that referenced this issue Mar 9, 2018
JanisGailis pushed a commit that referenced this issue Mar 9, 2018
A drastic improvement in performance from 4s -> 0.1s

Fixes #508
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants