NCAR / NCAR/DART

bug: obs_diag_streamflow

Open
#334 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug obs_diag pmp
Dominant language
Fortran
Stars
263
Forks
182
Avg merge
11d 12h
Merged PRs (30d)
7

Description

🐛 🐛 🐨

Describe the bug
  1. Run obs_diag with wrf_hyrdo obs_seq.finals with SNOW_THICKNESS
  2. What was the expected outcome? Successful run of obs_diag
  3. What actually happened?
    Errors out with message about NC_UNLIMITED size already in use.
Error Message
 ERROR FROM:
  source : netcdf_utilities_mod.f90
  routine: WriteNetCDF
  message: types:def_dim obs_diag_output.nc: NetCDF: NC_UNLIMITED size already i
 n use
  message: ...
Which model(s) are you working with?

wrf_hydro

Version of DART

Which version of DART are you using?
Reported with v9.9.0-637-g654607621
Reproduced with v9.13.2

Have you modified the DART code?

Yes - v9.9.0-637-g654607621 has the fix for bug: #323
v9.13.2 nope.

Build information

Please describe:

  1. Cheyenne
  2. intel
Suspected cause

The error is happening because streamflow_obs_diag.f90 has a local max_defined_types that is undefined

86 integer :: max_defined_types_of_obs

There is

 550     max_defined_types_of_obs = lookup_flavor(flavor)

but this is in an if statement that is not entered.

So when you get to the netcdf writing:

max_defined_types_of_obs           0 NF90_UNLIMITED           0

so for this line:

call nc_check(nf90_def_dim(ncid=ncid, &
          name='obstypes', len=max_defined_types_of_obs, dimid=TypesDimID), &
          'WriteNetCDF', 'types:def_dim '//trim(fname))

Netcdf thinks you are defining the unlimited dimension again.

The 3D sphere obs_diag obs_kind_mod::max_defined_types_of_obs. I'm not sure at the moment why streamflow_obs_diag has a local max_defined_types_of_obs

"! All streamflow observations are identity observations at this point" is not true right?

         ! Check to see if it is an identity observation.
-         ! All streamflow observations are identity observations at this point
         if (flavor < 0) then

            ! Not every model location has a streamflow observation, but the
            ! location can be anywhere in the model state, so the 'flavor' can
            ! be quite large. We cannot allocate that much space, so we create
            ! a lookup array  ....

-           max_defined_types_of_obs = lookup_flavor(flavor)  !HK max_defined_types_of_obs  is unset for real obs.

            if (flavor > num_obs_types) then
               write(string1,*)'unsupported identity observation ',-1*flavor
               write(string2,*)'Increase "num_obs_types" and recompile.'
               call error_handler(E_ERR, 'obs_diag', string1, source, text2=string2)
            endif

            obsname = 'STREAM_FLOW'
            Nidentity = Nidentity + 1
         endif

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by running obs_diag with the wrf_hydro obs_seq.finals input and SNOW_THICKNESS. Read streamflow_obs_diag.f90 around the local max_defined_types_of_obs declaration and its lookup_flavor assignment, then inspect netcdf_utilities_mod.f90:WriteNetCDF. Done means the run completes without the NC_UNLIMITED size-already-in-use error.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.