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.

...

For the end-user, the appearance of the RPN is that of a flat-file database structure. A single file contains numerous records which hold fields on 1, 2 or 3D data grids and self-describing information about the fields (header).

A thorough set of FST-related routines are contained in the RPN Library (armnlib). These routines provide easy access to the file contents. They can be called from FORTRAN or C routines.

A complete description of the FST file format and the utilities which can be used to manipulate and view their contents is available online at www.cmc.ec.gc.ca/rpn/utilities.

Sometimes the files are archived in an cmc-archive file (*.ca). If this is the case they need to be unarchived first.

Looking at RPN files

vl3, vl4, vl5 -> list variable with description

At UQAM, there is also a set of 'vl' (variable list) commands (one for each model version) which will give you a list of all the variables in an RPN file. The first description is always correct, but rarely contains the unit. For physics fields take the second description with a grain of salt. If it matches the first one, it's unit is correct as well. If it doesn't match, ignore it. However, to all units of accumulators a 'per second' needs to get added, for example:

The maximum size of RPN file is a little more than 8 GB!!! If you are trying to write a file larger than the maximum size the file will not get closed. Meaning no application will be able to open it and it can be considered as "corrupted". The usual error message one get when trying to open such a file is "file (unit=...) currently used by another application in write mode".

Looking at RPN files

vl3, vl4, vl5 -> list variable with description

At UQAM, there is also a set of 'vl' (variable list) commands (one for each model version) which will give you a list of all the variables in an RPN file. The first description is always correct, but rarely contains the unit. For physics fields take the second description with a grain of salt. If it matches the first one, it's unit is correct as well. If it doesn't match, ignore it. However, to all units of accumulators a 'per second' needs to get added, for example:

    precipitation is not in [m] but in [m/s]
    radiation fields are not in [J/m2] but in [J/s/m2] so in [    precipitation is not in [m] but in [m/s]
    radiation fields are not in [J/m2] but in [J/s/m2] so in [W/m2]

Usage:


Volet
vl5 filename

...

Among other things, xrec can get used to :

  • display 2-D fields
  • vertical cross sections and profiles
  • time series for selected points.
  • time animation

Check the full documentation (xrec-documentation) about how to do this or just click on the buttons and look at the menus.

Dictionary

to :

  • display 2-D fields
  • vertical cross sections and profiles
  • time series for selected points.
  • time animation

Check the full documentation (xrec-documentation) about how to do this or just click on the buttons and look at the menus.

Dictionary

xrec is using a dictionary to define the title, unit (including a multiplication factor) and contour intervals for each variable.
The name of the dictionary is:
      ~/.recrc
It needs to have exactly this name and it needs to be in your home. To have a dictionary to start from you are welcome to take a copy of mine ( cp ~winger/.recrc ~/. ) or ask a college if you can copy hers/his.
You can find more information about this dictionary by clicking on the following link: xrec-dictionary

Remove default contour lines

The first time you open any field with xrec you will see there are "Colors" and "Contours". If you do not want to have "Contours" by default (you can always add or remove them later) do the following:

  1. Open xrec with any file
  2. Click on "Display" and unselect "Contours"
  3. Click on "File" and on "Quit and save configuration"
  4. Open xrec with any file again
  5. Select any file. If the contours are gone, you did the above correctly. If the background is now gray and you would like to have a white one again...
  6. Click on "Options" and  "Contours" - a new window will open. In that window...
  7. Click on "Background" and select "Color:" "white"
  8. Click on "File" and on "Quit and save configuration"

The next time you open xrec the default contour lines should be back and the background should be white again.xrec is using a dictionary to define the title, unit (including a multiplication factor) and contour intervals for each variable.
The name of the dictionary is:
      ~/.recrc
It needs to have exactly this name and it needs to be in your home. To have a dictionary to start from you are welcome to take a copy of mine ( cp ~winger/.recrc ~/. ) or ask a college if you can copy hers/his.
You can find more information about this dictionary by clicking on the following link: xrec-dictionary

High resolution geography

...

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:

...