Opened 15 years ago

Closed 15 years ago

#212 closed enhancement (fixed)

Enhance DateTime UTILS sub-package

Reported by: Dave Offiler Owned by: Huw Lewis
Priority: normal Milestone: 4.1
Component: ropp_utils Version: 4.0
Keywords: date, time, conversion Cc: huw.lewis@…

Description

a) ROPP_UTILS contains a sub-package of Date & Time manipulation routines which are PES and essentially from my collection of general utility routines. Apart from each routine being split into individual source files and including explicit module interfaces this sub-package has not been optimised for ROPP. As part of the on-going drive to reduce ROPP complexity, this sub-package could benefit from being simplified, both in the inter-package calling structure and user-interfaces.

b) The ROPP netCDF format contains some date/times held as 'seconds since 1-Jan-2000 00:00' (JS2000); at present, this is hard-wired to convert from normal calendar date/time when writing the file, and ignored on reading. The previously used udunits package (against my expectation) does not provide any date/time conversions and the simplified replacement units conversion routines also do not. A flexible time conversion function needs to be provided to deal with situations where a user- (not ROPP-)written netCDF file contains date/time other than JS2000.

This ticket is raised to flag the need for enhancing and optimising the current date/time utility sub-package in ROPP_UTILS and applying the updated routines to other parts of ROPP which use these functions.

Change history (3)

comment:1 by Dave Offiler, 15 years ago

Created & checked out branch r2472_datetime_do.

In parallel, my general utility code for the DateTime (datetime.f90) module has been significantly simplified and enhanced:

  • DTtype derived type dropped in favour of a simple 8-element array as returned by the F90 DATE_AND_TIME() intrinsic, consistently between all routines using these elements. Parts of the DTtype derived type such as Julian Day and Day Name are easily obtained from other routines
  • A couple of small, under-used routines coded in-line and the calling tree tidied up and

simplified

  • Replaced date-only JulianDate() with more flexible date+time CalToJul() (latter based on previously separate routine JulianToDateTime() from module Julian (julian.f90) which was not ported to ROPP
  • New all-in-one interface to DateTimeOffset()
  • Included new TimeSince() routine
  • Either of TimeSince() and DateTimeOffset() can potentially replace (or be called by to simplify) the ROPP GPSseconds() and JulianSeconds() routines
  • Adopted Calendar-to-Julian-Days and inverse algorithms based on Jan Meeus (1998) and consistent with published Python and C++ implementations
  • Unit and module integration tested to give (where applicable) identical outputs as the original DateTime code, including application utility cvdate

To Do:

  • Further review of DateTime usage in other ROPP modules now needed to check if the new DateTime sub-package is sufficient or needs tweaks for ROPP.
  • Replace existing DateTime sub-package in ROPP_UTILS with new version
  • Modify other ROPP code to interface with the new package as required
  • Regression test

comment:2 by Dave Offiler, 15 years ago

Cc: huw.lewis@… added
Owner: changed from Dave Offiler to Huw Lewis
Status: newassigned

From To Do list:

  • Included support for GPS seconds in TimeSince(). Additional stand-alone unit-level testing shows that TimeSince() gives identical output (<1ms) as JulianSeconds() and GpsSeconds(). Checked for correct compilation of DateTime package and run-time output using all Linux desktop f90 compilers. Run NAG compiler (without -w option) to detect & remove redundant legacy variables, etc. New DateTime package implemented in GWV project routine library & application tools.
  • Replaced ropp_utils/datetime files with new package. All source code files names are now completely lowercase. Only routines actually called (internally or elsewhere in any ROPP module) are retained.
  • All ROPP code using routines from ropp_utils/datetime modified to use the new routines.
  • All ROPP modules compiled from scratch and the module user-level tests run.

Updated code checked-in to branch as changeset [2479]

More To Do:

  • Someone else to review (Huw)
  • Merge branch back to Trunk
  • Re-check specific tools affected. In particular: ropp_pp COSMIC navigation bit processing where GpsSeconds() is replaced by TimeSince() is not exercised by the user-level tests; this needs to be explicitly checked for identical results.
  • Run full Test Folder system (as part of v4.1 testing)

comment:3 by Huw Lewis, 15 years ago

Resolution: fixed
Status: assignedclosed

Code reviewed and merged with latest ROPP-4.1 candidate code. See [2484]. This will be merged to trunk after all planned updates have been completed.

The ropp_pp tool ropp_pp_gras2ropp.f90 has been updated to call timesince() instead of JulianDay and the output validated. All user test routines have also been successfully completed for each built module.

A couple of validation tests using external navigation bits with COSMIC data have been performed, and the output of the navigation bit correlation processing is identical after the datetime changes.

Full testing will be completed after the code is merged to trunk along with all other v4.1 revisions.

Ticket closed as completed (only to be reopened if testing identifies any bugs).

Note: See TracTickets for help on using tickets.