NOAA-OWP / lstm

Other
12 stars 17 forks source link

BMI Unit Test + Updates to BMI Functions #4

Closed madMatchstick closed 3 years ago

madMatchstick commented 3 years ago

BMI Unit Testing

Results Summary

Three (variable information) bmi functions showing error

  1. get_var_type() AttributeError: 'float' object has no attribute 'dtype'
  2. get_var_itemize() AttributeError: 'float' object has no attribute 'dtype' (based on get_var_type())
  3. get_var_nbytes() AttributeError: 'float' object has no attribute 'nbytes'

Note these functions PASS when executing after update() call, suggesting attributes may need to be initialized prior? Or the defs themselves are faulty; possibly numpy object (or just version) related?

// TODO: set_value_at_indices() PASSES yet get_value*() do not match so something is off here (def or the manner in which it is called)

Sample Console Out

BEGIN BMI UNIT TEST
*******************

 configuration found: bmi_config_files\01022500_A.yml
 initializing...

MODEL INFORMATION
*****************
 component name: LSTM for Next Generation NWM
 input item count: 8
 output item count: 1
 input var names:
  land_surface_radiation~incoming~longwave__energy_flux
  land_surface_air__pressure
  atmosphere_air_water~vapor__relative_saturation
  atmosphere_water__liquid_equivalent_precipitation_rate
  land_surface_radiation~incoming~shortwave__energy_flux
  land_surface_air__temperature
  land_surface_wind__x_component_of_velocity
  land_surface_wind__y_component_of_velocity
 output var names:
  land_surface_water__runoff_volume_flux

VARIABLE INFORMATION
********************
 land_surface_water__runoff_volume_flux:
  units: mm
**BMI ERROR** in get_var_itemsize()
**BMI ERROR** in get_var_type()
**BMI ERROR** in get_var_nbytes()
  grid id: 0
  location: node
 atmosphere_water__liquid_equivalent_precipitation_rate:
  units: kg m-2
**BMI ERROR** in get_var_itemsize()
**BMI ERROR** in get_var_type()
**BMI ERROR** in get_var_nbytes()
  grid id: 0
  location: node
 land_surface_air__temperature:
  units: K
**BMI ERROR** in get_var_itemsize()
**BMI ERROR** in get_var_type()
**BMI ERROR** in get_var_nbytes()
  grid id: 0
  location: node

TIME INFORMATION
****************
 start time: 0.0
 end time: 1.7976931348623157e+308
 current time: 0
 time step: 1
 time units: 1 hour

GRID INFORMATION
****************
 grid id: 0
  rank: 1
  size: 1
  type: scalar

GET AND SET VALUES
******************
 atmosphere_water__liquid_equivalent_precipitation_rate:
  set value: 0.0
  set value at indices: -9.0
  get value ptr: 0.0
  get value: 0.0
  get value at indices: [0.]
 land_surface_air__temperature:
  set value: -9.496578
  set value at indices: -9.0
  get value ptr: -9.496578
  get value: -9.496578
  get value at indices: [-9.49657822]

CONTROL FUNCTIONS
*****************
 updating...        time 1
 updating until...  time 100
 finalizing...

 Total BMI function PASS: 25
 Total BMI function FAIL: 3
  get_var_itemsize()
  get_var_type()
  get_var_nbytes()

Fixes & Additions to LSTM-BMI bmi_lstm

Testing & Env

jmframe commented 3 years ago

Oh, I guess I cannot merge it. @SnowHydrology needs to do it. Just keep in mind that I am going to submit a pull request right after this that fixes several of the issues.