dask.array<shape=(76, 76), dtype=float32, chunksize=(76, 76)>
Coordinates:
crs object +proj=utm +datum=WGS84 +ellps=WGS84 +no_defs +units=m +zone=33.0 +type=crs
* y (y) float64 4.006e+06 4.006e+06 4.005e+06 ... 3.951e+06 3.95e+06
* x (x) float64 4.094e+05 4.104e+05 4.114e+05 ... 4.832e+05 4.842e+05
Attributes:
sensor: slstr
view: n
polarization: None
standard_name: toa_brightness_temperature
coordinates: ('longitude_in', 'latitude_in')
resolution: 1000
wavelength: (10.4, 10.85, 11.3)
file_type: esa_l1b_ntir
long_name: Gridded pixel brightness temperature for channel S8...
units: K
level: None
calibration: brightness_temperature
name: S8_in
platform_name: Sentinel-3A
modifiers: ()
start_time: 2018年07月20日 09:12:25.111891
end_time: 2018年07月20日 09:15:24.803164
area: Area ID: LS8_duplicate\nDescription: Patch subset i...
ancillary_variables: []
I have this Xarray which resulted from reading and resampling a NetCDF file using satpy.
newscn = scn.resample(area_def, resampler='nearest')
Printing the newscn results in an xarray. How can I extract the (76, 76) array with float32 values as a numpy array?
1 Answer 1
To resolve this matter after I loaded the new scene using
newscn.load([filename_S8])
where filename_S8 = 'S8_in'
as I want to read the the thermal band 8 from the Sentinel 3 data product. Then I used this line to access the (76, 76) image array as a numpy array:
Arr = newscn[filename_S8]
S3_BT = Arr.compute().data
print(S3_BT)
xarray
array is stored in a variable namedarr
you should be able to access the values (as anumpy
array) by runningarr.values
.