Commit 0b7607fc authored by Anthony's avatar Anthony
Browse files

Some changes in HydroDATA_shapefile

parent 1cb59d7e
......@@ -32,11 +32,11 @@ class GlobalGrid:
def __init__(self, fdir, input_type):
# Get the coordinates
nc = Dataset(fdir, "r")
griddesc, self.lon, self.lat, self.res_lon, self.res_lat = MG.getcoordinates(nc, 0, -1, 0, -1)
self.nj,self.ni = self.lon.shape
#
self.land = np.full(self.lon.shape, 1); self.nbland = np.sum(self.land)
if input_type == "geogrid":
griddesc, self.lon, self.lat, self.res_lon, self.res_lat = MG.getcoordinates(nc, 0, -1, 0, -1)
self.nj,self.ni = self.lon.shape
# Get the projection
if griddesc['type'] == "lambert_conformal_conic" :
self.proj = PS.LambertC(griddesc['dx'], griddesc['known_lon'], griddesc['known_lat'], griddesc['truelat1'], \
......@@ -49,7 +49,12 @@ class GlobalGrid:
else :
ERROR("Unknown grid type")
sys.exit()
elif input_grid == "hydro":
elif input_type == "hydro":
self.lon=np.copy(nc.variables["nav_lon"][:,:])
self.lat=np.copy(nc.variables["nav_lat"][:,:])
self.nj,self.ni = self.lon.shape
self.res_lon = np.mean(np.abs(np.diff(nc.variables["nav_lon"][0,:])))
self.res_lat = np.mean(np.abs(np.diff(nc.variables["nav_lat"][:,0])))
try:
self.proj=PS.RegLonLat(self.res_lon, self.res_lat, self.lon[0], self.lat[0])
except:
......
......@@ -49,7 +49,7 @@ if multiprocessing.cpu_count() < nbcore:
##############
gg = GlobalGrid(dinput, "geogrid")
gg = GlobalGrid(dinput, input_type)
landP= landPolygon(shpdir)
......
......@@ -16,12 +16,12 @@ Debug = False
# [DEF] input_type : geogrid, hydro
#
input_type =
dinput =
input_type = hydro
dinput = /bdd/ORCHIDEE_Forcing/Routing/Hydro4ORCH/MERIT_Global.nc
# output file direction
doutput = ./output.nc
# Shapefile direction
shpdir =
shpdir = ./shapefile/ne_10m_land/ne_10m_land.shp
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment