-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allows computation of summaries, function updates
- Loading branch information
1 parent
1cb4315
commit 98139e9
Showing
7 changed files
with
258 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
import sympy as sym | ||
from psymple.custom_functions import DegreeDays, FFTemperature | ||
from psymple.custom_functions import ( | ||
DegreeDays, | ||
FFTemperature, | ||
temp, | ||
DD, | ||
temp_fun, | ||
DD_fun, | ||
solar_rad_fun, | ||
ind_above_fun, | ||
frac0_fun, | ||
temp_min_fun, | ||
) | ||
|
||
# from custom_functions import DegreeDays, FFTemperature | ||
|
||
|
||
# The dictionary passed to sym.sympify and sym.lambdify to convert custom functions | ||
# TODO: This should not be a global property. | ||
#sym_custom_ns = {} | ||
sym_custom_ns = {'DegreeDays': DegreeDays, 'FFTemperature': FFTemperature} | ||
# sym_custom_ns = {} | ||
sym_custom_ns = { | ||
"DegreeDays": DegreeDays, | ||
"FFTemperature": FFTemperature, | ||
"temp": temp_fun, | ||
"temp_min": temp_min_fun, | ||
"DD": DD_fun, | ||
"solar_rad": solar_rad_fun, | ||
"ind_above": ind_above_fun, | ||
"frac0": frac0_fun, | ||
} | ||
|
||
|
||
T = sym.Symbol("T") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Tue Feb 2 23:00:56 2021 | ||
@author: Jose Ricardo Cure | ||
""" | ||
class Weather(object): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
def filterWX(wx,startM,startD,startY,endM,endD,endY,weatherfile): | ||
'''locate dates to run in weather file and call main''' | ||
start=False | ||
end=False | ||
cont=3 | ||
|
||
keyStart= str(startM) +' '+ str(startD)+' ' + str(startY) | ||
keyEnd= str(endM)+' ' + str(endD)+' ' + str(endY) | ||
print(keyStart, keyEnd) | ||
for sList in (wx): | ||
if cont < len(wx): | ||
#cont = cont+1 | ||
keyWX = str(wx[cont][0])+' ' + str(wx[cont][1])+' ' + str(wx[cont][2]) | ||
if keyWX == keyStart: | ||
if start==False: | ||
index_start = cont | ||
start=True | ||
lat = float(wx[1][0]) | ||
long = float(wx[1][1]) | ||
month = int(wx[cont][0]) | ||
day = int(wx[cont][1]) | ||
year = int(wx[cont][2]) | ||
tmax = float(wx[cont][3]) | ||
tmin = float(wx[cont][4]) | ||
solar = float(wx[cont][5]) | ||
precip= float(wx[cont][6]) | ||
rh = float(wx[cont][7]) | ||
wind = float(wx[cont][8]) | ||
#print(' first date to run '+ str(month) +' ' + str(day) + ' ' + str(year)) | ||
weatherfile.append([lat,long,month,day,year, tmax,tmin,solar,precip,rh,wind]) | ||
|
||
elif keyWX == keyEnd: | ||
if end == False: | ||
index_finish = cont+1 | ||
totdays = index_finish - cont | ||
keyWX = str(wx[cont][0])+' ' + str(wx[cont][1])+' ' + str(wx[cont][2]) | ||
end=True | ||
#print(' last date to run '+ str(month) +' ' + str(day) + ' ' + str(year)+ ' ') | ||
#print( '.. total simulation days in this file = '+str(totdays) ) | ||
|
||
cont=cont+1 | ||
if end==False and start == True: | ||
lat = float(wx[1][0]) | ||
long = float(wx[1][1]) | ||
month = int(wx[cont][0]) | ||
day = int(wx[cont][1]) | ||
year = int(wx[cont][2]) | ||
tmax = float(wx[cont][3]) | ||
tmin = float(wx[cont][4]) | ||
solar = float(wx[cont][5]) | ||
precip= float(wx[cont][6]) | ||
rh = float(wx[cont][7]) | ||
wind = float(wx[cont][8]) | ||
weatherfile.append([lat,long,month,day,year, tmax,tmin,solar,precip,rh,wind]) | ||
|
||
|
||
|
||
def readwx(wx_dir,startM,startD,startY,endM,endD,endY,weatherfile): | ||
'''read weather file''' | ||
with open (wx_dir , 'r') as f: # use with to open your files, it close them automatically | ||
wx = [x.split() for x in f] | ||
wxfile= wx[0] # title of the wx file | ||
lat = float(wx[1][0]) | ||
long = float(wx[1][1]) | ||
print() | ||
print('weather file ', wxfile) | ||
print(' latitude '+ str(lat), ' longitude '+ str(long)) | ||
print('.. original number of days in WX file = ' + str(len(wx))) | ||
Weather.filterWX(wx,startM,startD,startY,endM,endD,endY,weatherfile) | ||
return weatherfile | ||
|
||
|
||
|
||
#in_locations = 'd:/fruit_flies/r_USA_MEX_observed_1980-2010_AgMERRA_coarse_test.txt' | ||
#weatherfile = Weather.run_locations(in_locations) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.