I have a problem with the choice of calculation years.
python flux2nc.py ../data/output/fluxes/ ../data/output/
IMPORTANT: ../data/output/fluxes/ SHOULD CONTAIN ONLY FLUXES FILES!!!
Choose output parameter
1 - Precipitation
2 - Evapotranspiration
3 - Runoff
4 - Base flow
5 - Snow Water Equivalent
6 - Soil moisture
Choose output (1 a 6)>3
Enter start year:2011
End year:2012
Traceback (most recent call last):
File "flux2nc.py", line 240, in <module>
main()
File "flux2nc.py", line 234, in main
flux2nc(sys.argv[1],sys.argv[2])
File "flux2nc.py", line 120, in flux2nc
inidate = dt.date(start_year,1,1)
TypeError: an integer is required (got type str)
I know that this problem is already posed, but I can't find the exact solution given my limited knowledge on python, and the script is pretty much complicated.
here is the part of the source code, related to my question.
# import dependencies
import sys
import os, string
# handle dates...
import datetime as dt
# NetCDF and Numeric
from netCDF4 import *
from numpy import *
# if the date information is not set get it from user
if start_year == None:
# for what date?
start_year = input("Enter start year:")
if end_year == None:
end_year = input("End year:")
# set date information in datetime object
inidate = dt.date(start_year,1,1)
enddate = dt.date(end_year,12,31)
# calculate number of days in time series
days = enddate.toordinal() - inidate.toordinal()+1