Skip to content

Instantly share code, notes, and snippets.

@hsiboy
Created September 21, 2018 17:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsiboy/918a035beb8f10d3a55be2e69bcb394c to your computer and use it in GitHub Desktop.
Save hsiboy/918a035beb8f10d3a55be2e69bcb394c to your computer and use it in GitHub Desktop.
# define our method
def replace_all(text, dic):
for i, j in dic.iteritems():
text = text.replace(i, j)
return text
navtex = 'navtex string here'
# our dictionary with our key:values.
dic = {'BACK':'Backing','KMH':'Km/h','QUAD':'Quadrant','BECMG':'Becoming','KT':'Knots','RPDY':'Rapidly','BLDN':'Building','LAT/LONG':'Latitude/Longitude','SCT':'Scattered','C-FRONT':'Cold front','LOC':'Locally','SEV':'Severe','SVR':'Severe','DECR':'Decreasing','M':'Metres','SHWRS':'Showeres','SH':'showers','DPN':'Deepening','MET':'Meteo','SIG':'Significant','EXP':'Expected,''MOD':'Moderate','SLGT':'slight','SLT':'Slight','FCST':'Forecsat','MOV':'moving/move','MVG':'Moving/Move','SLWY':'Slowly','FLN':'Filling','NC':'No change','STNR':'Stationary','FLW':'Following','NM':'Nautical miles','STRG':'Strong','FM':'From','NOSIG':'No significant change','TEMPO':'Temporarily/Temporary','FRQ':'Frequent/frequency','NXT':'Next','TEND':'Further Outlooks','HPA':'HectoPascal','OCNL':'Ocasionally','VEER':'Veering','HVY':'Heavy','O-FRONT':'Occluded front','OFNT':'Occluded front','VIS':'Visibility','IMPR':'Improving/Improve','POSS':'Possible','VRB':'Variable','INCR':'Increasing','PROB':'Probability/Probable','W-FRONT':'Warm front','WFNT':'Warm Front','INTSF':'Intensifying/Intensify','QCKY':'Quickly','WKN':'Weakening','ISOL':'Isolated','QSTNR':'Quasi-stationary'}
print replace_all(navtex, dic)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment