Make this function (scale_grid) work correctly when subsetting an array drops it down to 2D

Description

scale_grid() has two problems:

  1. It should be smarter about the lat,lon maps - to support Grids of dim >2 it needs to assume, at the minimum, that the lat and lon maps are the rightmost two maps.

  2. It should test that the Array has been subset down to only two dimensions

  3. Check the axis order - the same kind of reversal that may be in scale_array() is also likely here

depth[108][lat=480][lon=480] = ?depth[0:1:107][0:10:4799][0:10:4799];

?scale_grid(depth[1][][],48,48) ← this fails because the be parser baulks on the array subset Actually, this fails because scale_grid() blindly uses the first two dims for lat and lon. It should use, at a minimum, the rightmost two dims (although better code would actually look at metadata and figure out which two should be used and check that the rest are sliced to a single element).

?scale_grid(depth,48,48) ← this fails because depth is 3D (This is addressed in Hyrax-281)

most of the comments relate to an earlier problem where the function was very slow. This was determined to be an issue with a particular data set that had odd chunking parameters that made access to the whole array very slow. Ignore them

Environment

None

Assignee

Slav Korolev

Reporter

James Gallagher

Labels

Time tracking

16h

Sprint

None

Priority

Highest
Configure