Skip to content

Lac2pps - #131

Draft
mraspaud wants to merge 28 commits into
foua-pps:mainfrom
mraspaud:lac2pps
Draft

mraspaud wants to merge 28 commits into
foua-pps:mainfrom
mraspaud:lac2pps

Conversation

@mraspaud

Copy link
Copy Markdown
Collaborator

This PR adds support for LAC and FRAC files

  • Closes #xxxx <!-- remove if there is no corresponding issue
  • Tests added
  • Tests passed: Passes pytest level1c4pps
  • Passes flake8
  • Add your name to AUTHORS.md if not there already

The new lac2pps module takes a scene the avhrr_l1b_gaclac reader has
already loaded, sets the header defaults the PPS file name is built
from, and hands the scene to the writer under that name. This is the
entry point pygac-fdr needs to write a PPS file without reading the
level 1b file a second time.
PPS finds a channel by its image name and tag, not by the AVHRR channel
number, so channel 1 now reaches the writer as image1 tagged ch_r06,
the identity level1c4pps already gives it for GAC.
…channel

AVHRR/1 and AVHRR/2 call their 3.7 micron channel 3 where AVHRR/3 calls
it 3b. It now reaches the writer as image5 tagged ch_tb37, so PPS finds
the channel on every AVHRR generation.
Channel 2 now reaches the writer as image2 tagged ch_r09, the identity
level1c4pps already gives it for GAC.
AVHRR/3 measures 1.6 micron in channel 3a by day. It now reaches the
writer as image6 tagged ch_r16, the identity level1c4pps already gives
it for GAC.
AVHRR/3 measures 3.7 micron in channel 3b. It now reaches the writer as
image5 tagged ch_tb37, the same identity channel 3 gets on the older
instruments, so PPS sees one 3.7 micron channel whatever the platform.
Channel 5 now reaches the writer as image4 tagged ch_tb12, the identity
level1c4pps already gives it for GAC. The channel table is laid out one
entry per line, as in gac2pps.
Channel 4 now reaches the writer as image3 tagged ch_tb11. With it the
lac2pps channel table holds every AVHRR channel and matches the GAC
one exactly, so gac2pps now takes its table from lac2pps rather than
keeping a copy of its own.
PPS reads its geolocation from variables called lat and lon, so the
latitude and longitude the reader loads are renamed and given their PPS
attributes with the helper level1c4pps already uses for GAC.
The five sun and satellite angles the reader loads are renamed to
sunzenith, satzenith, sunazimuth, satazimuth and azimuthdiff with the
helper level1c4pps already uses for GAC. The azimuth angles are kept,
as gac2pps keeps them.
Each renamed angle now reaches the writer with its PPS tag, standard
name, long name, units and valid range, and the time of the pass, set
by the helper every other level1c4pps converter uses for its angles.
PPS times each line separately, so the scanline times of the reference
channel now reach the writer as scanline_timestamps. They are taken
before the header defaults remove the time coordinate from the
channels.
The quality flags now reach the writer tagged qual_flags and named
pygac quality flags, as for GAC. The labelling lives in one function
that lac2pps and gac2pps both call.
A PPS user tells which converter made a file from its source
attribute, so the header handed to the writer now says lac2pps.py.
process_one_file opens an AVHRR level 1b file with the avhrr_l1b_gaclac
reader, loads the channels and the geolocation, angles and quality
flags the conversion needs, and writes the PPS file. It is exercised
end to end on the TIROS-N test file.
process_one_file now loads every channel in the PPS channel table, so an
AVHRR/3 LAC or FRAC pass reaches PPS with channels 3a, 3b and 5 as well.

The test runs on a small Metop-B LAC file cut from a real pass in the
ESA archive: the archive header, the header record and 16 consecutive
scanlines from the middle of the pass (records 2563 to 2578 of
ESR.LHRR.M1.D16087.S2023.E2037.B01828628.BN), read by pygac exactly as
in the full file. TLE_metopb.txt holds the Metop-B TLE entries within a
week of the pass.
process_scene takes the netCDF engine to write with and hands it to the
writer, so pygac-fdr can pass on the engine its configuration names.
…nd line

bin/lac2pps.py takes a level 1b file, an output directory and the TLE
directory and file name, and writes the PPS level1c file with
lac2pps_lib.process_one_file, as the other converters' scripts do.
Packaging only: bin/lac2pps.py joins the scripts setup.py installs. No
test drives this line; the script itself is tested by running it.
PPS keeps the orbit number in the file header as well as in the file
name, so the header handed to the writer now carries it next to the
source.
PPS reads platform, sensor, times, orbit number and provenance from the
header of a GAC file. The LAC header now comes from the same helper, with
lac2pps.py named as its source.
PPS reads the time of each scanline from scanline_timestamps. The reader
also hangs it on the quality flags as an acq_time coordinate, which the
writer turned into a file-wide acq_time variable that every variable
along the scanlines named among its coordinates. It is dropped from the
quality flags before writing, as gac2pps does.
@mraspaud mraspaud self-assigned this Sep 11, 2026
@mraspaud mraspaud added the enhancement New feature or request label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant