CliMT / climt

The official home of climt, a Python based climate modelling toolkit.
https://climt.readthedocs.io
Other
160 stars 46 forks source link

mac-climt #95

Closed musdfakoc closed 5 years ago

musdfakoc commented 5 years ago

Description

When I try the examples in the climt, I get error.

What I Did

I ran the "column_code_with_slab.py" then get 

NameError Traceback (most recent call last)
in ()
68 timestep = timedelta(minutes=10)
69
---> 70 convection = EmanuelConvection()
71 radiation_sw = RRTMGShortwave()
72 radiation_lw = RRTMGLongwave()

~/climt-develop/climt/_components/emanuel/component.py in init(self, minimum_convecting_layer, autoconversion_water_content_threshold, autoconversion_temperature_threshold, entrainment_mixing_coefficient, downdraft_area_fraction, precipitation_fraction_outside_cloud, speed_water_droplets, speed_snow, rain_evaporation_coefficient, snow_evaporation_coefficient, convective_momentum_transfer_coefficient, downdraft_surface_velocity_coefficient, convection_bouyancy_threshold, mass_flux_relaxation_rate, mass_flux_damping_rate, reference_mass_flux_timescale, **kwargs)
213 self._mf_timescale = reference_mass_flux_timescale
214 self._ntracers = 0
--> 215 self._set_fortran_constants()
216 super(EmanuelConvection, self).init(**kwargs)
217

~/climt-develop/climt/_components/emanuel/component.py in _set_fortran_constants(self)
225 self._rho_condensible = get_constant('density_of_liquid_phase', 'kg/m^3')
226 self._Cl = get_constant('specific_enthalpy_of_vapor_phase', 'J/kg')
--> 227 _emanuel_convection.init_emanuel_convection(
228 self._min_conv_layer,
229 self._crit_humidity,

NameError: name '_emanuel_convection' is not defined

then I ran the https://github.com/CliMT/climt/blob/0e3877c082e05555c74cb2392efd5b7c5021f9f1/climt/_components/emanuel/component.py#L7-L14

and get

ValueError Traceback (most recent call last)

in () 1 # -*- coding: utf-8 -*- ----> 2 from ..._core import bolton_q_sat, ensure_contiguous_state 3 from sympl import ( 4 ImplicitTendencyComponent, get_constant, initialize_numpy_arrays_with_properties) 5 import numpy as np ValueError: attempted relative import beyond top-level package this. Thanks again already.
musdfakoc commented 5 years ago

Also when I ran the examples I get this error too

WARNING:root:Import failed. Insolation is likely not compiled and will not be available. WARNING:root:Import failed. Simple Physics is likely not compiled and will not beavailable. WARNING:root:Import failed. RRTMG Longwave is likely not compiled and will not be available. WARNING:root:Import failed. RRTMG Shortwave is likely not compiled and will not be available. WARNING:root:Import failed. Emanuel Convection is likely not compiled and will not be available. WARNING:root:Import failed. GFS dynamical core is likely not compiled and will not be available. WARNING:root:Import Failed. DCMIP initial conditions will not be available.

JoyMonteiro commented 5 years ago

~/climt-develop/climt/_components/emanuel/component.py

This line in your error traceback suggests that you are not running the installed version of climt, rather a version of climt that is in a directory called climt-develop in your home folder.

What might be happening is that you have cloned the repository and then trying to run the examples as python examples/xxx.py from the directory climt-develop.

python might be trying to import climt from the directory itself rather than the one you installed.

Please try the following:

hopefully this should go away.

musdfakoc commented 5 years ago

Thanks, it works great now.

JoyMonteiro commented 5 years ago

Great! good to hear...