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

image driver miscellaneous issues with state file i/o #457

Closed
tbohn opened this issue Apr 7, 2016 · 1 comment
Closed

image driver miscellaneous issues with state file i/o #457

tbohn opened this issue Apr 7, 2016 · 1 comment

Comments

@tbohn
Copy link
Contributor

tbohn commented Apr 7, 2016

My previous PR (#402) didn't get fully tested due to problems running the model in image mode. Now that the model is working, I've found a few problems with state file i/o:

  1. call to vic_store() was commented out due to not working with MPI
  2. state file hard-coded to be written at end of simulation
  3. state file name has date appended twice
  4. errors attempting to write lat/lon values
  5. errors attempting to write all other coordinate variables
  6. lat/lon values read by vic_restore() didn't match those from parameter files

The fixes for these issues are almost complete and include:
To address issues 2 and 3:

  • implementing a new function, image/src/check_save_state_flag(), which compares current date to state date and returns true if they're the same, false otherwise (a different version of this function can be implemented in the cesm driver if desired); this will replace the condition if (current == global_param.nrecs - 1)
  • adding global_param.statesec in vic_def.h and including the statesec value in the output state file name (as is already being done in vic_store() using dmy[current].daysecond)
  • modifying get_global_param.c in both classic and image drivers to look for a STATESEC value in addition to STATEYEAR, STATEMONTH, and STATEDAY
  • modifying the sample global parameter files in classic and image drivers to add a STATESEC entry
  • adding STATESEC to classic and image display_current_settings.c

To address issues 4 and 6:

  • moving logic of initialize_state_file() to vic_store() and eliminating initialize_state_file() - this function is actually unnecessary since the initialization and writing all occur at the same time, and as it currently is, it's splitting file definition-related commands between the two functions, thus preventing lat/lon values from being written
  • changing the lat/lon indexing for the 1-dimensional case in both vic_store() and vic_restore(), since a stride is needed in looping over the global_domain.location[] array

To address issue 5:

  • for 1-d coordinate variables like "veg_class" and "dz_node", replacing calls to gather_put_nc_field_xxx(), which assumes the data are spatial fields that must be masked, with calls to put_nc_field_xxx()

To address issue 1:

  • uncommenting call to vic_store() in vic_image()
  • enclosing all dimension and coordinate variable definition and writing commands in an if (mpi_rank == 0) block
@jhamman
Copy link
Member

jhamman commented Apr 14, 2016

closed via #464

@jhamman jhamman closed this as completed Apr 14, 2016
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

No branches or pull requests

2 participants