-2

入力: sig や rho_c などの値が与えられ、すべての日のリストを作成し、for ループを使用して個々の日の時間を見つけ、その時間が一時の変化を見つけます。個々の日ごとに temp の値を見つける 個々の day に必要な値を見つけます グラフ データ出力: Day vs. Temp のグラフ。

Aice = 1
Anoice=0.
Tice =273.
Tnoice=293.
dt = 86400.
S = 342.5
rho_c =206000000.
epsilon_tow =.62
sig =5.6710E-8
Tint=288.

import numpy as N
tempvals= N.zeros((3000,))   #creates an array to store temp. values                     
tempvals[0]= Tint            #set the first value of array to Tint
times=N.zeros((3000,))       #creates array to store time values
    for day in range(3000):      #Creates the values of day and goes through
                             #calculates for every day time, A,dT,T 
        time = (dt)*day
        times[day] = time
        if tempvals[day] <= Tice:
            A=Aice
        elif tempvals[day] >=Tnoice:
            A=Anoice
        else :
            A=(((tempvals[day]-Tice)/(Tnoice-Tice)*(Anoice-Aice))+Aice)
        dT =(((S*(1-A))-((epsilon_tow*sig*(tempvals[day]**4))/rho_c )*dt

        if day <2999  
                 tempvals[day+1]= T+dT
                 tempvals[day]= T


        plot(day,T)                    #plots graph of day valueson x axis and
                                       #T values on as y-axis
        plot.title(T)                  #creates title of the graph
4

1 に答える 1

3

:前の行に a がありません。

if day < 2999: # <- need a colon here  
    tempvals[day+1]= T+dT

編集:この行には、一致しない括弧/括弧もあります:

dT =(((S*(1-A))-((epsilon_tow*sig*(tempvals[day]**4))/rho_c )*dt # missing parens

この行は次のようになります。

dT = ((S*(1-A))-((epsilon_tow*sig*(tempvals[day]**4))/rho_c))*dt
于 2012-12-06T01:37:37.550 に答える