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

Metadata fix #45

Merged
merged 8 commits into from
May 17, 2018
Merged

Metadata fix #45

merged 8 commits into from
May 17, 2018

Conversation

arezoorn
Copy link
Contributor

@arezoorn arezoorn commented May 12, 2018

I have added the min_valid and max_valid as attributes to the output files from NWM output routines. To do so, I added KHOUR to the nlst_rt, since the simulation duration was not accessible in other routines.

I also added one global attribute called model_total_valid_times which is basically the total number of outputs for a given file format (for example CHRTOUT) during the simulation.

I also resolved NCAR/wrf_hydro_nwm-issues#139 . The NoahMP time stamp was wrong (when the time stamp between LSM and Hydro differed). I added ITIME which is the LSM time step to the output routine and used that instead of out_counts which is Hydro time step. I also ran the model with LSM only, checked that the time is correct.

There was also a non reported issue/bug that is fixed with this change, the time variable was wrong if HYDRO was active and the LSM output timestep was not a multiplicative of the Hydro output timestep. For example if user was setting the LSM output timestep to 36000 (10hours) and Hydro output timestep to 180 (3 hours) the time variable in the LSM output was wrong. This was not a reported bug, since in our operational runs and our tests, we usually define the LSM output timestep a miltuplicative factor of the LSM output.

arezoorn added 6 commits May 10, 2018 01:24
Since the NWM routine was using the timestep of the hydro model, the LSM outputs time stamp was not right
in cases that the time steps of LSM and HYDRO differs. I added ITIME to the routine, to be able to
calculate the correct time in the output routines.
…ribute

calcualted the time in the LSM output routine based on the LSM time step
and not the HYDRO timestep. Also fixed the valid_max to present the time of the last
exising file and not the end of the simulation.
@wrf-hydro-nwm-bot
Copy link
Collaborator

Waiting for private pull request queue to clear.

@kafitzgerald kafitzgerald removed their request for review May 14, 2018 20:00
@wrf-hydro-nwm-bot
Copy link
Collaborator

Authentication required - Linked to private pull request #197, link: https://github.com/NCAR/wrf_hydro_nwm/pull/197

@wrf-hydro-nwm-bot
Copy link
Collaborator

Pull request submitted to private repo. Waiting for reviewer(s) to approve.

@jmccreight
Copy link
Collaborator

jmccreight commented May 17, 2018

There is no comment that the PR passes any kind of regression test.
No test results have been placed in-line.
Can someone please comment on why the checks are failing? If the report is hard to read, then state that. We can make it better. Right now this is completely being ignored. To me, it looks like it's probably all metadata differences but I think we need to clearly separate metadata and value differences in the evaulation and I would open an issue about that.

@jmccreight
Copy link
Collaborator

Given that the restart files all check and the CHRTOUT and CHANOBS files fail, I'm going to assume those differences are meta-data only.
I filed #50 to request separation of data and metadata checks for output files.

