From b74c5209ceb3e4882a36df5bc3a4767f5db8853d Mon Sep 17 00:00:00 2001 From: Mrinal Biswas Date: Thu, 28 Jan 2021 00:23:19 +0000 Subject: [PATCH] Adding script to untar dropsonde files and PoistStat conf file for hafs comparison --- .../PointStat_fcstHAFS_obsFRD_NetCDF.conf | 81 +++++++++++++++++++ .../tc_and_extra_tc/hrd_frd_sonde_find_tar.py | 40 +++++++++ 2 files changed, 121 insertions(+) create mode 100644 parm/use_cases/model_applications/tc_and_extra_tc/PointStat_fcstHAFS_obsFRD_NetCDF.conf create mode 100644 parm/use_cases/model_applications/tc_and_extra_tc/hrd_frd_sonde_find_tar.py diff --git a/parm/use_cases/model_applications/tc_and_extra_tc/PointStat_fcstHAFS_obsFRD_NetCDF.conf b/parm/use_cases/model_applications/tc_and_extra_tc/PointStat_fcstHAFS_obsFRD_NetCDF.conf new file mode 100644 index 0000000000..bdb66af1e3 --- /dev/null +++ b/parm/use_cases/model_applications/tc_and_extra_tc/PointStat_fcstHAFS_obsFRD_NetCDF.conf @@ -0,0 +1,81 @@ +[config] +## Configuration-related settings such as the process list, begin and end times, etc. +PROCESS_LIST = PointStat + +## LOOP_ORDER +## Options are: processes, times +## Looping by time- runs all items in the PROCESS_LIST for each +## initialization time and repeats until all times have been evaluated. +## Looping by processes- run each item in the PROCESS_LIST for all +## specified initialization times then repeat for the next item in the +## PROCESS_LIST. +LOOP_ORDER = times + +LOOP_BY = VALID +VALID_TIME_FMT = %Y%m%d%H +VALID_BEG = 2019082912 +VALID_END = 2019082912 +VALID_INCREMENT = 21600 + +LEAD_SEQ = 0,6,12,18 + +# For both pb2nc and point_stat, the obs_window dictionary: +OBS_WINDOW_BEGIN = -5400 +OBS_WINDOW_END = 5400 + +# Logging levels: DEBUG, INFO, WARN, ERROR (most verbose is DEBUG) +LOG_LEVEL = DEBUG + +## MET Configuration files for point_stat + +POINT_STAT_CONFIG_FILE ={PARM_BASE}/met_config/PointStatConfig_wrapped + +# Model/fcst and obs name, e.g. GFS, NAM, GDAS, etc. +MODEL = HAFS +OBTYPE = drop + +obs_quality = [] + +# Regrid to specified grid. Indicate NONE if no regridding, or the grid id +# (e.g. G212) +POINT_STAT_REGRID_TO_GRID = NONE + +# Verification Masking regions +# Indicate which grid and polygon masking region, if applicable +POINT_STAT_GRID = FULL +# List of full path to poly masking files. NOTE: Only short lists of poly +# files work (those that fit on one line), a long list will result in an +# environment variable that is too long, resulting in an error. For long +# lists of poly masking files (i.e. all the mask files in the NCEP_mask +# directory), define these in the MET point_stat configuration file. +POINT_STAT_POLY = +POINT_STAT_STATION_ID = + +# Message types, if all message types are to be returned, leave this empty, +# otherwise indicate the message types of interest. +POINT_STAT_MESSAGE_TYPE = ADPUPA + +# Variables and levels as specified in the field dictionary of the MET +# point_stat configuration file. Specify as FCST_VARn_NAME, FCST_VARn_LEVELS, +# (optional) FCST_VARn_OPTION + +BOTH_VAR1_NAME = TMP +BOTH_VAR1_LEVELS = P925-950, P850-800, P700-650 + + +LOG_POINT_STAT_VERBOSITY=5 +[dir] +PB2NC_OUTPUT_DIR = {OUTPUT_BASE} + +FCST_POINT_STAT_INPUT_DIR = {INPUT_BASE}/hafs.2019082912 +OBS_POINT_STAT_INPUT_DIR = {PB2NC_OUTPUT_DIR} + +POINT_STAT_OUTPUT_DIR = {OUTPUT_BASE}/{OBTYPE} + +[filename_templates] +## Output file template +PB2NC_OUTPUT_TEMPLATE = drop{valid?fmt=%Y%m%d}.nc + +FCST_POINT_STAT_INPUT_TEMPLATE = dorian05l.{init?fmt=%Y%m%d%H}.hafsprs.synoptic.0p03.f{lead?fmt=%HHH}.grb2 +OBS_POINT_STAT_INPUT_TEMPLATE = {PB2NC_OUTPUT_TEMPLATE} + diff --git a/parm/use_cases/model_applications/tc_and_extra_tc/hrd_frd_sonde_find_tar.py b/parm/use_cases/model_applications/tc_and_extra_tc/hrd_frd_sonde_find_tar.py new file mode 100644 index 0000000000..821e65d8f8 --- /dev/null +++ b/parm/use_cases/model_applications/tc_and_extra_tc/hrd_frd_sonde_find_tar.py @@ -0,0 +1,40 @@ +##################################################################### +# This script will untar the FRD formatted dropsonde tar files from +# https://www.aoml.noaa.gov/hrd/data_sub/dropsonde.htmli +# The untarred files will be downloaded in to a direcory +# named YYYYMMDD. Arguments to the scripts includes +# directory where the tar files exists, the user specified +# date in YYYYMMDD, and output directory +# Author: biswas@ucar.edu +##################################################################### + +import sys +import os +import glob +import tarfile + +if len(sys.argv) == 4: + path = sys.argv[1] + date = sys.argv[2] + outdir = sys.argv[3] + + if os.path.exists(path): + print("Directory exists: "+ path) + + for name in glob.glob(path+'/'+str(date)+'*FRD.tar.gz'): + print (name) + + drop_tar = tarfile.open(name) + drop_tar.extractall(outdir + '/'+str(date)) + drop_files = os.listdir(outdir + '/'+str(date)) + print(drop_files) + drop_tar.close() + + else: + print("Direcory not present" + path) + +else: + print("ERROR : Must specify exactly one input data directory, date (YYYYMMDD), and output directory.") + sys.exit(1) + +####################################################################