The data you have just run NWCSAF-GEO on is provided by NWCSAF as test data. Despite this (supplied) tutorial being useful there are a number of ways in which the NWCSAF-GEO setup can be modified that are not explored by using this limited data.
In the example you just ran we did not discuss numerical weather prediction data. However, when you unzipped the test data this automatically put some ECMWF operational data files into the directory.
$SAFNWC/import/NWP_data
This is the directory that the NWCSAF task manager checks on startup (and periodically when in operation) to see if appropriate NWP data is present.
It is possible to use data other than ECMWF operational data. The three sources that NWCSAF provide configuration files for are ECMWF, ARPEGE and GFS. The data source is not automatically recognised so the correct NWP configuration file must be used.
To change the NWP config file change directory to the config folder.
$SAFNWC/config
In this directory are all the configuration files that required to run NWCSAF-GEO. Some of these files can be modified or switched with one another to change the setup of NWCSAF-GEO.
We are now going to switch between using ECMWF data to using GFS data. However, before we change anything lets open the nwp_conf_file. It should be obvious from the information at top of the file that this config file is for the ingestion of ECMWF data. Now, exit the file before we overwrite it with another.
For an unknown reason the GFS nwp configuration file supplied with NWCSAF does not work in the format it is in. In order to make sure that the mapping of the GFS NWP data is successful we will have to edit the nwp config file.
Open the GFS NWP config file
nwp_conf_file.GFS
Navigate to the bottom of the file. Here you will see a list of the model pressure levels to be used in the NWP mapping process. To prevent core dumps on starting the NWCSAF-GEO task manager we have to remove the first 3 model levels in the list to that it begins with 5 hPa instead of 1 hPa. This is still very high in the atmosphere and is actually higher than the highest level used when using ECMWF data.
Now we have edited the original nwp_conf_file.GFS file we can copy it to overwrite the nwp_conf_file.
cp nwp_conf_file.GFS nwp_conf_file
This will overwrite the existing version of the file (for use with ECMWF data) with an equivalent file for use with GFS data. Open the file to check that this has happened.
The safnwc.cfr file (run configuration file) includes a variable (REG_CONF) which indicates the region configuration file being used. If you open the safnwc.cfr in the config directory you will see that currently this is set to safnwc_MSGN.cfg. The domain described by safnwc_MSGN.cfg is the meteosat second generation north (MSGN) region. This region covers Europe and as such is not much use for those of us that are interested in the conditions over Africa.
To create our own .cfg file (region configuration file) it is sensible to copy an existing file and modify it. Copy the existing Spain.cfg file and call it Ghana.cfg.
cp Spain.cfg Ghana.cfg
Open your new region configuration file and modify the description to replace Spain with Ghana
#/*************************************************************************/
#/**
# * \file Ghana.cfg
# * \brief Region Configuration File: GHANA region
# *
# *
# * \par Copyright 2015, EUMETSAT, All Rights Reserved
# *
# * \par PRODUCED BY : GMV Aerospace and Defence S.A.U.
# * This SW was developed by GMV within the
# * context of the EUMETSAT Satellite Application
# * Facility Co-operation Agreement for Support to
# * Nowcasting and Very Short Range Forecasting,
# * dated on 29 June 2011 between EUMETSAT
# * and AEMET.
# *
# * \par PROJECT : NWC SAF
# *
# * \par UNIT NAME : NWCLIB
# *
# * \par FILE : Ghana.cfg
# *
# * \par TYPE : Region Configuration File
# *
# * \par FUNCTION :
# * Defines Region for Ghana
# *
# **************************************************************************/
#/* HISTORY
# *
# * DATE VERSION AUTHOR REASONS
# * DEC 2014 SIRR GMV NWCLIB Implementation for SIRR
# * JAN 2017 2016.1 GMV SPR-603: Definition of Region by pixel
# *
# **************************************************************************/
#
Now change the part of the file that defines the region. This can be done in several ways but the simplest is to provide lat lon coordinates and the x-y dimensions of the region for the REGION_CENTRE and REGION_SIZE_P variables respectively.
REGION_ID Ghana
REGION Ghana
REGION_CENTRE 8.2 -1.2
REGION_SIZE_P 512 512
This will give a domain called Ghana centred at 8.2 North and -1.2 East, 512x512 pixels. Once edited save and exit.
Now for that we have created a region configuration file we need to point NWCSAF-GEO to it in the run configuration file (.cfr). Open the safnwc.cfr and replace safnwc_MSGN.cfg with Ghana.cfg.
Note that if you wish to run multiple domains this is possible. This is is not the goal of this exercise but can be achieved by having multiple run configuration files (.cfr) and region configuration files (.cfg) which have to be referenced in the system configuration file (.cfs). One advantage of defining multiple domains in this way is that different products can be generated for different domains.
The products to be generated for each domain are listed in the domain specific run configuration file (.cfr). The possible PGEs are listed as a comment followed by the PGEs currently selected for that domain defined above. In our initial case we ran all the PGEs apart from PLAX (parallax correction) and L1SD (level 1 satellite data).
Now lets add L1SD to the list of PGEs being generated, we will need this later when plotting our data using python.
#Available PGEs: CMA CT CTTH CMIC PC CRR PPh iSHAI HRW EXIM ASII ASII-TF ASII-GW RDT-CW CI PLAX L1SD
PS_PGES CMA CT CTTH CMIC PC CRR PPh iSHAI HRW EXIM ASII ASII-TF ASII-GW RDT-CW CI L1SD
As you can see in the .cfr, below the list of PGEs to be generated are the names of the PGE specific model configuration files (.cfm). In the model configuration files there are some options that can be changed.
The only file that we will make to any changes to is the HRW model configuration file (safnwc_HRW.cfm
). Open this file and change the OUTPUT_FORMAT variable from "NWC" to "NET". This will mean that the HRW (High resolution Winds) PGE will output data files in netcdf format rather than as bufr files.
NWCSAF-GEO is able to make use of parallel processing to speed up both the mapping of NWP and the running of the PGE's. The first step to increasing the number of processors that NWCSAF can run on is checking the number of processors that your computer has. It is likely that your computer has 4 or 8 processors available for parallelisation. To check how many processors your computer has you can use the top
command.
top
Once top is running press 1
and at the top of your screen you should see the different CPUs listed in a similar way as is shown below
top - 10:24:46 up 3 days, 18:26, 4 users, load average: 0.00, 0.01, 0.05
Tasks: 157 total, 1 running, 156 sleeping, 0 stopped, 0 zombie
%Cpu0 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu1 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu3 : 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 7881344 total, 4737804 free, 640564 used, 2502976 buff/cache
KiB Swap: 8126460 total, 8112496 free, 13964 used. 6925448 avail Mem
In the case shown above the computer being shown has 4 CPUs, while more is generally better there is a limited amount of speed up that can be achieved with running NWCSAF as there some PGEs depend on others and so have to be run sequentially (not in parallel).
Now that we know how many processors we have to work with we can edit the configuration to take advantage of these processors.
First navigate to the config directory
cd $SAFNWC/config
once in the config directory open the system configuration file.
vim safnwc.cfs
After the header you should be able to see the "Operational Parameters" section of the file. This section is what controls the number of parallel processors that can be assigned for different processes. To allow NWCSAF to run PGEs in parallel with one another edit the NB_PARALLEL_PGES value to a number that is appropriate. From experimentation we have noticed that this should be set to a number that is smaller than your total number of processors to allow some slack for NWP mapping and other processes being run on the computer. It is also the case that for a single domain speedup levels off at approximately 4 CPUs as the number of PGEs and their dependencies on one another do not allow more than 4 PGEs to run simultaneously. Obviously if you run NWCSAF over more than 1 domain then these domains are independent of one another so increasing the NB_PARALLEL_PGES will result in faster processing of each time slot. The mapping of NWP data is able to make full use of parallelisation as it is not dependent on any other process that creates a bottle neck. Therefore it is advised that you set this to a value less than your total number of processors (to give some slack) but in line with the total number of processors. Below are some examples of Operational Parameter setting for computers with different numbers of CPUs and running NWCSAF on a variety of domains.
4 CPU computer, 1 domain.
# Operational Parameters
# ----------------------
REAL_TIME TRUE
SORT_KEY REGION
NB_PARALLEL_PGES 3
NB_THREADS_PGE 1
NB_THREADS_MAPPING 3
8 CPU computer, 1 domain
# Operational Parameters
# ----------------------
REAL_TIME TRUE
SORT_KEY REGION
NB_PARALLEL_PGES 4
NB_THREADS_PGE 1
NB_THREADS_MAPPING 6
8 CPU computer, 2 domains
# Operational Parameters
# ----------------------
REAL_TIME TRUE
SORT_KEY REGION
NB_PARALLEL_PGES 6
NB_THREADS_PGE 1
NB_THREADS_MAPPING 6
Once edited you should save and exit the system configuration file. When you next run NWCSAF youshould notice a significant improvement in its performance, the mapping of NWP data should take much less time and the processing of PGEs will also be faster.
The NWCSAF training data that we have already used is supplied in a decompressed format. This meant that an important pre-processing step required when using data from the EUMETCast service was not needed. While we will move onto using compressed data later in the tutorial, first we want to test whether the changes we have just made (NWP source, domain and products) work with the NWCSAF-GEO software.
Download this test data (here) and move into your safnwc directory. Now unzip the data file, this will populate the "NWP_data" and "Sat_data_archive" in your import directory with some GFS data and decompressed satellite data receptively.
Now lets run the updated version of NWCSAF-GEO.