Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Volet
import rpnpy.librmn.all as rmn             # Module to read RPN files

date = 20241106  # YYYYMMDD
time = 13300000  # hhmmsshh => 13h30

timestamp = rmn.newdate(rmn.NEWDATE_PRINT2STAMP, date, time)   # Code date and time into timestamp

print ('Coded value for date', date, 'at', time, 'is:', timestamp)

Answer:
   Coded value of date 20241106 at 13300000 is: 477041750

Example to convert coded timestamp to date & time:

Volet
import rpnpy.librmn.all as rmn              # Module to read RPN files

# Read one record  
filename = '...'                            # Name of RPN file to read
varname  = '...'                            # Name of variable to read

fid = rmn.fstopenall(filename,rmn.FST_RO)   # Open the file
rec = rmn.fstlir(fid,nomvar=varname)        # Read the full record of variable 'varname'
timestamp = rec['datev']                    # Read the code of the validity date

(date, time) = rmn.newdate(rmn.NEWDATE_STAMP2PRINT, timestamp)  # Decodes timestamp to date (YYYYMMDD) and time (hhmmsshh)
print ('Decoded value of timestamp', timestamp, 'is:', date, 'at', time)

rmn.fstcloseall(fid)                        # Close the RPN file

Answer:
   Decoded value of timestamp 477041750 is: 20241106 at 13300000

newdate (Fortran)

'newdate' is a Fortran function to code and decode RPN dates/times. 'newdate' is part of the RPN Fortran library. To get access to it you need to load the library 'librmn.a' when creating the executable. You can do that by added the key '-lrmn' to the compile command. For example:

...