In RPN files the latitudes and longitudes of all grid points are coded. Depending on the grid type they are coded in the parameters IG1-IG4 (for A, B, G, and L grids) or in the tictacs, '^^', '>>', (Z grids) or in the toctoc, '^>' (U grids, Yin-Yang).
Shell
Obtain longitudes and latitudes in shell
Volet |
---|
infile=... # RPN input file with one record and tictac's (if needed for the grid type - if xrec can display the field you have everything you need)
outfile=... # RPN output file (including path or at least './')
# Create field with constant value 180 / PI = 57.29578
r.diag xlin $infile tmp -a0-b57.29578
r.diag ggtrig tmp tmp2 -kind IDF -lon # ==> outfile=longitude*infile
r.diag newnam tmp2 lon -name LO
r.diag ggtrig tmp tmp2 -kind IDF # ==> outfile=latitude*infile
r.diag newnam tmp2 lat -name LA
# Combine LO and LA in output file
r.diag joinup $outfile lon lat
|
Python 3
Obtain longitudes and latitudes in Python
...