Skip to content

Commit

Permalink
Use lat/lon grids for initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenwh committed Jun 9, 2024
1 parent cf52890 commit 7c5af87
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nansat/mappers/mapper_netcdf_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,18 @@ def _create_empty_from_subdatasets(self, gdal_dataset, metadata):
no_projection = False
break
if no_projection:
#raise NansatMissingProjectionError
sub_datasets = gdal_dataset.GetSubDatasets()
filenames = [f[0] for f in sub_datasets]
for _, filename in enumerate(filenames):
if 'longitude' in filename:
xDatasetSource = filename
if 'latitude' in filename:
yDatasetSource = filename
if not "xDatasetSource" in locals():
raise NansatMissingProjectionError
if not "yDatasetSource" in locals():
raise NansatMissingProjectionError
lon_dataset = gdal.Open(xDatasetSource)
lon = lon_dataset.GetRasterBand(1).ReadAsArray()
lat_dataset = gdal.Open(yDatasetSource)
Expand Down

0 comments on commit 7c5af87

Please sign in to comment.