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

    https://github.com/apache/climate/pull/381#discussion_r73282263
  
    --- Diff: ocw/dataset.py ---
    @@ -360,20 +363,63 @@ def end(self, value):
     
             self._end = value
     
    -    def __str__(self):
    -        lat_range = "({}, {})".format(self._lat_min, self._lat_max)
    -        lon_range = "({}, {})".format(self._lon_min, self._lon_max)
    -        temporal_boundaries = "({}, {})".format(self._start, self._end)
    +def shapefile_boundary(boundary_type, region_names):
    +    '''
    +    :param boundary_type: The type of spatial subset boundary
    +    :type boundary_type: :mod:'string'
     
    -        formatted_repr = (
    -            "<Bounds - "
    -            "lat-range: {}, "
    -            "lon-range: {}, "
    -            "temporal_boundaries: {}> "
    -        )
    +    :param region_names: An array of regions for spatial subset
    +    :type region_names: :mod:'list'
    +    '''
     
    -        return formatted_repr.format(
    -            lat_range,
    -            lon_range,
    -            temporal_boundaries,
    -        )
    +    map_read = Basemap()
    +    regions =[]
    +    if boundary_type == 'us_states':
    +        
map_read.readshapefile(ocw.__path__[0]+'/shape/usa_states','usa_states')
    +        
#map_read.readshapefile('/home/huikyole/climate/ocw'+'/shape/usa_states','usa_states')
    +        for region_name in region_names:
    +            for iregion, region_info in 
enumerate(map_read.usa_states_info):
    +                if region_info['st'] == region_name:
    +                    
regions.append(numpy.array(map_read.usa_states[iregion]))
    +    if boundary_type == 'countries':
    +        
map_read.readshapefile(ocw.__path__[0]+'/shape/countries','countries')
    +        
#map_read.readshapefile('/home/huikyole/climate/ocw'+'/shape/countries','countries')
    +        for region_name in region_names:
    +            for iregion, region_info in enumerate(map_read.countries_info):
    +                if region_info['COUNTRY'] == region_name:
    +                    
regions.append(numpy.array(map_read.countries[iregion]))
    +    return regions
    +
    --- End diff --
    
    The shape files have been added in the revised pull request. Thanks!


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