5.2.10.1. GenVxMask: Solar Altitude

model_applications/space_weather/GenVxMask_fcstGloTEC_solar _altitude.conf

Overview

This use case illustrates the use of the gen_vx_mask tool for the space weather domain. It creates a mask for region where the solar altitude angle is less than 45 degrees (low sun angle or sun below the horizon), only letting data through for the region where the sun is high in the sky (i.e., solar altitude angle greater than 45 degrees).

In this use case, the input data is the GloTEC model run assimilated with COSMIC-1 RO data.

This use case runs gen_vx_mask for a couple forecast times from a space weather event known as the St. Patrick’s Day Storm (Mar 17, 2015).

Novel aspects of this use case:
  • First example use case to run gen_vx_mask on a space weather model (GloTEC)

  • Example of how to run gen_vx_mask on NetCDF input data which do not strictly conform to the Climate Forecasts (CF) conventions

  • Example of constructing a mask based on the solar altitude angle.

  • Changing the mask condition to solar alt <= 0 will mask out the night region.

  • Changing the mask condition to solar alt > 0 will mask the day region.

Background: The solar altitude angle is the angle of the sun relative to the Earth’s horizon, and is measured in degrees. The altitude is zero at sunrise and sunset, and can reach a maximum of 90 degrees (directly overhead) at noon at latitudes near the equator. [Source: https://sciencing.com/solar-altitude-23364.html]

Scientific Objective

Creating masking region files to be used by other MET tools. This use case applies a solar altitude mask (solar altitude restriction) to the input grid, creating a separate masked output file for each time level of the input file.

Datasets

Input Grid: GloTEC
Masks: Solar altitude
Location: All of the input data required for this use case can be found in the sample data tarball.
This tarball should be unpacked into the directory that you will set the value of INPUT_BASE. See Running METplus section for more information.
Data source: NOAA Space Weather Prediction Center (SWPC)
Data contact: Dominic Fuller-Rowell (dominic.fuller-rowell@noaa.gov)

METplus Use Case Contact

Author: Jonathan L. Vigh (National Center for Atmospheric Research / Research Applications Laboratory / Joint Numerical Testbed)
Last modified: 26 May 2020

METplus Components

This use case utilizes the METplus GenVxMask wrapper to generate a command to run the MET tool GenVxMask if all required files are found.

METplus Workflow

GenVxMask is the only tool called in this example. It processes the following run time:

Init: 2015-03-17 0005Z
Forecast lead: 0
Init: 2015-03-17 0015Z
Forecast lead: 0

The input file is read to define the output grid. Then the solar altitude angle specified with the -thresh argument is applied to the input file, creating the output file.

METplus Configuration

METplus first loads all of the configuration files found in parm/metplus_config, then it loads any configuration files passed to METplus via the command line with the -c option, i.e. -c parm/use_cases/model_applications/space_weather/GenVxMask_fcstGloTEC_FcstOnly_solar_altitude.conf

# GenVxMask METplus Configuration for the GenVxMask_glotec_solar_altitude space weather use case: 
#    Creating masks based on the solar altitude angle for GloTEC model data (id: vx12)
#
# Author: Jonathan Vigh (NCAR/RAL/JNTP)
#
# Description: This use case illustrates the use of the gen_vx_mask tool for the space weather domain.
#              It creates a mask for region where the solar altitude angle is less than 45 degrees
#              (low sun angle or sun below the horizon), only letting data through for the region
#              where the sun is high in the sky (i.e., solar altitude angle greater than 45 degrees). 
#
#              In this use case, the input data is the GloTEC model run assimilated with COSMIC-1 RO data.
#
#              This use case runs gen_vx_mask for a couple forecast times from a  
#              space weather event known as the St. Patricks Day Storm (Mar 17, 2015). 
#
#              Novel aspects of this use case:
#                - First example use case to run gen_vx_mask on a space weather model (GloTEC)
#                - Example of how to run gen_vx_mask on NetCDF input data which do not strictly conform to the 
#                      Climate Forecasts (CF) conventions
#                - Example of constructing a mask based on the solar altitude angle.
#                - Changing the mask condition to solar alt <= 0 will mask out the night region.
#                - Changing the mask condition to solar alt > 0 will mask the day region. 
#
#              Background: The solar altitude angle is the angle of the sun relative to the Earth's horizon, 
#              and is measured in degrees. The altitude is zero at sunrise and sunset, and can reach a 
#              maximum of 90 degrees (directly overhead) at noon at latitudes near the equator. 
#              [Source: https://sciencing.com/solar-altitude-23364.html]                 
#

# section heading for [config] variables - all items below this line and
# before the next section heading correspond to the [config] section
[config]
## Configuration-related settings such as the process list, begin and end times, etc.

# List of applications to run - only GenVxMask for this case
PROCESS_LIST = GenVxMask

# time looping - options are INIT, VALID, RETRO, and REALTIME
# If set to INIT or RETRO:
#   INIT_TIME_FMT, INIT_BEG, INIT_END, and INIT_INCREMENT must also be set
# If set to VALID or REALTIME:
#   VALID_TIME_FMT, VALID_BEG, VALID_END, and VALID_INCREMENT must also be set
LOOP_BY = VALID

# Format of VALID_BEG and VALID_END using % items
# %Y = 4 digit year, %m = 2 digit month, %d = 2 digit day, etc.
# see www.strftime.org for more information
# %Y%m%d%H expands to YYYYMMDDHH
VALID_TIME_FMT = %Y%m%d%H%M

# Start time for METplus run - must match INIT_TIME_FMT
VALID_BEG = 201503170005

# End time for METplus run - must match INIT_TIME_FMT
VALID_END = 201503170015

# Just run the first two time points for this use case example 
# replace with 201503172355 process the entire day

# Increment between METplus runs (in seconds if no units are specified)
#  Must be >= 60 seconds
VALID_INCREMENT = 600

# List of forecast leads to process for each run time (init or valid)
# If unset, defaults to 0 (don't loop through forecast leads
LEAD_SEQ = 0

# The above configuration will loop by valid time in increments of 
#  VALID_INCREMENT from VALID_BEG to VALID_END. Since LEAD_SEQ is set to 0,
#  it will not loop over any forecast lead times. 
#  This will run:
#  Valid: 2015-03-17_0005Z Forecast lead: 0 
#      to 2015-03-17_0055Z Forecast lead: 0


# Order of loops to process data - Options are times, processes
# Not relevant if only one item is in the PROCESS_LIST
# times = run all wrappers in the PROCESS_LIST for a single run time, then
#   increment the run time and run all wrappers again until all times have
#   been evaluated.
# processes = run the first wrapper in the PROCESS_LIST for all times
#   specified, then repeat for the next item in the PROCESS_LIST until all
#   wrappers have been run
LOOP_ORDER = times

# Verbosity of MET output - overrides LOG_VERBOSITY for GenVxMask only
LOG_GEN_VX_MASK_VERBOSITY = 2

GEN_VX_MASK_SKIP_IF_OUTPUT_EXISTS = False

# Time relative to valid time (in seconds if no units are specified) to allow files to be considered
#  valid. Set both BEGIN and END to 0 to require the exact time in the filename
#  Not used in this example.
GEN_VX_MASK_FILE_WINDOW_BEGIN = 0
GEN_VX_MASK_FILE_WINDOW_END = 0

# Command line arguments to add to the call to gen_vx_mask
GEN_VX_MASK_OPTIONS = -type solar_alt -thresh 'le45' -name TEC_with_solar_altitude_angle_le_45_masked_{valid?fmt=%Y_%m_%d_%H%M} -input_field 'name="TEC"; level="({valid?fmt=%Y%m%d_%H%M%S},*,*)"; file_type=NETCDF_NCCF;' -mask_field 'name="TEC"; level="({valid?fmt=%Y%m%d_%H%M%S},*,*)"; file_type=NETCDF_NCCF;'

[filename_templates]

# Template to look for input to GenVxMask relative to GEN_VX_MASK_INPUT_DIR
GEN_VX_MASK_INPUT_TEMPLATE = GloTEC_TEC_{valid?fmt=%Y_%m_%d}_cosmic.nc

GEN_VX_MASK_INPUT_MASK_TEMPLATE = GloTEC_TEC_{valid?fmt=%Y_%m_%d}_cosmic.nc

# Template to use to write output from GenVxMask
GEN_VX_MASK_OUTPUT_TEMPLATE = GloTEC_TEC_solar_altitude_le_45_masked_{valid?fmt=%Y_%m_%d_%H%M}.nc


[dir]

# Input/Output directories can be left empty if the corresponding template contains the full path to the files
GEN_VX_MASK_INPUT_DIR = {INPUT_BASE}/model_applications/space_weather/glotec_vs_glotec/GLO_20190422_with_cosmic

GEN_VX_MASK_INPUT_MASK_DIR = {INPUT_BASE}/model_applications/space_weather/glotec_vs_glotec/GLO_20190422_with_cosmic

GEN_VX_MASK_OUTPUT_DIR={OUTPUT_BASE}/model_applications/space_weather/GenVxMask_glotec_solar_altitude

MET Configuration

None. GenVxMask does not use configuration files.

Running METplus

This use case can be run two ways:

  1. Passing in the use case config file then a user-specific system configuration file:

    run_metplus.py -c /path/to/METplus/parm/use_cases/model_applications/space_weather/GenVxMask_fcstGloTEC_FcstOnly_solar_altitude.conf -c /path/to/user_system.conf
    
  2. Modifying the configurations in parm/metplus_config, then passing in the use case config file:

    run_metplus.py -c /path/to/METplus/parm/use_cases/model_applications/space_weather/GenVxMask_fcstGloTEC_FcstOnly_solar_altitude.conf
    

The former method is recommended. Whether you add them to a user-specific configuration file or modify the metplus_config files, the following variables must be set correctly:

  • INPUT_BASE - Path to directory where sample data tarballs are unpacked (See Datasets section to obtain tarballs). This is not required to run METplus, but it is required to run the examples in parm/use_cases

  • OUTPUT_BASE - Path where METplus output will be written. This must be in a location where you have write permissions

  • MET_INSTALL_DIR - Path to location where MET is installed locally

Example User Configuration File:

[dir]
INPUT_BASE = /path/to/sample/input/data
OUTPUT_BASE = /path/to/output/dir
MET_INSTALL_DIR = /path/to/met-X.Y

NOTE: All of these items must be found under the [dir] section.

Expected Output

A successful run will output the following both to the screen and to the logfile:

INFO: METplus has successfully finished running.

Refer to the value set for OUTPUT_BASE to find where the output data was generated. Output for this use case will be found in model_applications/space_weather/GenVxMask_fcstGloTEC_solar_altitude (relative to OUTPUT_BASE) and will contain the following files:

  • GloTEC_TEC_solar_altitude_le_45_masked_2015_03_17_0005.nc

  • GloTEC_TEC_solar_altitude_le_45_masked_2015_03_17_0015.nc

Keywords

sphinx_gallery_thumbnail_path = ‘_static/space_weather-GenVxMask_fcstGloTEC_solar_altitude.png’

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery