Skip to content

Commit

Permalink
Add documentation on how to run retrievals.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpf committed May 21, 2024
1 parent 7b524bd commit 9eab087
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 11 additions & 2 deletions docs/retrieval.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Running retrievals

Finally, retrieval models produced by in the training step can be retrieve precipitation
and hydrometeor profiles from GPM observations.
Finally, retrieval models produced by in the training step can be retrieve
precipitation and hydrometeor profiles from GPM observations.

## Command-line interface

GPROF-NN retrieval on one or multiple input files can be run using the ``gprof_nn retrieve`` command.

```
gprof_nn retrieve /path/to/retrieval_model.pt /path/to/input_data --output_path /path/to_output_data
```

The command can be used to run the trained retrieval model on L1C, preprocessor or training data files.
8 changes: 4 additions & 4 deletions gprof_nn/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,11 @@ def load_input_data_training_3d(
)

aux = {
"longitude": targets.pop("longitude"),
"latitude": targets.pop("latitude"),
"longitude": targets.pop("longitude").numpy(),
"latitude": targets.pop("latitude").numpy(),
}
for name, target_data in targets.items():
aux[name + "_ref"] = target_data
aux[name + "_ref"] = target_data.numpy()
return input_data, aux

raise RuntimeError(
Expand Down Expand Up @@ -420,7 +420,7 @@ def finalize_results(
output = xr.Dataset()
for name, data in aux.items():
data = data.squeeze()
if data.ndim > 2:
if data.ndim > 2 and data.shape[-1] != 28:
data = data.transpose((1, 2, 0))
dims_v = dims[:data.ndim]
output[name] = (dims_v, data)
Expand Down

0 comments on commit 9eab087

Please sign in to comment.