Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add use of 'all' for chans, using instrument_channels.yaml.
  • Loading branch information
EdwardSafford-NOAA committed Mar 14, 2024
1 parent defd60a commit 4368139
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
6 changes: 0 additions & 6 deletions jobs/JMON_PLOT_OBS
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
###########################
# J-job for Mon Plot Obs
###########################
<<<<<<< HEAD
st=`date`
=======
>>>>>>> develop

export NET="obsmon"
export PDATE="${PDY}${cyc}"
Expand Down Expand Up @@ -56,9 +53,6 @@ KEEPDATA=${KEEPDATA:-"NO"}
cd ${DATAROOT}
[[ ${KEEPDATA} = "NO" ]] && rm -rf ${DATA}

<<<<<<< HEAD
en=`date`
echo start: $st
echo end: $en
=======
>>>>>>> develop
19 changes: 19 additions & 0 deletions parm/instrument_channels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
abi: '7,8,9,10,11,12,13,14,15,16'

ahi: '7,8,9,10,11,12,13,14,15,16'

amsua: '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15'

atms: '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22'

avhrr: '3,4,5'

cris-fsr: '19,24,26,27,28,31,32,33,37,39,42,44,47,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,208,211,216,224,234,236,238,239,242,246,248,255,264,266,268,275,279,283,285,291,295,301,305,311,332,342,389,400,402,404,406,410,427,439,440,441,445,449,455,458,461,464,467,470,473,475,482,486,487,490,493,496,499,501,503,505,511,513,514,518,519,520,522,529,534,563,568,575,592,594,596,598,600,602,604,611,614,616,618,620,622,626,631,638,646,648,652,659,673,675,678,684,688,694,700,707,710,713,714,718,720,722,725,728,735,742,748,753,762,780,784,798,849,860,862,866,874,882,890,898,906,907,908,914,937,972,973,978,980,981,988,995,998,1000,1003,1008,1009,1010,1014,1017,1018,1020,1022,1024,1026,1029,1030,1032,1034,1037,1038,1041,1042,1044,1046,1049,1050,1053,1054,1058,1060,1062,1064,1066,1069,1076,1077,1080,1086,1091,1095,1101,1109,1112,1121,1128,1133,1163,1172,1187,1189,1205,1211,1219,1231,1245,1271,1289,1300,1313,1316,1325,1329,1346,1347,1473,1474,1491,1499,1553,1570,1596,1602,1619,1624,1635,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,2119,2140,2143,2147,2153,2158,2161,2168,2171,2175,2182'

iasi: '16,29,32,35,38,41,44,47,49,50,51,53,55,56,57,59,61,62,63,66,68,70,72,74,76,78,79,81,82,83,84,85,86,87,89,92,93,95,97,99,101,103,104,106,109,110,111,113,116,119,122,125,128,131,133,135,138,141,144,146,148,150,151,154,157,159,160,161,163,167,170,173,176,179,180,185,187,191,193,197,199,200,202,203,205,207,210,212,213,214,217,218,219,222,224,225,226,228,230,231,232,236,237,239,243,246,249,252,254,259,260,262,265,267,269,275,279,282,285,294,296,299,300,303,306,309,313,320,323,326,327,329,332,335,345,347,350,354,356,360,363,366,371,372,373,375,377,379,381,383,386,389,398,401,404,405,407,408,410,411,414,416,418,423,426,428,432,433,434,439,442,445,450,457,459,472,477,483,509,515,546,552,559,566,571,573,578,584,594,625,646,662,668,705,739,756,797,867,906,921,1027,1046,1090,1098,1121,1133,1173,1191,1194,1222,1271,1283,1338,1409,1414,1420,1424,1427,1430,1434,1440,1442,1445,1450,1454,1460,1463,1469,1474,1479,1483,1487,1494,1496,1502,1505,1509,1510,1513,1518,1521,1526,1529,1532,1536,1537,1541,1545,1548,1553,1560,1568,1574,1579,1583,1585,1587,1606,1626,1639,1643,1652,1658,1659,1666,1671,1675,1681,1694,1697,1710,1786,1791,1805,1839,1884,1913,1946,1947,1991,2019,2094,2119,2213,2239,2271,2289,2321,2333,2346,2349,2352,2359,2367,2374,2398,2426,2562,2701,2741,2745,2760,2819,2889,2907,2910,2919,2921,2939,2944,2945,2948,2951,2958,2971,2977,2985,2988,2990,2991,2993,3002,3008,3014,3027,3029,3030,3036,3047,3049,3052,3053,3055,3058,3064,3069,3087,3093,3098,3105,3107,3110,3116,3127,3129,3136,3146,3151,3160,3165,3168,3175,3178,3189,3207,3228,3244,3248,3252,3256,3263,3281,3295,3303,3309,3312,3322,3326,3354,3366,3375,3378,3411,3416,3432,3438,3440,3442,3444,3446,3448,3450,3452,3454,3458,3467,3476,3484,3491,3497,3499,3504,3506,3509,3518,3527,3555,3575,3577,3580,3582,3586,3589,3599,3610,3626,3638,3646,3653,3658,3661,3673,3689,3700,3710,3726,3763,3814,3841,3888,4032,4059,4068,4082,4095,4160,4234,4257,4411,4498,4520,4552,4567,4608,4646,4698,4808,4849,4920,4939,4947,4967,4991,4996,5015,5028,5056,5128,5130,5144,5170,5178,5183,5188,5191,5368,5371,5379,5381,5383,5397,5399,5401,5403,5405,5446,5455,5472,5480,5483,5485,5492,5497,5502,5507,5509,5517,5528,5558,5697,5714,5749,5766,5785,5798,5799,5801,5817,5833,5834,5836,5849,5851,5852,5865,5869,5881,5884,5897,5900,5916,5932,5948,5963,5968,5978,5988,5992,5994,5997,6003,6008,6023,6026,6039,6053,6056,6067,6071,6082,6085,6098,6112,6126,6135,6140,6149,6154,6158,6161,6168,6174,6182,6187,6205,6209,6213,6317,6339,6342,6366,6381,6391,6489,6962,6966,6970,6975,6977,6982,6985,6987,6989,6991,6993,6995,6997,6999,7000,7004,7008,7013,7016,7021,7024,7027,7029,7032,7038,7043,7046,7049,7069,7072,7076,7081,7084,7089,7099,7209,7222,7231,7235,7247,7267,7269,7284,7389,7419,7423,7424,7426,7428,7431,7436,7444,7475,7549,7584,7665,7666,7831,7836,7853,7865,7885,7888,7912,7950,7972,7980,7995,8007,8015,8055,8078'

mhs: '1,2,3,4,5'

ssmis: '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24'

viirs-m: '12,13,14,15,16'
30 changes: 24 additions & 6 deletions ush/plotObsMon.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def camelCase(s):


def loadConfig(satname, instrument, obstype, plot, cycle_tm, cycle_interval,
data_location, model=None):
data_location, model=None, chan_dict=None):
"""
Load configuration dictionary.
Expand Down Expand Up @@ -85,11 +85,15 @@ def loadConfig(satname, instrument, obstype, plot, cycle_tm, cycle_interval,
date_str = f"PDATEm{x*cycle_interval}"
config[date_str] = add_to_datetime(cycle_tm, to_timedelta(f"-{cycle_interval*x}H"))

# Some plots with channels require a configuration value of XTICKS (tick marks on the
# plotted x axis). The x axis tick marks indicate the actual channel number, which can
# be > 8000 for iasi. Use the actual channel numbers as tick marks, if the last channel
# is < 30 (all but cris-fsr and iasis are), or use a resonable interval if larger.
if config['CHANNELS'] is not None:

if config['CHANNELS'] == 'all':
config['CHANNELS'] = chan_dict[config['SENSOR']]

# Some plots with channels require a configuration value of XTICKS (tick marks on the
# plotted x axis). The x axis tick marks indicate the actual channel number, which can
# be > 8000 for iasi. Use the actual channel numbers as tick marks, if the last channel
# is < 30 (all but cris-fsr and iasis are), or use a resonable interval if larger.
last_chan = int(config['CHANNELS'].split(',')[-1])

if last_chan < 30:
Expand Down Expand Up @@ -141,6 +145,19 @@ def loadConfig(satname, instrument, obstype, plot, cycle_tm, cycle_interval,
# Generate template YAMLS and figures for specified satellite instruments
# minimization stats, and conventional observations
if 'satellites' in mon_dict.keys():

# Load the chan_dict, which will contain all the channels for a given
# instrument. This is used if the input yaml file uses 'all' for channels.
try:
parm_location = os.environ.get('PARMobsmon', '../parm')
chan_sources = os.path.join(parm_location, 'instrument_channels.yaml')
with open(chan_sources, 'r') as chan_sources_opened:
chan_dict = yaml.safe_load(chan_sources_opened)

except Exception as e:
logger.info('Warning: unable to load channel information ' +
f'errors when attempting to load: {chan_sources}, error: {e}')

for sat in mon_dict.get('satellites'):
satname = sat.get('name')
obstype = None
Expand All @@ -150,7 +167,8 @@ def loadConfig(satname, instrument, obstype, plot, cycle_tm, cycle_interval,

for plot in inst.get('plot_list'):
config = loadConfig(satname, instrument, obstype, plot, cycle_tm,
cycle_interval, data_location, model)
cycle_interval, data_location, model, chan_dict)

plot_template = f"{config['PLOT_TEMPLATE']}.yaml"
plot_yaml = f"{config['SENSOR']}_{config['SAT']}_{plot_template}"

Expand Down

0 comments on commit 4368139

Please sign in to comment.