STEP 1: please install CLASS4GL on your operating system first

STEP 2: perform a first experiment with one station

Run your first experiment consisting of simulations for each day with an available morning–afternoon sounding pair for station 74560 (Lincoln):

python $CLASS4GL/simulations/simulations.py \
    --c4gl_path_lib $CLASS4GL \
    --station_id 74560 \
    --path_forcing $CLASS4GL_DATA/GLOBAL_20190115 \
    --path_experiments $CLASS4GL_DATA/GLOBAL_EXPERIMENTS \
    --experiments BASE \
    --split_by 25 \
    --global_chunk_number 0

This takes some time. Afterwards, you can list the output files with:

ls -larth $CLASS4GL_DATA/GLOBAL_EXPERIMENTS/BASE/

Please note that the last two arguments --split_by 25 --global_chunk_number 0 will result in simulations of only the first 25 sounding days. If you remove these arguments, all available sounding days of that station will be run. Please note, that this will take a much longer long tim. In order to overcome the computational time of multiple simulations (and over multiple stations), please see section Parallel simulations on a supercomputer.

You can get a list and explanation of the command line arguments as follows:

python $CLASS4GL/simulations/simulations.py --help

STEP 3: explore your first experiment

ipython -i $CLASS4GL/interface/interface.py -- \
  --c4gl_path_lib $CLASS4GL \
  --path_forcing $CLASS4GL_DATA/GLOBAL_20190115/ \
  --path_experiments $CLASS4GL_DATA/GLOBAL_EXPERIMENTS/ \
  --experiments BASE

Have a look at the pandas data frame of the one-parameters CLASS4GL data you have generated:

print("Initial (morning) table")
print(c4gldata['BASE'].frames['profiles']['records_all_stations_ini'])
print("Model end (afternoon) table")
print(c4gldata['BASE'].frames['profiles']['records_all_stations_end_mod'])
print("Observed end (afternoon) table")
print(c4gldata['BASE'].frames['profiles']['records_all_stations_end_obs'])

Basically, every one-parameter value can be extracted directly from these tables for all simulation days in the experiment at once. For example, you can get the end state of the lifted condensation level with:

c4gldata['BASE'].frames['profiles']['records_all_stations_end_mod'].zlcl

To see which other one-parameters are in the tables, you can type (either for morning, mod/afternoon and obs/afternoon state):

print("-- Initial (morning) parameters --")
print(c4gldata['BASE'].frames['profiles']['records_all_stations_ini'].columns.values)
print("-- Model end (afternoon) parameters --")
print(c4gldata['BASE'].frames['profiles']['records_all_stations_end_mod'].columns.values)
print("-- Observed end (afternoon) parameters --")
print(c4gldata['BASE'].frames['profiles']['records_all_stations_end_obs'].columns.values)

STEP 4: View vertical profile data and time series

Not all data is provided in the table, particularly one-dimensional data such as vertical profile data (this step) and timeseries (next step).

This shows the vertical profile data table of the first simulation day:

# Initial (morning) profile
c4gldata['BASE'].frames['profiles']['record_yaml_ini'].air_ap
# End (afternoon) profile, observed.
c4gldata['BASE'].frames['profiles']['record_yaml_end_obs'].air_ap
# End (afternoon) profile, modelled.
c4gldata['BASE'].frames['profiles']['record_yaml_end_mod'].air_ap

More specifically, you can display the vertical theta profile of the modeled afternoon profile with:

c4gldata['BASE'].frames['profiles']['record_yaml_end_mod'].air_ap.theta

Here are the other columns of the profiles (analogous for the other profiles).

c4gldata['BASE'].frames['profiles']['record_yaml_end_mod'].air_ap.columns.values

It should be noted that the air_ap section provides the vertical profiles for which an ABL is considered for the model. In order to get the original unfitted profile from the soundings, you can get it with the air_balloon section.

c4gldata['BASE'].frames['profiles']['record_yaml_ini'].air_balloon

Note that most of these features also apply for the other objects.

STEP 5: View daytime time series

The daytime evolution of model variables, eg., specific humidity q in the mixed layer, can be displayed as follows:

c4gldata['BASE'].frames['profiles']['record_yaml_end_mod'].out.q

These are the corresponding local solar hours:

c4gldata['BASE'].frames['profiles']['record_yaml_end_mod'].out.time

An overview of all available output time series can be listed with:

c4gldata['BASE'].frames['profiles']['record_yaml_end_mod'].out.__dict__.keys()

Note that there is also the pars section, in which you can find back the different one-parameter values for the current sounding day:

print('wg:',c4gldata['BASE'].frames['profiles']['record_yaml_ini'].pars.wg)
print('w2:',c4gldata['BASE'].frames['profiles']['record_yaml_ini'].pars.w2)
print('q:',c4gldata['BASE'].frames['profiles']['record_yaml_ini'].pars.q)
print('datetime:',c4gldata['BASE'].frames['profiles']['record_yaml_ini'].pars.datetime)

or you can choose any other parameter from:

c4gldata['BASE'].frames['profiles']['record_yaml_ini'].pars.__dict__.keys()

Finally, you can get an overview what’s inside the rest of the ‘record_yaml_*’ objects as follows:

print("-- Keys of the initial (morning) input/sounding object --")
print(c4gldata['BASE'].frames['profiles']['record_yaml_ini'].__dict__.keys())
print("-- Keys of the end (afternoon) model object --")
print(c4gldata['BASE'].frames['profiles']['record_yaml_end_mod'].__dict__.keys())
print("-- Keys of the end (afternoon) sounding object --")
print(c4gldata['BASE'].frames['profiles']['record_yaml_end_obs'].__dict__.keys())

If you remove .__dict__.keys(), you will notice that theey are actually class4gl (model) and class4gl_input objects, which we will use later on in step 8.

STEP 6: move between simulation days

The previous two steps only show one-dimensional data for the first simulation day. You can go to the next simulation day by:

c4gldata['BASE'].next_record() 

Now, you just do the steps 4 and 5 again, but this will now display the next sounding.

Here is how to jump 10 simulation days ahead:

c4gldata['BASE'].next_record(10)

STEP 7: Load and run CLASS4GL objects from the CLASS4GL interface

For quick model parameter sensitivity testing, it is sometimes convenient to run class directly from the interface. Therefore, make a shortcut of the class4gl (input) objects:

c4gli_disk = c4gldata['BASE'].frames['profiles']['record_yaml_ini']

You can now create your own set of input parameters and run a new class simulation:

import copy
c4gl = class4gl(c4gli_disk)
c4gl.run() 

c4gli_wilt = copy.copy(c4gli_disk)
c4gli_wilt.pars.wg = c4gli_wilt.pars.wwilt 
c4gli_wilt.pars.w2 = c4gli_wilt.pars.wwilt 
c4gl_wilt = class4gl(c4gli_wilt) 
c4gl_wilt.run()

You can now compare the original (c4gl) and new (c4gl_wilt) class4gl simulation to see the effect of setting the soil moisture to wilting point:

import pylab as plt
fig = plt.figure()
plt.plot(c4gl.out.theta)
plt.plot(c4gl_wilt.out.theta)
fig.show()