Changes
Page history
Update Data treatment
authored
Nov 17, 2021
by
Marie Brunel
Hide whitespace changes
Inline
Side-by-side
Data-treatment.md
View page @
6f72fc42
# Monthly runoff into annual
-
[ ] add explanation for harvest convertion to yield
# Monthly runoff
-
convert monthly runoff to annual by summing :
```
```
if file_name == "mrunoff.nc":
if file_name == "mrunoff.nc":
#convert number of months to years
#convert number of months to years
nb_year = int(len(years)/12)
nb_year = int(len(years)/12)
#years in months here
tmp = np.zeros([nb_year,len(latitudes),len(longitudes)])
tmp = np.zeros([nb_year,len(latitudes),len(longitudes)])
#calculation of the sum over each year
#calculation of the sum over each year
for k in range(0,nb_year,1):
for k in range(0,nb_year,1):
tmp[k] = np.sum(data[k*12:k*12+12],axis=0)
tmp[k] = np.sum(data[k*12:k*12+12],axis=0)
data = tmp
data = tmp
#[months,latitudes,longitudes]
```
```
years,latitudes,longitudes = list from the file reading
# Harvest
data = numpy array from the reading of the file [months,latitudes,longitudes]
-
Convert harvest to yield :
```
# harvest to yield
yield = np.multiply(np.multiply(harvest,0.02222222),1.14)
`yield = np.multiply(np.multiply(harvest,0.02222222),1.14)`
```
\ No newline at end of file
\ No newline at end of file