Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
#153 fixed region select bug 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof (Chris) Bernat committed Mar 20, 2017
1 parent c19efeb commit 65c747f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cate/ds/esa_cci_odp.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,11 +625,6 @@ def make_local(self,
geo_lon_min = float(remote_dataset.attrs.get('geospatial_lon_min'))
geo_lon_max = float(remote_dataset.attrs.get('geospatial_lon_max'))

lat_min = geo_lat_min
lat_max = geo_lat_max
lon_min = geo_lon_min
lon_max = geo_lon_max

if region:
geo_lat_res = float(remote_dataset.attrs.get('geospatial_lon_resolution'))
geo_lon_res = float(remote_dataset.attrs.get('geospatial_lat_resolution'))
Expand All @@ -645,6 +640,11 @@ def make_local(self,
lat=slice(lat_min, lat_max),
lon=slice(lon_min, lon_max))

geo_lat_min += lat_min * geo_lat_res
geo_lat_max += lat_max * geo_lat_res
geo_lon_min += lon_min * geo_lon_res
geo_lon_max += lon_max * geo_lon_res

if not var_names:
var_names = [var_name for var_name in remote_netcdf.variables.keys()]
var_names.extend([coord_name for coord_name in remote_dataset.coords.keys()
Expand All @@ -660,10 +660,10 @@ def make_local(self,
child_monitor.progress(work=1, msg=sel_var_name)

if region:
local_netcdf.set_attribute('geospatial_lat_min', lat_min * geo_lat_res + geo_lat_min)
local_netcdf.set_attribute('geospatial_lat_max', lat_max * geo_lat_res + geo_lat_min)
local_netcdf.set_attribute('geospatial_lon_min', lon_min * geo_lon_res + geo_lon_min)
local_netcdf.set_attribute('geospatial_lon_max', lon_max * geo_lon_res + geo_lon_min)
local_netcdf.set_attribute('geospatial_lat_min', geo_lat_min)
local_netcdf.set_attribute('geospatial_lat_max', geo_lat_max)
local_netcdf.set_attribute('geospatial_lon_min', geo_lon_min)
local_netcdf.set_attribute('geospatial_lon_max', geo_lon_max)
except:
raise
finally:
Expand Down

0 comments on commit 65c747f

Please sign in to comment.