use nanmin/nanmax for subgrid extraction