1
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?

asked Sep 10, 2019 at 14:32
1
  • Assuming your xarray array is stored in a variable named arr you should be able to access the values (as a numpy array) by running arr.values. Commented Sep 10, 2019 at 14:38

1 Answer 1

0

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) 
Kadir Şahbaz
78.6k57 gold badges260 silver badges407 bronze badges
answered Sep 11, 2019 at 9:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.