Skip to content

Commit

Permalink
initial commit, transferring from CVS
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Caballero committed Oct 15, 2013
0 parents commit 8afb850
Show file tree
Hide file tree
Showing 433 changed files with 76,949 additions and 0 deletions.
158 changes: 158 additions & 0 deletions CHANGELOG
@@ -0,0 +1,158 @@
15-10-2013 Added 2 column dynamics module

10-10-2013 Changed the federation.compute method, which was causing instabilities in
some cases.

Added a clean.py utility for cleaning up compiled files

18-09-2013 Changed calculation of interface level pressures in CAM3 and CCM3 so as to
enforce that top-of-model is at p=0, which ensures that LwToa is truly the OLR.

14-09-2013 Removed all makefiles (no longer needed), added clean.py to clean up in src
directory

08-02-2013 +++ Version 0.6.14
Added Cam3Feedbacks.py to CliMT/lib/examples

11-10-2012 Added 1-level sea ice module written by Ray Pierrehumbert

3-2-2012 +++ Version 0.6.9
Unified CliMT and CliMT_lite by adding --lite option to setup.py,
which installs only ccm3 radiation interface (including ozone and insolation)
and thermodyn module.

20-12-2010 +++ Version 0.6.8

17-12-2010 Corrected bug in reading of restart file in io.py
Added tutorial comments to radiative_convective_equilibrium.py example.

21-11-2010 Added icealbedo.py module by Jason Goodman

25-06-2010 Updated io.py to be compatible with the python netCDF4 module

14-02-2010 Updated federation.py and io.py to use the built-in set type
instead of the deprecated sets.Set class

3-05-2009
Fixed bugs in CAM3 radiation:
- do not allow fice to be 0
- output TOA SW is fsnt, not fsntoa
CliMT now replicates model output fsnt and flnt to within
~0.03 W/m2 (remanining error to do with spatially-varying
stratospheric distribution of trace gases)

29-04-2009
- Added new input to CAM3 radiation: surface LW upwelling
radiation (FLUS)
- Corrected bugs in CAM3 radiation:
- fice now correctly computed when ciwp input externally
- pstd set to 1000 mb instead of ps

16-04-2009
- CCM3 and Chou schemes now accept explicit external
definition of cloud ice water path ciwp
- CAM3, CCM3 and Chou schemes now expect drop radii r_liq
and r_ice as 3D fields, not 0D parameters as before

15-04-2009
- Added SwToa, LwToa, SwSrf and LwSrf outputs to CCM3 and Chou schemes
- swflx and lwflx outputs are now at level MIDPOINTS instead of
interfaces as before
- Added check in cam3/src/radae.F90:initialize_radbuffer to see if buffers already
allocated (otherwise CliMT will crash if CAM3 radiation instantiated
more than once)
- Cloud ice fraction ciwp can now be passed explicitly to CAM3
(before, it was calculated internally as in CCM3; this
is still done if ciwp not passed explicitly)

09-04-2009 ++ Version 0.6.5
- Added TOA and surface flux output from CAM3 radiation
- Corrected bug in CAM3 LW cloud forcing (sign was wrong!)
- Added check for negative or zero humidity and ozone
input to CAM3, which give NaNs
- Disabled inf/nan flags in CAM3 code for portability
- Updated examples; all now use CAM3

07-04-2009
Removed useless 'from numpy import *' in __init__.py which was
causing namespace collision problems (__version__ is now correctly reported)

12-02-2009 ++ Version 0.6.4
Added CAM3 radiation scheme

05-02-2009
setup.py reads version number from file 'Version'

13-03-2008
io.py now compatible with both Scientific.IO and PyNGL.Nio
As of version 1.2, PyNGL doesn't work very well for NetCDF output

11-03-2008
Small numpy compatibility fix in grid.py -- check that axis
is array, not scalar

2-02-2008 ++ Version 0.6.0
- Updated build system to use python distutils
- CliMT now works *only* with numpy

10-01-2007
Added functions thermodyn.CAPE and thermodyn.CINE
to compute convective available potential energy and
convective inhibition energy

27-11-2006
Added function get_nlev(), get_nlat(), get_nlon() to
__init__py to retrieve compiled number of levels,
latitudes, longitudes

25-10-2006
Added keywords to thermodyn functions qs, ws etc.
Corrected bug in qs: specific humidity is
q = eps*e/(p+(1-eps)*e)
and not
q = eps*e/p
as before

24-10-2006
Added function to make skew-T lnp plot.

19-10-2006
Changed function to compute thetae to use definition in Bohren+Albrecht

18-10-2006
Added function pseudoadiab() to thermodyn module that
computes both pseudoadiabats by integrating the
pseudoadiabatic lapse rate equation

18-10-2006
Added function z() to thermodyn module that computes height
given temp and press profiles, assuming hydrostatic
equilibrium and

23-09-2006
Bug fix: calday now written to ouput file each time
write() is called

15-09-2006
Added CliMT version, run date and restart file name to
global attributes of output netcdf file

12-09-2206
Bug fix: orbital parameters in insolation module are now
correctly reset to values specified in kwargs when insolation module
is federated

12-09-2006
Added check for Darwin version in CompilerFlags, needed to
get the right link flags in xlf configure file

08-08-2006
Added flags for compilation using Intel ifort on Mac OS X

28-06-2006
Added simplified Betts-Miller convection scheme
(Dargan Frierson/Jonathan Mitchell)

28-06-2006
Improvements to Monitor -- now printing max and min
values of 2D arrays, and using interpolation='nearest'
43 changes: 43 additions & 0 deletions README
@@ -0,0 +1,43 @@
CliMT: Climate Modeling and Diagnostics Toolkit

CliMT is a Python-based software component toolkit which provides a
flexible, multi-purpose problem-solving environment geared to climate
science problems.

See http://people.su.se/~rcaba/climt for further details.

Requirements:
Python 2.4 or higher
Numpy 1.0 or higher
GNU gcc and a Fortran compiler

Installation:
Make sure that numpy is installed, and that the version of f2py
on your path is the one installed by numpy. Then:

python setup.py build

will build the package using the default fortran compiler. For
information on the compilers available on your platform:
f2py -c --help-fcompiler

To build with a different compiler:

python setup.py build --fcompiler=<compiler>

where <compiler> is one of the choices offered by f2py above.

When the build is complete:

python setup.py install --prefix=<dir where you want climt to live>

You can also install the "lite" version of CliMT, used in
Ray Pierrehumbert's book "Principles of Planetary Climate",
by doing

python setup.py install --lite

Rodrigo Caballero (rodrigo.caballero@misu.su.se)
Feb 2012


1 change: 1 addition & 0 deletions Version
@@ -0,0 +1 @@
0.6.14
46 changes: 46 additions & 0 deletions clean.py
@@ -0,0 +1,46 @@
#!/usr/bin/env python

import os,sys
import fnmatch
import string

class GlobDirectoryWalker:
""" A forward iterator that traverses a directory tree """
def __init__(self, directory, pattern="*"):
self.stack = [directory]
self.pattern = pattern
self.files = []
self.index = 0
def __getitem__(self, index):
while 1:
try:
file = self.files[self.index]
self.index = self.index + 1
except IndexError:
# pop next directory from stack
self.directory = self.stack.pop()
self.files = os.listdir(self.directory)
self.index = 0
else:
# got a filename
fullname = os.path.join(self.directory, file)
if os.path.isdir(fullname) and not os.path.islink(fullname):
self.stack.append(fullname)
if fnmatch.fnmatch(file, self.pattern):
return fullname

if __file__ != os.path.basename(__file__):
print "You don't seem to be in the CliMT root directory"
sys.exit()

os.system('rm -fr build')

for file_name in GlobDirectoryWalker('.'):
# never touch files in CVS directories
if file_name.find('/CVS/') != -1:
continue
extension = os.path.splitext(file_name)[1]
if extension in ['.o','.mod','.so','.lst','.ipo','.pyc'] \
or file_name[-1] == '~' or '_lib.' in file_name:
print file_name
os.remove(file_name)
43 changes: 43 additions & 0 deletions doc/example-1.html
@@ -0,0 +1,43 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CliMT</title>
<META name="description" content="Libraries">
<META name="keywords" content="Python python library package">
<link type="text/css" rel="stylesheet" href="style/librootcsc.css">
</head>


<body>
<pre>
#!/usr/bin/env python

#
# Set up realistic tropical temperature and moisture profiles
# and compute radiative fluxes
#

import climt
import Numeric

#--- instantiate radiation module
r = climt.radiation()

#--- initialise T,q to moist adiabat with 70% RH
ps = 1020. # Surface pressure
T0 = 273.15 + 30. # Surface temperature
Tst = 273.15 - 80. # Strospheric temp
p = ( Numeric.arrayrange(r.levs, typecode='d')+ 0.5 ) * ps/r.levs
T,q = climt.thermodyn.moistadiabat(p, T0, Tst, 0.7)

#--- compute radiative fluxes and heating rates
r(p, ps, T, T0, q)

#--- print out
print "lev p T q lwflx lwhr swflx swhr"
for i in range(r.levs):
print "%3i %6.1f %6.1f %6.2f %10.2f %6.2f %10.2f %6.2f" % \
(i, p[i], T[i]-273.15, q[i], r.lwflx[i], r.lwhr[i]*86400., r.swflx[i], r.swhr[i]*86400.)
</pre>
</body>

0 comments on commit 8afb850

Please sign in to comment.