Beispiel #1
0
'''
Makes plot of daily insolation
This is the same as the CGI code at David Archers site
'''

import sys, os
from pylab import *
import climt

## Orbital parameters:
ecc = 0.0167
obl = 23.4
pre = 102.
##

ins = climt.insolation(avg='daily')
nlat = 180
lat = (arange(nlat) + 0.5) * 180. / nlat - 90.
solin = []

for day in range(1, 366):
    ins(lat=lat, calday=day, eccen=ecc, obliq=obl, prece=pre)
    solin.append(ins['solin'])

solin = climt.utils.squeeze(transpose(solin))
solin = solin[::-1, :]

imshow(solin, extent=(1, 366, -89, 89))
cset1 = contour(solin,
                arange(0, 2000, 100),
                origin='upper',
Beispiel #2
0
#    If RestartFile and OutputFile are the same, then output will be
#    appended to the restart file (ie. a continuation run).
#kwargs['RestartFile']     = 'radconv.nc'
# 2) If RestartFile is not given, then initial values for prognostic
#    fields must be explicitly given, e.g.
nlev = climt.get_nlev()
kwargs['q'] = zeros(nlev) + 1.e-9
kwargs['T'] = zeros(nlev) + 250. #(kwargs['solin']/2./climt.parameters.Parameters()['stebol'])**0.25
kwargs['Ts'] = 250.

# -- Instantiate components and federation
rad = climt.radiation(UpdateFreq=kwargs['dt']*50)
con = climt.convection(scheme='emanuel')
dif = climt.turbulence()
ice = climt.seaice()
ins = climt.insolation(lat=85.,avg='daily')

kwargs['Hslab']=50.
kwargs['Pr']=100.
#kwargs['do_srf_lat_flx']=0
#kwargs['do_srf_sen_flx']=0

T0,q0 = climt.thermodyn.moistadiabat(rad['p'],273.,273.-90,.1)
kwargs['T'],kwargs['q'] = T0,q0

fed = climt.federation(dif, rad, ice, con, ins, **kwargs)

# Main timestepping loop
RunLength   = 2000.   # Total length of run (days)
NSteps    = int( RunLength*86400./fed['dt'] )
TdotDyn =  2./86400.
'''
Makes plot of daily insolation
This is the same as the CGI code at David Archers site
'''

import sys,os
from pylab import *
import climt

## Orbital parameters:
ecc = 0.0167
obl = 23.4
pre = 102.
##

ins = climt.insolation(avg = 'daily')
nlat = 180
lat = (arange(nlat)+0.5)*180./nlat -90.
solin=[]

for day in range(1,366):
  ins(lat=lat, calday=day, eccen=ecc, obliq=obl, prece=pre)
  solin.append(ins['solin'])

solin = climt.utils.squeeze(transpose(solin))
solin=solin[::-1,:]

imshow(solin,extent=(1,366,-89,89))
cset1 = contour(solin, arange(0,2000,100),origin='upper',linewidths=1,colors='k',extent=(1,365,-89,89))
clabel(cset1,inline=1,fmt='%1.0f',fontsize=10)
Beispiel #4
0
#!/usr/bin/env python

from numpy import *
import climt

# Make annual-average insolation instance
ins = climt.insolation(avg = 'annual')

# Iterate over years
# Note that instance is reinitialized each time it is called,
# so we need to pass lat each time
nlat = 20
lat = (arange(nlat)+0.5)*180./nlat -90.
solin=[]
for year in range(0, 40000, 1000):
    ins(lat=lat, orb_year=year)
    solin.append(ins['solin'])

# Remove mean
solin = solin - average(solin,axis=0)[None,:]

# Plot
try:
    from matplotlib.pylab import *
    imshow(transpose(solin)[::-1,:],extent=(0,50000,-90,90))
    xlabel('Time (years)')
    ylabel('Latitude')
    title('Change in annual-mean insolation [W m-2]')
    ylim([-90,90])
    xlim([0,50000])
    colorbar()
Beispiel #5
0
# Run length (days)
Ndays  = 3000  
########################## End user adjustble

kwargs['lat']  = (arange(nlat)+0.5)*(MaxLat-MinLat)/nlat + MinLat
kwargs['lev']  = (arange(nlev)+0.5)*(MaxLev-MinLev)/nlev + MinLev

# Set up federation
tur = climt.turbulence()
dyn = climt.dynamics()
ocn = climt.ocean()
con = climt.convection()
fed  = climt.federation(dyn, tur, ocn, con, **kwargs)

# Run
Nsteps = int(Ndays*86400./kwargs['dt'])
ins = climt.insolation(lat=kwargs['lat'], avg='annual')
CoolingRate = 0./86400.

for l in range(Nsteps):
    fed.State['SrfRadFlx'] = ins.State['solin']*0.5 - fed['stebol']*fed.State['Ts']**4
    fed.step()
    fed.State['T'][4:nlev,:,:] -= CoolingRate*kwargs['dt']*ones((nlev-4,nlat,1))

try:
    from matplotlib.pylab import *
    show()
except:
    pass