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

Hotfix to add releaseTime to adpupa converter #1328

Merged
merged 28 commits into from
Sep 19, 2023

Conversation

haydenlj
Copy link
Contributor

@haydenlj haydenlj commented Aug 16, 2023

Description

Temporary hotfix to add releaseTime to files output by the new adpupa prepbufr to ioda converter so that output files can be used by Skylab. Can be reverted once the planned more robust additions have been made

Issue(s) addressed

Resolves #1322

Dependencies

none

Impact

Output IODA files can be used in Skylab

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have run the unit tests before creating the PR

@haydenlj haydenlj added the OBS OBS processing, UFO label Aug 16, 2023
@haydenlj haydenlj self-assigned this Aug 16, 2023
Copy link
Contributor

@rmclaren rmclaren left a comment

Choose a reason for hiding this comment

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

I don't believe this is what you want... The reason is that now you've mixed your data set with fields that are grouped by prepbufrDataLevelCategory (latitude, longitude, stationElevation... and so on) with things that are not grouped (timeOffset, specificHumidity)... The problem here is that you've lost your ability to correlate between these fields (for example you can no longer tell how latitude, longitude lines up with specific humidity). You have to be consistent with grouping to make datasets that make sense.

@haydenlj
Copy link
Contributor Author

I don't believe this is what you want... The reason is that now you've mixed your data set with fields that are grouped by prepbufrDataLevelCategory (latitude, longitude, stationElevation... and so on) with things that are not grouped (timeOffset, specificHumidity)... The problem here is that you've lost your ability to correlate between these fields (for example you can no longer tell how latitude, longitude lines up with specific humidity). You have to be consistent with grouping to make datasets that make sense.

@rmclaren Ah ok, in that case I misunderstand what the bufr get function is doing. So it is sorting by prepbufrDataLevelCategory rather than just flattening along that axis?

@rmclaren
Copy link
Contributor

@haydenlj The relative order stays the same (its not due to sorting). When you group a field what you are doing is reshaping the array. If you don't reshape your arrays in a consistent way then data in those arrays won't line up in the way you expect.

Copy link
Contributor

@PraveenKumar-NOAA PraveenKumar-NOAA left a comment

Choose a reason for hiding this comment

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

Only the grouping issues, rest looks fine.

@haydenlj haydenlj requested a review from gthompsnJCSDA August 16, 2023 16:39
Copy link
Collaborator

@huishao-r huishao-r left a comment

Choose a reason for hiding this comment

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

I can't comment on other parts regarding the grouping. But the release time seems fine with me.

@haydenlj haydenlj dismissed rmclaren’s stale review August 25, 2023 16:05

Changes addressed

@BenjaminRuston
Copy link
Collaborator

we do not think there is any grouping issue and we would like to have NOAA EMC test this PR to see if it still reproduces the answer you expect.

@emilyhcliu please advise

@PraveenKumar-NOAA
Copy link
Contributor

we do not think there is any grouping issue and we would like to have NOAA EMC test this PR to see if it still reproduces the answer you expect.

@emilyhcliu please advise

@BenjaminRuston I will be happy to test this out.

@PraveenKumar-NOAA
Copy link
Contributor

we do not think there is any grouping issue and we would like to have NOAA EMC test this PR to see if it still reproduces the answer you expect.

@emilyhcliu please advise

@BenjaminRuston I tested this PR/ Python script and it is reproducing the expected results. If @emilyhcliu @rmclaren are happy with this new format, I will approve this PR.

@PraveenKumar-NOAA
Copy link
Contributor

PraveenKumar-NOAA commented Sep 5, 2023

@haydenlj Could you also try running the ioda-validate.x program on the output file that gets created? That will help ensure we also don't have something like MetaData/height as an integer when it should be a float. Or plenty of other possible examples as well. This just seems like the right time to catch anything we can that could become technical debt later.

@gthompsnJCSDA I ran ioda-validate.x program on the output file and there were a few errors/ warnings in the final results. A few new prepBUFR variables like prepbufrDataLevelCategory (CAT) and temperatureEventCode (TPC) also need to be added to the ObsSpace.yaml. I will create an issue for this.

@gthompsnJCSDA
Copy link
Contributor

@haydenlj Could you also try running the ioda-validate.x program on the output file that gets created? That will help ensure we also don't have something like MetaData/height as an integer when it should be a float. Or plenty of other possible examples as well. This just seems like the right time to catch anything we can that could become technical debt later.

@gthompsnJCSDA I ran ioda-validate.x program on the output file and there were a few errors/ warnings in the final results. A few new prepBUFR variables like prepbufrDataLevelCategory (CAT) and temperatureEventCode (TPC) also need to be added to the ObsSpace.yaml. I will create an issue for this.

It seems we must already have something similar to DataLevelCategory - could you try to re-use something that is similar, such as verticalSignificance? And, isn't temperatureEvent already in the ObsSpace.yaml and was already exactly designed for radiosonde data I thought (similar to windEvent and moistureEvent, etc.).

@BenjaminRuston
Copy link
Collaborator

@emilyhcliu looks like @PraveenKumar-NOAA has tested and happy with result are you ready to move forward

@PraveenKumar-NOAA
Copy link
Contributor

@gthompsnJCSDA thanks, there is no need to add any extra variables to the ObsSpace.yaml for the adpupa prepbufr.

@haydenlj please use ObsValue/verticalSignificance for MetaData/prepbufrDataLevelCategory (CAT) and QCFlags/qualityFlags for the MetaData/temperatureEventCode (TPC), then there will be no error in your ioda-validate.x run, you just need to take care of a few warnings. I can do that easily.

@haydenlj
Copy link
Contributor Author

haydenlj commented Sep 7, 2023

QCFlags/qualityFlags

Ok thanks @PraveenKumar-NOAA I updated the names

@BenjaminRuston
Copy link
Collaborator

@haydenlj looks like the testoutput may need to be updated:

Write data to variables
DIFFER : NUMBER OF GROUPS : 4 ("/") <> 3 ("/")
DIFFER : VARIABLE : prepbufrDataLevelCategory : DOES NOT EXIST IN "testrun/prepbufr_adpupa_api.nc"
DIFFER : VARIABLE : temperatureEventCode : DOES NOT EXIST IN "testrun/prepbufr_adpupa_api.nc"
DIFFER : VARIABLE : verticalSignificance : DOES NOT EXIST IN "testoutput/prepbufr_adpupa_api.nc"
DIFFER : Failed to find group /QCFlags in file "testoutput/prepbufr_adpupa_api.nc"

@emilyhcliu
Copy link
Contributor

@haydenlj Could you give me the definition of the releaseTime? Is it the earliest time from dateTime of each profile?

Copy link
Contributor

@PraveenKumar-NOAA PraveenKumar-NOAA left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@BenjaminRuston BenjaminRuston removed the do not merge Something is wrong, do not merge label Sep 13, 2023
print("cycleTimeSinceEpoch")
cycleTimeSinceEpoch = np.int64(calendar.timegm(time.strptime(date, '%Y%m%d%H%M')))
hrdr = np.int64(hrdr*3600)
hrdr += cycleTimeSinceEpoch

ulan = np.repeat(hrdr[:,0], hrdr.shape[1])
Copy link
Collaborator

Choose a reason for hiding this comment

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

@emilyhcliu here is the definition of the variable that is used to define the release time which is the first entry of the times array

Copy link
Collaborator

@BenjaminRuston BenjaminRuston left a comment

Choose a reason for hiding this comment

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

@haydenlj had to make one more change to make sure it ran through Skylab

@PatNichols PatNichols merged commit c9a0ca6 into develop Sep 19, 2023
@PatNichols PatNichols deleted the bugfix/hotfix_for_releaseTime branch September 19, 2023 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OBS OBS processing, UFO
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add releaseTime to NCEP ADPUPA converter
8 participants