arlmet.Grid.subset#

Grid.subset(window)[source]#

Build a new grid definition for a rectangular subset.

Parameters:

window (GridWindow) – Zero-based half-open window into the parent grid.

Returns:

New grid whose cells are the window’s cells of this grid, at the same positions.

Return type:

Grid

Notes

A projected grid keeps this grid’s sync point (sync_lat, sync_lon) and moves only its grid coordinates, sync_x and sync_y, by the window’s start, so they may lie outside the subset (sync_y = -326 for a crop that starts at row 328). A new corner sync point would be the corner cell’s latitude and longitude, which the index record stores as 7 characters (0.01 degree for a longitude past 100 degrees): the whole subset would move by up to 0.15 cells of a 3 km grid. HYSPLIT’s map routines take a sync point anywhere.

A lat-lon grid’s sync point is always its first cell (HYSPLIT ignores sync_x and sync_y there), so the subset’s is the window’s corner cell, a whole number of cells from this grid’s. It is stored exactly when the spacing is a multiple of 0.01 degree. The subset is written as HYSPLIT’s xtrct_grid writes a crop: sync_lon in 0-360 east and pole_lat/pole_lon its last cell, so pole_lon can pass 360. HYSPLIT’s gbl2xy measures a longitude from a negative sync_lon only when pole_lon is not negative (gblset’s PRIME); a 0-360 sync_lon needs no such case. The window covering the whole grid returns this grid unchanged.