Skip to content

Commit

Permalink
add geotransform and crs
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdawn committed Oct 17, 2023
1 parent 087aec3 commit adb45a4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions satpy/readers/emit_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from datetime import datetime

import numpy as np
from pyproj import CRS
from affine import Affine
from pyresample.geometry import SwathDefinition
from satpy.readers.netcdf_utils import NetCDF4FileHandler
from satpy.utils import get_legacy_chunk_size
Expand Down Expand Up @@ -76,6 +78,16 @@ def sensor(self):
"""Get sensor."""
return self["/attr/instrument"]

@property
def spatial_ref(self):
"""Get spatial_ref."""
return self["/attr/spatial_ref"]

@property
def geotransform(self):
"""Get geotransform."""
return self["/attr/geotransform"]

@property
def attrs(self):
"""Return attributes."""
Expand Down Expand Up @@ -153,6 +165,10 @@ def get_dataset(self, dataset_id, ds_info):
self.get_lonlats()
dataset.attrs['area'] = self.area

# write crs and geotransform
dataset.rio.write_transform(Affine.from_gdal(*self.geotransform), inplace=True)
dataset.rio.write_crs(CRS.from_wkt(self.spatial_ref), inplace=True)

return dataset

def get_lonlats(self):
Expand Down

0 comments on commit adb45a4

Please sign in to comment.