Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping of WRF output variables to CF metadata attributes #15

Closed
jthielen opened this issue Nov 20, 2021 · 5 comments · Fixed by #33
Closed

Mapping of WRF output variables to CF metadata attributes #15

jthielen opened this issue Nov 20, 2021 · 5 comments · Fixed by #33
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@jthielen
Copy link
Collaborator

jthielen commented Nov 20, 2021

Another one of the key features brought up in #2 is being able to describe variables that exist in WRF output with CF metadata attributes. To start, I think that this can be as simple as a yaml file mapping WRF variable names to the corresponding attribute output(s)...although some of the possibilities below may need something more complicated than that? Also, I'm not sure how consistent the variable names are across versions of WRF.

Also, I am wondering how far should we go with metadata manipulation?

  • Just do the minimum of adding standard_name when such a name is applicable and fixing any broken units?
  • Also add long_name fields (or rename description to long_name)?
  • Also interpretation of semantic relationships (like ancillarly variables and flags)?
  • Also noting that the data has been modified by xwrf (history)?
  • Or even clear out extraneous attributes (FieldType, MemoryOrder, stagger)?

Finally, based on some other code I have, here's a starting point for that variable -> attr mapping:

- ZNW
  - standard_name: atmosphere_hybrid_sigma_pressure_coordinate
  - axis: Z
  - c_grid_axis_shift: 0.5
- ZNU
  - standard_name: atmosphere_hybrid_sigma_pressure_coordinate
  - axis: Z
- XTIME
  - axis: T
- U10
  - standard_name: x_wind
  - long_name: x_wind_at_10m_agl
- U
  - standard_name: x_wind
- V10
  - standard_name: y_wind
  - long_name: y_wind_at_10m_agl
- V
  - standard_name: y_wind
- W
  - standard_name: upward_air_velocity
- TH2
  - standard_name: air_potential_temperature
  - long_name: air_potential_temperature_at_2m_agl
- T2
  - standard_name: air_temperature
  - long_name: air_temperature_at_2m_agl
- PSFC
  - standard_name: air_pressure
  - long_name: air_pressure_at_surface
- HGT
  - standard_name: surface_altitude
- PBLH
  - standard_name: atmosphere_boundary_layer_thickness
- Q2
  - standard_name: humidity_mixing_ratio
  - long_name: humidity_mixing_ratio_at_2m_agl
- QVAPOR
  - standard_name: humidity_mixing_ratio
- VEGFRA
  - standard_name: vegetation_area_fraction
- LAI
  - standard_name: leaf_area_index
- RAINNC
  - standard_name: integral_of_lwe_precipitation_rate_wrt_time
- CLDFRA
  - standard_name: cloud_area_fraction_in_atmosphere_layer
- HFX
  - standard_name: surface_upward_heat_flux_in_air
- LH
  - standard_name: surface_upward_latent_heat_flux_in_air
- ACHFX
  - standard_name: integral_of_surface_upward_heat_flux_in_air_wrt_time
- ACLHF
  - standard_name: integral_of_surface_upward_latent_heat_flux_in_air_wrf_time
@lpilz
Copy link
Collaborator

lpilz commented Jan 3, 2022

I would vote for returning the new Dataset with as much useful and as little useless information as possible.

So: yes to adding long_name to standard_name and units (depending on the usefulness of description, I would be okay with just renaming it), yes to adding ancillary variables wherever possible, yes to adding a note that xwrf was used and yes to removing useless attributes from me.

Another thing I'm wondering is: Do we have to worry about different WRF versions wrt metadata? I would expect output fields to be quite robust, but I'm not 100% sure about that.

@lpilz lpilz added the good first issue Good for newcomers label Jan 21, 2022
@kmpaul kmpaul added the help wanted Extra attention is needed label Jan 21, 2022
@bsu-wrudisill
Copy link
Contributor

RE: the question about different WRF versions and options potentially leading to different output variable names. One way of mitigating the headache this would cause (if it ends up being a headache at all) is to always leave open to the user the option to pass in their own dictionary that maps WRF variable names to standard names.

@lpilz
Copy link
Collaborator

lpilz commented Jan 24, 2022

Good idea, I'll look into that. Currently working on the implementation but will have to take 1-2 days off due to other commitments at work.

@lpilz lpilz mentioned this issue Jan 25, 2022
4 tasks
@jukent
Copy link
Contributor

jukent commented Jan 26, 2022

Should this proposed yaml also include the CF conventions for dimensions on both the coordinates and variables?

See discussion in #36 whee south_north should be changed to y.

Comment by @LejoFlores :

As for renaming dimensions I think it would be good to rename here because south_north and west_east are not common in other datasets. The only challenge (this is also reflected in the underlying names of south_north and west_east) is that because WRF grids can be curvilinear, x- and y- can be ambiguous.

@kmpaul
Copy link
Contributor

kmpaul commented Jan 26, 2022

I commented on #36 here about possibly using cf-xarray for uncommon coord names.

I say, for now, let's move forward without the notion of renaming. We can add that later, if necessary.

@andersy005 andersy005 moved this from 🌳 Todo to ▶ In Progress in Xdev Project Board Jan 31, 2022
Repository owner moved this from ▶ In Progress to ✅ Done in Xdev Project Board Feb 2, 2022
@andersy005 andersy005 moved this to Done in xWRF Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants