Github user huikyole commented on a diff in the pull request:

    https://github.com/apache/climate/pull/381#discussion_r73282237
  
    --- Diff: ocw/dataset.py ---
    @@ -280,57 +296,44 @@ def __init__(self, lat_min, lat_max, lon_min,
             else:
                 self._end = None
     
    -    @property
    -    def lat_min(self):
    -        return self._lat_min
    -
    -    @lat_min.setter
    -    def lat_min(self, value):
    -        if not (-90 <= value <= 90 and value < self._lat_max):
    -            error = "Attempted to set lat_min to invalid value: %s" % 
(value)
    -            logger.error(error)
    -            raise ValueError(error)
    -
    -        self._lat_min = value
    -
    -    @property
    -    def lat_max(self):
    -        return self._lat_max
    -
    -    @lat_max.setter
    -    def lat_max(self, value):
    -        if not (-90 <= value <= 90 and value > self._lat_min):
    -            error = "Attempted to set lat_max to invalid value: %s" % 
(value)
    -            logger.error(error)
    -            raise ValueError(error)
    -
    -        self._lat_max = value
    -
    -    @property
    -    def lon_min(self):
    -        return self._lon_min
    -
    -    @lon_min.setter
    -    def lon_min(self, value):
    -        if not (-180 <= value <= 180 and value < self._lon_max):
    -            error = "Attempted to set lon_min to invalid value: %s" % 
(value)
    -            logger.error(error)
    -            raise ValueError(error)
    -
    -        self._lon_min = value
    -
    -    @property
    -    def lon_max(self):
    -        return self._lon_max
    -
    -    @lon_max.setter
    -    def lon_max(self, value):
    -        if not (-180 <= value <= 180 and value > self._lon_min):
    -            error = "Attempter to set lon_max to invalid value: %s" % 
(value)
    -            logger.error(error)
    -            raise ValueError(error)
    -
    -        self._lon_max = value
    +        if boundary_type == 'us_states':
    +            self.masked_regions = shapefile_boundary(boundary_type, 
us_states)
    +        if boundary_type == 'countries':
    +            self.masked_regions = shapefile_boundary(boundary_type, 
countries)
    +        if boundary_type == 'user':
    +            file_object = netCDF4.Dataset(user_mask_file)
    +            self.mask_variable = 
file_object.variables[mask_variable_name][:]
    +            mask_longitude = file_object.variables[longitude_name][:]
    +            mask_latitude = file_object.variables[latitude_name][:]
    +            if mask_longitude.ndim == 1 and mask_latitude.ndim == 1:
    +                self.mask_longitude, self.mask_latitude = 
numpy.meshgrid(mask_longitude, mask_latitude)
    +            elif mask_longitude.ndim == 2 and mask_latitude.ndim == 2:
    +                self.mask_longitude = mask_longitude
    +                self.mask_latitude = mask_latitude  
    +        if boundary_type == 'rectangular':
    --- End diff --
    
    This is a great suggestion!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to