General information

RPNPy is a Python module which can read and write records of RPN files. It contains wrappers for librmn’s main fstd98 and convip C functions along with helper functions.

You can get the official description by clicking on the following link: RPNPy Reference

Note: The RPN functions read and write only one record at the time, not the whole file at once like the NetCDF functions. You need to loop over all the records you want to read or write.

To get access to this module in Python you have to acquire it before opening Python. For example for Python3 with

module  load  python3/miniforge3  python3/python-rpn  python3/outils-divers
source  activate  base_plus

In your Python script you can then import the module with, for example:

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

List information about module

Once the module is imported in Python one can get information about the different functions of the module with...

List general information with

     help (rmn)

List fst-functions

     help (rmn.fstd98)

List basic functions

     help (rmn.base)

Get information about a specific function

For example:

     help (rmn.fstlir)
     help (rmn.newdate)

List of main functions

Basic RPN functions

   newdate(imode, idate1, idate2=0)
       Convert date format between: printable, CMC date-time stamp, true date

   incdatr(idate, nhours)
       Increase idate by nhours

   difdatr(idate1, idate2)
       Compute the diffence between dates in hours (nhours = idate1 - idate2)

   convertIp(mode, v, k=0)
       Codage/Decodage level (P, kind <-> IP pour IP1, IP2, IP3)

Main fst-functions

   fstopt(optName, optValue, setOget=0) 
       Set or print FST option. Use to suppress excessive "talking" of the following fst-functions.

   fstopenall(paths, filemode='RND+R/O', verbose=None) 
        Open all fstfiles found in path

   fstcloseall(iunit, verbose=None) 
        Close all files associated with provided file unit number.

   fstlir(iunit, datev=-1, etiket=' ', ip1=-1, ip2=-1, ip3=-1, typvar=' ', nomvar=' ', dtype=None, rank=None, dataArray=None) 
        Reads the next record that matches the research keys

   fstlirx(key, iunit, datev=-1, etiket=' ', ip1=-1, ip2=-1, ip3=-1, typvar=' ', nomvar=' ', dtype=None, rank=None, dataArray=None) 
        Reads the next record after 'key' that matches the research keys

   fstlis(iunit, dtype=None, rank=None, dataArray=None) 
        Reads the next record that matches the research criterias

   fstinf(iunit, datev=-1, etiket=' ', ip1=-1, ip2=-1, ip3=-1, typvar=' ', nomvar=' ')
        Locates the next record that matches the research keys

   fstinfx(key, iunit, datev=-1, etiket=' ', ip1=-1, ip2=-1, ip3=-1, typvar=' ', nomvar=' ') 
        Locates the next record after 'key' that matches the research keys

   fstinl(iunit, datev=-1, etiket=' ', ip1=-1, ip2=-1, ip3=-1, typvar=' ', nomvar=' ', nrecmax=-1)
        Locate all the records matching the research keys

   fstluk(key, dtype=None, rank=None, dataArray=None) 
        Read the record at position given by key/handle found by 'fstinf', 'fstinfx', or 'fstinl'

   fstprm(key) 
        Get all the description parameters of the record needed for 'fstecr'

   fstecr(iunit, data, meta=None, rewrite=True) 
        Writes record to file previously opened with fnom+fstouv

Other fst-functions

   fst_edit_dir(key, datev=-1, dateo=-1, deet=-1, npas=-1, ni=-1, nj=-1, nk=-1, ip1=-1, ip2=-1, ip3=-1, typvar=' ', nomvar=' ', etiket=' ', grtyp=' ', ig1=-1, ig2=-1, ig3=-1, ig4=-1, datyp=-1, keep_dateo=False)
   fst_version()
   fsteff(key)
   fstfrm(iunit)
   fstlnk(unitList)
   fstnbr(iunit)
   fstnbrv(iunit)
   fstouv(iunit, filemode='RND+R/W')
   fstsui(iunit)
   fstvoi(iunit, options=' ')



  • Aucune étiquette
Écrire un commentaire...