NCAR / wrfcloud

WRF Cloud Framework
Apache License 2.0
14 stars 6 forks source link

Add unit conversion code #97

Closed fossell closed 1 year ago

fossell commented 1 year ago

Describe the New Feature

With separation of responsibilities in mind, desire to keep any unit conversion (e.g. Kelvin --> C) out of the plotting code, and rather create new code or function who's responsibility is to convert units.

  1. Identify all products that need conversion
  2. Code up conversions
  3. Update/modify plots and GUI as necessary

Acceptance Testing

List input data types and sources. Describe tests required for new functionality.

Time Estimate

Estimate the amount of work required here. Issues should represent approximately 1 to 3 days of work.

Sub-Issues

Consider breaking the new feature down into sub-issues.

Relevant Deadlines

December 5, 2022.

Define the Metadata

Assignee

Labels

Projects and Milestone

New Feature Checklist

michelleharrold commented 1 year ago

@hahnd and @fossell - In the product list google doc, I shaded the variables that need unit conversions. As a note, precip and pwat do not need to be converted, but the units on the display should be mm (not kg/m2 -- while equivalent, mm is much more standard).

Also, metpy might be able to help with some of the conversations, depending on how we implement the unit conversions.

fossell commented 1 year ago

@michelleharrold - Thanks! @hahnd - Do you envision the code for converting units to be part of runtime, e.g. in postproc.py or standalone function or in tools/ perhaps? Or should it go elsewhere? Were you thinking using pygrib to open the grib files, perform the conversion, then write out a new (replace existing) grib file, then pass that to the plotting functions? Let us know what you think and if/how you want our help in the next steps.

hahnd commented 1 year ago

I think it should probably go under wrfcloud.runtime.tools in a new module. I'm not that familiar with GRIB, but we could either write new files or append (or modify) the variables in the existing files. This new module could handle unit conversions and derived fields.

fossell commented 1 year ago

Could use metpy to convert units (and derive winds) to output a netcdf file to read and convert to geojson for plotting.