Is there anything already coded in McIDAS-V which performs date conversions easily? I am looking for something like DATELIST (from McIDAS-X), which when entered at the command line, the current day would be returned in CCYYDDD and day full_month_name year and YYYY/MM/DD formats. Also, a date could be entered to get the julian date returned or a date offset from the current date.
Joleen
date conversions
Re: date conversions
Hi Joleen,
I'm told that there's no way to list different date formats (like the McIDAS-X command DATELIST). But there is a User Preference that lets you change the date format that appears in McV output (e.g., the layer label when you display an image). It's described here:
http://www.ssec.wisc.edu/mcidas/doc/mcv ... ences.html
Does that help?
Barry
I'm told that there's no way to list different date formats (like the McIDAS-X command DATELIST). But there is a User Preference that lets you change the date format that appears in McV output (e.g., the layer label when you display an image). It's described here:
http://www.ssec.wisc.edu/mcidas/doc/mcv ... ences.html
Does that help?
Barry
Re: date conversions
Hi Joleen -
If you don't know. You may override whatever is specified in the Preferences wherever you can use the %timestamp%. E.g. when saving time sequence of frames with View>Capture>Movie... I specify in the Filename Template: %time:yyyyMMddHHmm% in order to get compact filenames while I am using the %timestamp% macro as specified through Preferences (in my case "yyyy-MM-dd HH:mmz") for more readable layer labels.
HP
If you don't know. You may override whatever is specified in the Preferences wherever you can use the %timestamp%. E.g. when saving time sequence of frames with View>Capture>Movie... I specify in the Filename Template: %time:yyyyMMddHHmm% in order to get compact filenames while I am using the %timestamp% macro as specified through Preferences (in my case "yyyy-MM-dd HH:mmz") for more readable layer labels.
HP
Re: date conversions
Actually, because there is the conversion option in the User Preferences and the conversion is also handled when pulling data from the archive that I thought there might be something already hidden within McIDAS-V that is similar.
Joleen
Joleen
Re: date conversions
You can most easily use the Calendar class from Java...here's a little Jython:
>>> from java.util import Calendar
>>> cal = Calendar.getInstance()
>>> cal.set(2011,1,24)
>>> print cal.get(Calendar.DAY_OF_YEAR)
55
Note that months are Jan=0, Feb=1,...
>>> from java.util import Calendar
>>> cal = Calendar.getInstance()
>>> cal.set(2011,1,24)
>>> print cal.get(Calendar.DAY_OF_YEAR)
55
Note that months are Jan=0, Feb=1,...
Re: date conversions
Great! This is what I was looking for!
Joleen
Joleen
Re: date conversions
Please refer to the printDate forum post to obtain updated date conversion functions. printDate replaces dateList and fixes some bugs in the old dateList code. If you are still using dateList, please replace it with the new printDate code.
viewtopic.php?f=32&t=1562
viewtopic.php?f=32&t=1562
Last edited by joleenf on Thu Mar 19, 2015 3:08 pm, edited 1 time in total.
Re: date conversions
Small change to the code.
The lines
# Force the user to enter year, jday and day as integers.
year, jday, day=int(year), int(jday), int(day)
should include the "inc" variable as well...
# Force the user to enter year, jday and day as integers.
year, jday, day, inc=int(year), int(jday), int(day), int(inc)
The lines
# Force the user to enter year, jday and day as integers.
year, jday, day=int(year), int(jday), int(day)
should include the "inc" variable as well...
# Force the user to enter year, jday and day as integers.
year, jday, day, inc=int(year), int(jday), int(day), int(inc)
Re: date conversions
pd is now included in the printDate code, located in the following forum post:
viewtopic.php?f=32&t=1562
pd is shorthand for printDate. pd will quickly print the date for an input date, but does not provide any option for output date format. After copying the code found in the forum post viewtopic.php?f=32&t=1562, please use
testPrintDate() # to test printDate code
progHelp(pd) # to display help for the updated pd function
progHelp(printDate) # to display help for updated date conversion function.
viewtopic.php?f=32&t=1562
pd is shorthand for printDate. pd will quickly print the date for an input date, but does not provide any option for output date format. After copying the code found in the forum post viewtopic.php?f=32&t=1562, please use
testPrintDate() # to test printDate code
progHelp(pd) # to display help for the updated pd function
progHelp(printDate) # to display help for updated date conversion function.
Last edited by joleenf on Thu Mar 19, 2015 3:11 pm, edited 1 time in total.
Re: date conversions
See above. dateList has been replaced by printDate.
Last edited by joleenf on Thu Mar 19, 2015 3:11 pm, edited 1 time in total.