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

add function to normalize all time coord units #732

Merged
merged 4 commits into from
Jan 16, 2025

Conversation

jtmims
Copy link
Collaborator

@jtmims jtmims commented Jan 13, 2025

Description
@nishsilva found an issue (#730) where his data couldn't get through crop_date_range. This was caused by the fact that the calendar attribute was hidden in the encoding of the time coord. After this, a new function had to be made to allow files that have differing time_units to pass through the preprocessor.

Associated issue #730

How Has This Been Tested?
Tested with ECMWF-LR output on my workstation to launch Nish's POD. I also tested the seaice_suite and Wheeler_Kiladis.

Checklist:

  • My branch is up-to-date with the NOAA-GFDL main branch, and all merge conflicts are resolved
  • The scripts are written in Python 3.12 or above (preferred; required if funded by a CPO grant), NCL, or R
  • All of my scripts are in the diagnostics/[POD short name] subdirectory, and include a main_driver script, template html, and settings.jsonc file
  • I have made corresponding changes to the documentation in the POD's doc/ subdirectory
  • I have requested that the framework developers add packages required by my POD to the python3, NCL, or R environment yaml file if necessary, and my environment builds with conda_env_setup.sh
  • I have added any necessary data to input_data/obs_data/[pod short name] and/or input_data/model/[pod short name]
  • My code is portable; it uses MDTF environment variables, and does not contain hard-coded file or directory paths
  • I have provided the code to generate digested data files from raw data files
  • Each digested data file generated by the script contains numerical data (no figures), and is 3 GB or less in size
  • I have included copies of the figures generated by the POD in the pull request
  • The repository contains no extra test scripts or data files

@jtmims jtmims added bug Something isn't working framework Issue pertains to the framework code data Issues related to observational or sample model data. labels Jan 13, 2025
@wrongkindofdoctor wrongkindofdoctor self-assigned this Jan 13, 2025
Comment on lines 1027 to 1028
#assumes "days since ????" unit format
start = np.sort([int(u.replace("days since ", "")[:4]) for u in time_units])[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtmims This should accommodate cases where units are leap seconds (not common, but that doesn't mean we won't see it).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have pushed new commits which adds logic to handle multiple types of time units

@wrongkindofdoctor wrongkindofdoctor merged commit a45d2bd into NOAA-GFDL:main Jan 16, 2025
5 checks passed
@jtmims jtmims mentioned this pull request Jan 16, 2025
3 tasks
@jtmims jtmims deleted the nish branch January 16, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data Issues related to observational or sample model data. framework Issue pertains to the framework code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants