#GDD for only one day def GDD(tMin,tMax): tBase = 15; gdd_today = ((tMax + tMin)/2)-tBase; if gdd_today < 0 : gdd_today = 0;# only values greater than zero are valid return (gdd_today); #convert the Flow rate m3/s of the river to Velocity m/s #forumula for velocity depends on the location def velocity(flowrate,location): y=-1;#default value for velocity if location == 0 :#Krosno Creek y = (0.2692*flowrate) + 0.0984; if location == 1 :#Spring Creek North y = -(0.0288*flowrate*flowrate) + (0.4097*flowrate) + 0.1393; if location == 2 :#Don at Glenshields y = (0.2717*flowrate) + 0.148; return (y); #get the spawn length for the fish species def predicted_spawn_length(species,stream_velocity): incubation_period=-1;#default value for velocity if species == 0 :#C. idella incubation_period=(233855*stream_velocity**(-2.4915)); if species == 1 :#H. molitrix y=22456x-2.0989 incubation_period=(22456*stream_velocity**(-2.0989)); if species == 2 :#M. piceus incubation_period=(233855*stream_velocity**(-2.822)); spawn_distance=3.6*stream_velocity*(incubation_period*60);#convert incubation period from hours to seconds return (spawn_distance); #get the likelihood for a spawn to form def spawn_likelihood(gdd_sum,water_temp,predicted_spawn_distance,unimpounded_length,flow_rate): if gdd_sum > 650 and water_temp > 17 and unimpounded_length > predicted_spawn_distance and flow_rate > 0.7 and gdd_sum > 900: return('Status = Highly Suitable'); if gdd_sum > 650 and water_temp > 17 and unimpounded_length > predicted_spawn_distance and flow_rate < 0.7 and gdd_sum > 900: return('Status = Very Suitable'); if gdd_sum > 650 and water_temp > 17 and unimpounded_length > predicted_spawn_distance and flow_rate > 0.7 and gdd_sum < 900: return('Status = Suitable'); if gdd_sum > 650 and water_temp > 17 and unimpounded_length > predicted_spawn_distance and flow_rate < 0.7 and gdd_sum < 900: return('Status = Minimally Suitable'); else: return('Status = Not Suitable'); print (spawn_likelihood(10,22,2,5,700));
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question