|
| 1 | +# EAMxx Field Aliasing Feature |
| 2 | + |
| 3 | +This document demonstrates the field aliasing feature for EAMxx I/O operations. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The field aliasing feature allows users to specify custom names for |
| 8 | +variables in netcdf output files while maintaining the original |
| 9 | +internal field names in the model. This is useful for: |
| 10 | + |
| 11 | +- Creating shorter, more convenient variable names for output |
| 12 | +- Maintaining compatibility with external tools that expect specific variable names |
| 13 | +- Providing user-friendly names for complex internal field names |
| 14 | + |
| 15 | +## Syntax |
| 16 | + |
| 17 | +The alias syntax uses the delimiter `:=` to separate the alias name |
| 18 | +from the internal field name: |
| 19 | + |
| 20 | +```yaml |
| 21 | +alias_name:=internal_field_name |
| 22 | +``` |
| 23 | + |
| 24 | +## YAML Configuration Examples |
| 25 | + |
| 26 | +### Basic Usage |
| 27 | + |
| 28 | +```yaml |
| 29 | +field_names: |
| 30 | + - "LWP:=LiqWaterPath" # Alias LWP for LiqWaterPath |
| 31 | + - "SWP:=SolidWaterPath" # Alias SWP for SolidWaterPath |
| 32 | + - "T:=T_mid" # Alias T for T_mid |
| 33 | + - "qv" # Regular field name (no alias) |
| 34 | +``` |
| 35 | +
|
| 36 | +### Mixed Usage |
| 37 | +
|
| 38 | +You can mix aliased and non-aliased fields in the same configuration: |
| 39 | +
|
| 40 | +```yaml |
| 41 | +field_names: |
| 42 | + - "T_mid" # Regular field name |
| 43 | + - "LWP:=LiqWaterPath" # Aliased field |
| 44 | + - "p_mid" # Regular field name |
| 45 | + - "RH:=RelativeHumidity" # Aliased field |
| 46 | +``` |
| 47 | +
|
| 48 | +## Output Behavior |
| 49 | +
|
| 50 | +When using aliases: |
| 51 | +
|
| 52 | +1. **NetCDF Variables**: The netcdf file will contain variables |
| 53 | +named according to the aliases |
| 54 | +
|
| 55 | + - `LWP` instead of `LiqWaterPath` |
| 56 | + - `T` instead of `T_mid` |
| 57 | + - `RH` instead of `RelativeHumidity` |
| 58 | + |
| 59 | +2. **Internal Processing**: All internal model operations use the |
| 60 | +original field names |
| 61 | + |
| 62 | + - Field validation uses `LiqWaterPath`, `T_mid`, etc. |
| 63 | + - Diagnostic calculations use original names |
| 64 | + - Memory management uses original field structures |
| 65 | + |
| 66 | +3. **Metadata**: Variable attributes (units, long_name, etc.) |
| 67 | +are preserved from the original fields, and `eamxx_name` |
| 68 | +is added to the netcdf files to document aliasing |
| 69 | + |
| 70 | +## Caveats |
| 71 | + |
| 72 | +Currently, a field can be requested only once in a single stream, |
| 73 | +and either the original name or the alias name counts. |
| 74 | + |
| 75 | +```yaml |
| 76 | +field_names: |
| 77 | + - "LWP:=" # Error: empty field name |
| 78 | + - ":=LiqWaterPath" # Error: empty alias name |
| 79 | + - "LWP:=Field1" # OK |
| 80 | + - "LWP:=Field2" # Error: duplicate alias LWP |
| 81 | + - "LWP1:=LiqWaterPath" # OK |
| 82 | + - "LWP2:=LiqWaterPath" # Error: duplicate field LiqWaterPath |
| 83 | +``` |
0 commit comments