NCAR / ccpp-scm

CCPP Single Column Model
Other
14 stars 49 forks source link

casegen error when supplying ij indices #531

Open hertneky opened 1 day ago

hertneky commented 1 day ago

When running casegen using LAM data, @egrell discovered that the UFS_case_gen.py script fails if providing ij indices. The same failure also exists when using global RTs.

The issue is main() calling _find_loc_indices_UFShistory(), which only has logic to find the indices nearest to the provided lon/lat point, hence why latitude/longitude are not subscriptable, since we are only providing ij. On the other hand, _find_loc_indices_UFSIC does have logic to handle either provided lon/lat or indicies. Can this similar logic be added to the problematic subroutine?

Note, the ensemble wrapper script does not even have an option for providing ij.

Example command: ./UFS_case_gen.py -ij 142 69 -d 20210322060000 -i /scratch1/BMC/gmtb/Tracy.Hertneky/ccpp/case_gen/ufs/control_c48_intel_1h/INPUT -g /scratch1/BMC/gmtb/Tracy.Hertneky/ccpp/case_gen/ufs/control_c48_intel_1h/INPUT -f /scratch1/BMC/gmtb/Tracy.Hertneky/ccpp/case_gen/ufs/control_c48_intel_1h -n test_ij_rt -t 5

Error:

Traceback (most recent call last):
  File "./UFS_case_gen.py", line 3773, in <module>
    main()
  File "./UFS_case_gen.py", line 3688, in main
    (hist_i, hist_j, hist_lon, hist_lat, hist_dist_min, angle_to_hist_point, neighbors, dx, dy) = find_loc_indices_UFS_history(location, forcing_dir, lam)
  File "./UFS_case_gen.py", line 506, in find_loc_indices_UFS_history
    dist[i,j] = haversine_distance(latitude[i,j],longitude[i,j],loc[1],loc[0])
TypeError: 'NoneType' object is not subscriptable
hertneky commented 1 day ago

@egrell Was advised to use --location (and --use_nearest if applicable) to get the specified column for now.