@@ -1518,7 +1523,7 @@ subroutine land_driver_ini(NTIME_out,wrfits,wrfite,wrfjts,wrfjte)
print*, "t0OutputFlag: ", t0OutputFlag
#endif
!#ifdef HYDRO_REALTIME
if(t0OutputFlag .eq. 1) call ldas_output()
if(t0OutputFlag .eq. 1) call ldas_output(0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I love how this is so opaque. What was the assumed value when nothing was passed, what does 0 represent. Is there no good variable that can be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, that is the initialization timestep, actually I could use ITIME as I used it in the other routines. I will check why I did not use it, and it possible I would replace it with ITIME.

subroutine ldas_output()
subroutine ldas_output(itime)
integer, intent(in) :: itime ! time step of the LSM, had to explicitly declare it since
! it did not exist in the land_driver_ini
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 The comment is good, but notice how this kind of comment goes stale "had to explicitly..."
I love keywords. I wish they were slightly easier to use in fortran.


! calculate total_valid_time
fileMeta%totalValidTime = int(nlst_rt(1)%khour * 60 / nlst_rt(1)%out_dt) ! # number of valid time (#of output files)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I get why these time calculations are here. I would just like to point out that these kinds of calculations should go in a module_time.F and the results should be requested here (not calculated).

Copy link
Collaborator

Choose a reason for hiding this comment

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

#51

@jmccreight
Copy link
Collaborator

This PR needs a bit more explicit description of what the changes were. @arezoorn please correct if any of this is wrong:

"I have added the min_valid and max_valid as attributes to the output files from NWM output routines. " Specifically, in module_NWM_io_dict:

integer :: timeValidMin ! the minimum time each configuration can have, time of the first output file
integer :: timeValidMax ! the maximum time each configuration can have, time of the last output file
integer :: totalValidTime ! # number of valid time (#of output files)

These are now metadata attributes in the CHANOBS and CHRTOUT (same in both) with the following names:

iret = nf90_put_att(ftn,timeId,'valid_min',fileMeta%timeValidMin)
iret = nf90_put_att(ftn,timeId,'valid_max',fileMeta%timeValidMax)
iret = nf90_put_att(ftn,NF90_GLOBAL,"model_total_valid_times",fileMeta%totalValidTime)

Copy link
Collaborator

@jmccreight jmccreight left a comment

Choose a reason for hiding this comment

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

See my comments. I'm approving with a lot of noise and whining. 🎊

@kafitzgerald
Copy link
Contributor

Definitely agree that it would be nice to have some additional info regarding test failures in the log.

Just ran the tests again offline to confirm (file diffs below) and as expected we just see differences in the attributes.

CHRTOUT

DIFFER : NAME OF GLOBAL ATTRIBUTE : model_total_valid_times : GLOBAL ATTRIBUTE DOESN'T EXIST IN NWM/run_reference/201108281400.CHRTOUT_DOMAIN1
DIFFER : VARIABLE "time" IS MISSING ATTRIBUTE WITH NAME "valid_min" IN FILE "NWM/run_reference/201108281400.CHRTOUT_DOMAIN1"
DIFFER : VARIABLE "time" IS MISSING ATTRIBUTE WITH NAME "valid_max" IN FILE "NWM/run_reference/201108281400.CHRTOUT_DOMAIN1"
DIFFER : NUMBER OF ATTRIBUTES : VARIABLE : time : 3 <> 5```

CHANOBS
```DIFFER : NUMBER OF GLOBAL ATTRIBUTES : 16 <> 17
DIFFER : NAME OF GLOBAL ATTRIBUTE : model_total_valid_times : GLOBAL ATTRIBUTE DOESN'T EXIST IN NWM/run_reference/201108281400.CHANOBS_DOMAIN1
DIFFER : VARIABLE "time" IS MISSING ATTRIBUTE WITH NAME "valid_min" IN FILE "NWM/run_reference/201108281400.CHANOBS_DOMAIN1"
DIFFER : VARIABLE "time" IS MISSING ATTRIBUTE WITH NAME "valid_max" IN FILE "NWM/run_reference/201108281400.CHANOBS_DOMAIN1"
DIFFER : NUMBER OF ATTRIBUTES : VARIABLE : time : 3 <> 5```

@jmccreight
Copy link
Collaborator

@arezoorn
An issue needs referenced. If one does not exist, please create one.

@jmccreight
Copy link
Collaborator

Katelyn, thanks for doing that. I know it's currently a pain. should be less painful soon!!

@kafitzgerald kafitzgerald merged commit 687bacd into NCAR:master May 17, 2018
@arezoorn arezoorn deleted the metadata_fix branch May 21, 2018 00:44
jmccreight pushed a commit to jmccreight/wrf_hydro_nwm_public that referenced this pull request Nov 13, 2018
Added model configuration to compile options json
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 this pull request may close these issues.

None yet

5 participants