Skip to content

Commit

Permalink
Merge pull request #15 from ShervanGharari/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ShervanGharari authored May 6, 2021
2 parents 761850a + aca146c commit 08b4792
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 46 deletions.
23 changes: 14 additions & 9 deletions easymore/easymore.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ def nc_remapper(self):
# create the source shapefile for case 1 and 2 if shapefile is not provided
if (self.case == 1 or self.case == 2) and (self.source_shp == ''):
if self.case == 1:
self.lat_lon_SHP(self.lat_expanded, self.lon_expanded,\
self.temp_dir+self.case_name+'_source_shapefile.shp')
if hasattr(self, 'lat_expanded') and hasattr(self, 'lon_expanded'):
self.lat_lon_SHP(self.lat_expanded, self.lon_expanded,\
self.temp_dir+self.case_name+'_source_shapefile.shp')
else:
self.lat_lon_SHP(self.lat, self.lon,\
self.temp_dir+self.case_name+'_source_shapefile.shp')
else:
self.lat_lon_SHP(self.lat, self.lon,\
self.temp_dir+self.case_name+'_source_shapefile.shp')
Expand Down Expand Up @@ -574,6 +578,11 @@ def NetCDF_SHP_lat_lon(self):
lon_temp_diff_unique = np.unique(lon_temp_diff)
#print(lon_temp_diff_unique)
#print(lon_temp_diff_unique.shape)
# save lat, lon into the object
lat = np.array(lat).astype(float)
lon = np.array(lon).astype(float)
self.lat = lat
self.lon = lon
# expanding just for the the creation of shapefile with first last rows and columns
if (len(lat_temp_diff_unique)==1) and (len(lon_temp_diff_unique)==1): # then lat lon are spaced equal
# create expanded lat
Expand All @@ -590,13 +599,9 @@ def NetCDF_SHP_lat_lon(self):
lon_expanded [:,-1] = lon_expanded [:,-2] + (lon_expanded [:,-2] - lon_expanded [:,-3]) # populate right column
lon_expanded [0, :] = lon_expanded [1, :] + (lon_expanded [1, :] - lon_expanded [2, :]) # populate top row
lon_expanded [-1,:] = lon_expanded [-2,:] + (lon_expanded [-2,:] - lon_expanded [-3,:]) # populate bottom row
#
lat = np.array(lat).astype(float)
lon = np.array(lon).astype(float)
self.lat = lat
self.lon = lon
self.lat_expanded = lat_expanded
self.lon_expanded = lon_expanded
# pass to the lat, lon extended
self.lat_expanded = lat_expanded
self.lon_expanded = lon_expanded
# case #2 rotated lat/lon
if (len(ncid.variables[self.var_lat].dimensions)==2) and (len(ncid.variables[self.var_lon].dimensions)==2):
print('EASYMORE detects case 2 - rotated lat/lon')
Expand Down
29 changes: 1 addition & 28 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1 @@
numpy==1.19.2
Shapely==1.7.1
pytz==2021.1
six==1.15.0
python-dateutil==2.8.1
pandas==1.2.3
click==7.1.2
munch==2.5.0
cligj==0.7.1
click-plugins==1.1.1
attrs==20.3.0
certifi==2020.12.5
Fiona==1.8.18
pyproj==3.0.1
geopandas==0.9.0
setuptools==49.6.0
xarray==0.17.0
cftime==1.4.1
netCDF4==1.5.6
zope.interface==5.3.0
DateTime==4.3
simpledbf==0.2.6
pyshp==2.1.3
osgeo==0.0.0
pysheds==0.2.7
geovoronoi==0.3.0
json5==0.9.5
rasterio==1.2.1
.
19 changes: 10 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@
'environmental modeling'],
install_requires=[
'numpy',
'geopandas >= 0.8.1',
'xarray',
'pandas',
'shapely',
'netCDF4',
'datetime',
'simpledbf',
'pyshp',
'pysheds',
'osgeo',
'geovoronoi',
'json5',
'rasterio',
],
extras_require={
":python_version>'3.6'":['geopandas >= 0.8.1',
'shapely',
'pyshp',
'pysheds',
'osgeo',
'geovoronoi',
'json5',
'rasterio']
},
description=(
'geo-spatial processing of the input data for environmental and hydrological modeling'
),
Expand Down

0 comments on commit 08b4792

Please sign in to comment.