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

Units of pressure variables are not machine-readable #350

Open
DWesl opened this issue Jul 12, 2024 · 4 comments
Open

Units of pressure variables are not machine-readable #350

DWesl opened this issue Jul 12, 2024 · 4 comments

Comments

@DWesl
Copy link

DWesl commented Jul 12, 2024

Describe the bug

The netCDF history outputs some pressure variables with units of "pa" or "mb". The netCDF Users' Guide and Climate and Forecast (CF) conventions both recommend making the units attribute of a netCDF variable machine-readable, specifically by the UDUNITS software package. This package interprets "pa" as picoannum, a unit of time roughly equal to a microsecond, and "mb" as millibarn, a unit of area used in atomic scattering, rather than as units of pressure.

To Reproduce

Steps to reproduce the behavior:
Run the model and let it produce netCDF history files.
Inspect the units attribute of the pressure variables (surface pressure and vertical coordinate are the most likely).
Ask udunits2 (or another unit-processing software package) to convert from one pressure unit to the other, or to a known pressure unit (atm, torr, or psi should work).

Expected behavior

I expected my unit-processing software package to be able to convert the surface pressure to the same coordinates as the pressure of the vertical layers.

System Environment

Describe the system environment, include:

  • OS: Rocky8 linux
  • Compiler(s): Intel 2022.1.2
  • MPI type, and version: impi 2021.5.1
  • netCDF Version: C: 4.9.2, Fortran: 4.6.1
  • Configure options: defaults for NOAA-EMC/global-workflow

Additional context

Either of the two following sed scripts should fix the units in the output files. I tried running these on my version of the repository in a NOAA-EMC/global-workflow clone and my software can convert the pressure variables to atm and torr without guidance from me.

sed -i -E -e '/\bpa\b[^(),]/ s/\bpa\b/Pa/g' -e 's/\bmb\b/mbar/g' tools/*.F90 driver/fvGFS/*.F90 model/*.F90
sed -i -e "s/'pa'/'Pa'/g" -e "s|'pa/s(ec)?'|'Pa/s'|g" -e "s/'mb'/'mbar'/g" tools/*.F90 driver/fvGFS/*.F90 model/*.F90

I couldn't figure out how to make a PR with just three commits instead of 50, so I saved the commits as patches with git format-patch and attached the result as updated_units_patch.zip. They should apply cleanly with git am.

@DWesl DWesl changed the title Make units of pressure variables machine-readable Units of pressure variables are not machine-readable Jul 12, 2024
@bensonr
Copy link
Contributor

bensonr commented Aug 8, 2024

@DWesl - are you planning to put in a PR for this issue?

@DWesl
Copy link
Author

DWesl commented Aug 8, 2024

Created #355

@DWesl
Copy link
Author

DWesl commented Aug 9, 2024

Created #356 since I figured out how to make a PR with just the relevant commits.

@bensonr
Copy link
Contributor

bensonr commented Aug 9, 2024

@DWesl - thanks for making the changes against the dev/emc branch and submitting a new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants