#!/bin/env tclsh # # Label the Wisconsin Water vapor images # set TZ "Z" set myFormat "%m/%d/%Y" set baseName "nauticus-WV-" set s [gets stdin] while { ! [eof stdin] } { if { [string equal $s "nauticus-WV-latest.jpg"] } { set s [gets stdin] continue } if { [scan $s "${baseName}%2s%3d-%2d%2d" year jday hour minute] == 4 } { # to make the clock conversion easier, subtract one from the jday set jday [expr $jday - 1] # get a base date.. set dateInSeconds [clock scan "$jday day" -base [clock scan 01/01/$year]] # format it to our liking.. set dateLabel [clock format $dateInSeconds -format $myFormat] # format the label and print it out... set dateFormat "$dateLabel:%2.2d:%2.2d$TZ" puts stdout [format $dateFormat $hour $minute] } else { puts stdout $s } set s [gets stdin] }