- Finish Quick tutorial
- Finish Model structure
- describe config options
- describe plot routines
COSIPY solves the energy balance at the surface and is coupled to an adaptive vertical multilayer snow and ice module.
Tobias Sauter, [email protected]
Anselm Arndt, [email protected]
####Python 3
Any Python 3 version on any operating system should work. If you think the reason for a problem might be your specific Python 3 version or your
operating system, please create a topic in the forum.
Model is tested and developed on:
- Anaconda Distribution on max OS
- Python 3.6.5 on Ubuntu 18.04
- Anaconda 3 64-bit (Python 3.6.3) on CentOS Linux 7.4
- Cluster Innsbruck
- xarray
- dask-jobqueue
- netcdf4
- numpy (included in Anaconda)
- scipy (included in Anaconda)
- distributed (included in Anaconda)
Some variables are optinal and for ussage it has to be specified in the config file.
Variable | Short Name | Unit | Comment |
---|---|---|---|
Air pressure | PRES | hPa | |
Air temperature | T2 | K | |
Cloud cover | N | - | |
Relative humidity | RH2 | %/100 | |
Solar radiation | G | W m-2 | |
Total precipitation | RRR | mm | |
Wind speed | U2 | m s-1 | |
Snowfall | SNOWFALL | m | optional, replaces RRR |
Incoming longwave radiation | LWin | W m-2 | optional, replaces N |
Variable | Short Name | Unit | Comment |
---|---|---|---|
Glacier mask | MASK | Boolean | |
Elevation | HGT | m a.s.l. |
COSiPY provides some utilities which can be used to create the required input file for the core run.
The following is the example in the "data/static/" folder. If the procedure does not work for your study area, please try it first with the example.
- gdal (e.g. in Debian-based Linux distributions package called gdal-bin)
- climate date operators (e.g. in Debian-based Linux distributions package called cdo)
- netCDF Operators (e.g. in Debian-based Linux distritutions package called nco)
- Digital elevation model, best in WGS84 - EPSG:4326.
- Shapefile of the glacier Both should be in WG84 EPSG:4326.
In the utilities folder, there is the script create_static_file_command_line.py. This script runs some commands in the command line.
That's is the reason, that we can provide this script only for UNIX and MAC users at the moment. We are working on a version where no UNIX command
line is needed.
(create_static_file.py).
The intermediate files 'dem.nc', 'aspect.nc', 'mask.nc' and 'slope.nc' are deleted automatically. First, try to run the script
and create the 'static.nc' file with the example "Rofental_DEM.tif" and 'HEF_Flaeche2018.shp'. If this works, try to change to
your DEM and shapefile and adjust the area to which you want to shrink the DEM. The input data have to be in Lat/Lon
WGS84-EPSG:4326 projection with the units degrees, that the script works correctly.
Run the script with:
python create_static_files_with_command_line.py
Maybe the following commands are useful. You do not need them for the examples in the data/static folder.
The first can be used to aggreagate the DEM to a coarse spatial resolution.
gdalwarp -tr 0.01 0.01 -r average Hintereisferner_DEM.tif Hintereisferner_DEM_coarser.tif
The second can be used to reproject to EPSG 4326.
gdalwarp -t_srs EPSG:4326 dgm_hintereisferner.tif dgm_hintereisferner-lat_lon.tif
- static.nc file, created in step above
- 1D fields of all required dynamic input files
There are two different preprocessing scripts in the utilities folder to create the needed gridded input data. One is especially desingned for the
usage of csv file from a datalogger of an AWS station. This file is called aws_logger2cosipy.py with the corresponding configuration file
'aws_logger2cosipyConfig.py'.
The 'csv2cosipy.py' script with the corresponding configuration file 'csv2cosipyConfig.py' is a more general file.
Very important: For the aws_logger2cosipy.py version the temperature has to be in degree Celsius.
This example is using
the aws_logger version.
For the solar radiation, a model after Wohlfahrt et al. (2016; doi: 10.1016/j.agrformet.2016.05.012) is used.
For air temperature, relative humidity and precipitation constant lapse rates, which have to be set, are used.
Wind speed and cloud cover fraction kept constant for all gridpoint at on time step.
The script needs:
- the input file; for example a Campbell Scientific logger file with all required dynamic input fields
- the file path (including the name) for the resulting COSIPY file, which will be used as input file for the core run
- the path to the static file, created in the step above
- the start and end date of the timespan
In the aws_logger2cosipyConfig.py one has to define how the input variables are called in the CS_FILE.
For the radiation module, one has to set the timezone and the zenit threshold.
Furthermore, the station name has to be set, the altitude of the station, and the lapse rates for temperature, relative humidity and precipitation.
If everything is set, configured and prepared, run the script:
python aws_logger2cosipy.py -c ../data/input/008_station_hintereis_lf_toa5_cr3000_a_small.dat -o ../data/input/Hintereisferner_input.nc -s ../data/static/static.nc
The script takes all input timestamps which are in the -c input file. If you want only a specific period, you can use the following options at the end of the call.
python aws_logger2cosipy.py -c ../data/input/008_station_hintereis_lf_toa5_cr3000_a_small.dat -o
../data/input/Hintereisferner_input.nc -s ../data/static/static.nc -b 2018-06-01T00:00 -e 2018-06-02T00:00
Need the following python modules: * In folder postprocessing.
python plot_cosipy_fields.py -f $OUTPUT_FILE -d $POINT_IN_TIME_OF_INTEREST -t 1
python plot_cosipy_fields.py -h #for help
Directory | Files | Content |
---|---|---|
COSIPY.py | Main program | |
--- | --- | --- |
cpkernel | core_cosipy.py | Core of the model (time loop) |
grid.py | Grid structure, consists of a list of layer nodes (vertical snow profile) | |
node.py | Node class handles the nformation of each layer | |
init.py | Initialization of the snow cover | |
io.py | Contains all input/output functions | |
--- | --- | --- |
modules | albedo.py | Albedo parametrization |
densification.py | Snowpack densification | |
heatEquation.py | Solves the heat equation | |
penetratingRadiation.py | Parametrization of the penetrating shortwave radiation | |
percolation_incl_refreezing.py | Liquid water percolation and refreezing | |
radCor.py | Radiation model (topographic shading) | |
roughness.py | Update of the roughness length | |
surfaceTemperature.py | Solves the energy balance at the surface and calculates the surface temperature |
Input variables are stored in output dataset as well.
Variable | Short Name | Unit | Comment |
---|---|---|---|
Air temperature at 2 m | T2 | K | |
Relative humidity at 2 m | RH2 | % | |
Wind velocity at 2 m | U2 | m s-1 | |
Liquid precipitation | RAIN | mm | |
Snowfall | SNOWFALL | m | |
Atmospheric pressure | PRES | hPa | |
Cloud fraction | N | - | |
Incoming shortwave radiation | G | W m-2 | |
Incoming longwave radiation | LWin | W m-2 | |
Outgoing longwave radiation | LWout | W m-2 | |
Sensible heat flux | H | W m-2 | |
Latent heat flux | LE | W m-2 | |
Ground heat flux | B | W m-2 | |
Available melt energy | ME | W m-2 | |
Total mass balance | MB | m w.e. | |
Surface mass balance | surfMB | m w.e. | |
Internal mass balance | intMB | m w.e. | |
Evaporation | EVAPORATION | m w.e. | |
Sublimation | SUBLIMATION | m w.e. | |
Condensation | CONDENSATION | m w.e. | |
Depostion | DEPOSITION | m w.e. | |
Surface melt | surfM | m w.e. | |
Subsurface melt | subM | m w.e. | |
Runoff | Q | m w.e. | |
Refreezing | REFREEZE | m w.e. | |
Snowheight | SNOWHEIGHT | m | |
Total domain height | TOTALHEIGHT | m | |
Surface temperature | TS | K | |
Roughness length | Z0 | m | |
Albedo | ALBEDO | - | |
Number of layers | NLAYERS | - |
Variable | Short Name | Unit | Comment |
---|---|---|---|
Glacier mask | Mask | Boolean | |
Elevation | HGT | m a.s.l. |
- densification
- subsurface melt (penetrating radiation)
- add heat flux from liquid precipitation
- add liquid precipitation to surface melt
- superimposed ice
Please branch or fork your version, do not change the master.
You are allowed to use and modify this code in a noncommercial manner and by appropriately citing the above-mentioned developers.