diff --git a/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/consts.py b/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/consts.py new file mode 100644 index 00000000..b38bd561 --- /dev/null +++ b/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/consts.py @@ -0,0 +1,940 @@ +from NextGen_Forcings_Engine_BMI.NextGen_Forcings_Engine.core import ( + regrid, + time_handling, +) +from NextGen_Forcings_Engine_BMI.NextGen_Forcings_Engine.core.timeInterpMod import ( + nearest_neighbor, + no_interpolation, + weighted_average, +) + +CONSTS = { + "geoMod": { + "GeoMeta": [ + "nodeCoords", + "centerCoords", + "inds", + "esmf_lat", + "esmf_lon", + ], + "UnstructuredGeoMeta": [ + "x_lower_bound", + "x_upper_bound", + "y_lower_bound", + "y_upper_bound", + "dx_meters", + "dy_meters", + "element_ids", + "element_ids_global", + "sina_grid", + "cosa_grid", + "esmf_lat", + "esmf_lon", + ], + "HydrofabricGeoMeta": [ + "nx_local_elem", + "ny_local_elem", + "x_lower_bound", + "x_upper_bound", + "y_lower_bound", + "y_upper_bound", + "nx_global_elem", + "ny_global_elem", + "dx_meters", + "dy_meters", + "mesh_inds_elem", + "height_elem", + "sina_grid", + "cosa_grid", + "slope_elem", + "slp_azi_elem", + "esmf_lat", + "esmf_lon", + "latitude_grid_elem", + "longitude_grid_elem", + ], + "GriddedGeoMeta": [ + "nx_local_elem", + "ny_local_elem", + "nx_global_elem", + "ny_global_elem", + "element_ids", + "element_ids_global", + "lat_bounds", + "lon_bounds", + "mesh_inds", + "mesh_inds_elem", + "height_elem", + "slope_elem", + "slp_azi_elem", + "latitude_grid_elem", + "longitude_grid_elem", + ], + }, + "bmi_model": { + "extension_map": { + "gridded": "GRIDDED", + "hydrofabric": "HYDROFABRIC", + "unstructured": "MESH", + }, + "_output_var_names": [ + "U2D_ELEMENT", + "V2D_ELEMENT", + "LWDOWN_ELEMENT", + "SWDOWN_ELEMENT", + "T2D_ELEMENT", + "Q2D_ELEMENT", + "PSFC_ELEMENT", + "RAINRATE_ELEMENT", + ], + "_output_var_names_unstructured": [ + "U2D_NODE", + "V2D_NODE", + "LWDOWN_NODE", + "SWDOWN_NODE", + "T2D_NODE", + "Q2D_NODE", + "PSFC_NODE", + "RAINRATE_NODE", + "LQFRAC_NODE", + ], + "_var_name_units_map": { + "U2D_ELEMENT": ["10-m U-component of wind", "m/s"], + "V2D_ELEMENT": ["10-m V-component of wind", "m/s"], + "T2D_ELEMENT": ["2-m Air Temperature", "K"], + "Q2D_ELEMENT": ["2-m Specific Humidity", "kg/kg"], + "LWDOWN_ELEMENT": [ + "Surface downward long-wave radiation flux", + "W/m^2", + ], + "SWDOWN_ELEMENT": [ + "Surface downward short-wave radiation flux", + "W/m^2", + ], + "PSFC_ELEMENT": ["Surface Pressure", "Pa"], + "RAINRATE_ELEMENT": ["Surface Precipitation Rate", "mm/s"], + }, + "_var_name_units_map_unstructured": { + "U2D_NODE": ["10-m U-component of wind", "m/s"], + "V2D_NODE": ["10-m V-component of wind", "m/s"], + "T2D_NODE": ["2-m Air Temperature", "K"], + "Q2D_NODE": ["2-m Specific Humidity", "kg/kg"], + "LWDOWN_NODE": [ + "Surface downward long-wave radiation flux", + "W/m^2", + ], + "SWDOWN_NODE": [ + "Surface downward short-wave radiation flux", + "W/m^2", + ], + "PSFC_NODE": ["Surface Pressure", "Pa"], + "RAINRATE_NODE": ["Surface Precipitation Rate", "mm/s"], + }, + }, + "forcingInputMod": { + "InputForcings": [ + "nx_global", + "ny_global", + "nx_local", + "ny_local", + "nx_local_corner", + "ny_local_corner", + "x_lower_bound", + "x_upper_bound", + "y_lower_bound", + "y_upper_bound", + "x_lower_bound_corner", + "x_upper_bound_corner", + "y_lower_bound_corner", + "y_upper_bound_corner", + "outFreq", + "lapseGrid", + "rqiClimoGrid", + "nwmPRISM_numGrid", + "nwmPRISM_denGrid", + "esmf_lats", + "esmf_lons", + "esmf_grid_in", + "esmf_grid_in_elem", + "regridObj", + "regridObj_elem", + "esmf_field_in", + "esmf_field_in_elem", + "esmf_field_out", + "esmf_field_out_elem", + # -------------------------------- + # Only used for CFSv2 bias correction + # as bias correction needs to take + # place prior to regridding. + "coarse_input_forcings1", + "coarse_input_forcings2", + # -------------------------------- + "regridded_forcings1", + "regridded_forcings2", + "globalPcpRate1", + "globalPcpRate2", + "regridded_forcings1_elem", + "regridded_forcings2_elem", + "globalPcpRate1_elem", + "globalPcpRate2_elem", + "ndv", + "file_in1", + "file_in2", + "fcst_hour1", + "fcst_hour2", + "fcst_date1", + "fcst_date2", + "height_elem", + "tmpFile", + "tmpFileHeight", + "regridded_precip1", + "regridded_precip2", + "regridded_precip1_elem", + "regridded_precip2_elem", + "_grib_vars", + "_cycle_freq", + ], + "InputForcingsGridded": [ + "t2dTmp_elem", + "psfcTmp_elem", + "final_forcings_elem", + "height_elem", + "regridded_mask_elem", + "regridded_mask_elem_AORC", + ], + "InputForcingsHydrofabric": [ + "final_forcings_elem", + "height_elem", + "regridded_mask_elem", + "regridded_mask_elem_AORC", + "t2dTmp_elem", + "psfcTmp_elem", + ], + "PRODUCT_NAME": { + 1: "NLDAS2_GRIB1", + 2: "NARR_GRIB1", + 3: "GFS_Production_GRIB2", + 4: "NAM_Conus_Nest_GRIB2", + 5: "HRRR_Conus_GRIB2", + 6: "RAP_Conus_GRIB2", + 7: "CFSv2_6Hr_Global_GRIB2", + 8: "WRF_ARW_Hawaii_GRIB2", + 9: "GFS_Production_025d_GRIB2", + 10: "Custom_NetCDF_Hourly", + 11: "Custom_NetCDF_Hourly", + 12: "AORC", + 13: "NAM_Nest_3km_Hawaii", + 14: "NAM_Nest_3km_PuertoRico", + 15: "NAM_Nest_3km_Alaska", + 16: "NAM_Nest_3km_Hawaii_Radiation-Only", + 17: "NAM_Nest_3km_PuertoRico_Radiation-Only", + 18: "WRF_ARW_PuertoRico_GRIB2", + 19: "HRRR_Alaska_GRIB2", + 20: "Alaska_AnA", + 21: "AORC_Alaska", + 22: "Alaska_ExtAnA", + 23: "ERA5", + 24: "NBM", + 25: "NDFD", + 26: "HRRR_15min", + 27: "NWM", + }, + "CYCLE_FREQ": { + 1: 60, + 2: 180, + 3: 360, + 4: 360, + 5: 60, + 6: 60, + 7: 360, + 8: 1440, + 9: 360, + 10: -9999, + 11: -9999, + 12: -9999, + 13: 360, + 14: 360, + 15: 360, + 16: 360, + 17: 360, + 18: 1440, + 19: 180, + 20: 180, + 21: -9999, + 22: 180, + 23: -9999, + 24: 60, + 25: 1440, + 26: 15, + 27: -9999, + }, + "GRIB_VARS": { + 1: ["TMP", "SPFH", "UGRD", "VGRD", "PRATE", "DSWRF", "DLWRF", "PRES"], + 2: None, + 3: [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "PRATE", + "DSWRF", + "DLWRF", + "PRES", + "CPOFP", + ], + 4: None, + 5: [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES", + "CPOFP", + ], + 6: [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES", + "FROZR", + ], + 7: ["TMP", "SPFH", "UGRD", "VGRD", "PRATE", "DSWRF", "DLWRF", "PRES"], + 8: ["TMP", "SPFH", "UGRD", "VGRD", "APCP", "PRES"], + 9: ["TMP", "SPFH", "UGRD", "VGRD", "PRATE", "DSWRF", "DLWRF", "PRES"], + 10: None, + 11: None, + 12: ["TMP", "SPFH", "UGRD", "VGRD", "APCP", "DSWRF", "DLWRF", "PRES"], + 13: ["TMP", "SPFH", "UGRD", "VGRD", "PRATE", "DSWRF", "DLWRF", "PRES"], + 14: ["TMP", "SPFH", "UGRD", "VGRD", "PRATE", "DSWRF", "DLWRF", "PRES"], + 15: ["TMP", "SPFH", "UGRD", "VGRD", "PRATE", "DSWRF", "DLWRF", "PRES"], + 16: ["DSWRF", "DLWRF"], + 17: ["DSWRF", "DLWRF"], + 18: ["TMP", "SPFH", "UGRD", "VGRD", "APCP", "PRES"], + 19: ["TMP", "SPFH", "UGRD", "VGRD", "APCP", "DSWRF", "DLWRF", "PRES"], + 20: ["TMP", "SPFH", "UGRD", "VGRD", "APCP", "DSWRF", "DLWRF", "PRES"], + 21: ["TMP", "SPFH", "UGRD", "VGRD", "APCP", "DSWRF", "DLWRF", "PRES"], + 22: ["TMP", "SPFH", "UGRD", "VGRD", "APCP", "DSWRF", "DLWRF", "PRES"], + 23: ["TMP", "SPFH", "UGRD", "VGRD", "APCP", "DSWRF", "DLWRF", "PRES"], + 24: ["TMP", "APCP"], + 25: ["TMP", "WDIR", "WSPD", "APCP"], + 26: ["TMP", "SPFH", "UGRD", "VGRD", "APCP", "DSWRF", "DLWRF", "PRES"], + 27: [ + "T2D", + "Q2D", + "U2D", + "V2D", + "RAINRATE", + "SWDOWN", + "LWDOWN", + "PSFC", + ], + }, + "GRIB_LEVELS": { + 1: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 2: None, + 3: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + "surface", + ], + 4: None, + 5: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + "surface", + ], + 6: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + "surface", + ], + 7: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 8: [ + "80 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + ], + 9: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 10: None, + 11: None, + 12: None, + 13: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 14: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 15: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 16: ["surface", "surface"], + 17: ["surface", "surface"], + 18: [ + "80 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + ], + 19: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 20: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 21: None, + 22: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 23: None, + 24: ["2 m above ground", "surface"], + 25: [ + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + ], + 26: [ + "2 m above ground", + "2 m above ground", + "10 m above ground", + "10 m above ground", + "surface", + "surface", + "surface", + "surface", + ], + 27: None, + }, + "NET_CDF_VARS_NAMES": { + 1: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 2: None, + 3: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "PRATE_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + "CPOFP_surface", + ], + 4: None, + 5: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + "CPOFP_surface", + ], + 6: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + "FROZR_surface", + ], + 7: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "PRATE_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 8: [ + "TMP_80maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "PRES_surface", + ], + 9: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "PRATE_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 10: ["T2D", "Q2D", "U10", "V10", "RAINRATE", "DSWRF", "DLWRF", "PRES"], + 11: ["T2D", "Q2D", "U10", "V10", "RAINRATE", "DSWRF", "DLWRF", "PRES"], + 12: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 13: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "PRATE_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 14: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "PRATE_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 15: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "PRATE_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 16: ["DSWRF_surface", "DLWRF_surface"], + 17: ["DSWRF_surface", "DLWRF_surface"], + 18: [ + "TMP_80maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "PRES_surface", + ], + 19: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 20: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 21: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 22: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 23: ["t2m", "d2m", "u10", "v10", "mtpr", "msdwswrf", "msdwlwrf", "sp"], + 24: ["TMP_2maboveground", "APCP_surface"], + 25: [ + "TMP_2maboveground", + "WDIR_10maboveground", + "WIND_10maboveground", + "APCP_surface", + ], + 26: [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface", + ], + 27: ["T2D", "Q2D", "U2D", "V2D", "RAINRATE", "SWDOWN", "LWDOWN", "PSFC"], + }, + "GRIB_MES_IDX": { + 1: None, + 2: None, + 3: None, + 4: None, + 5: None, + 6: None, + 7: None, + 8: None, + 9: [33, 34, 39, 40, 43, 88, 91, 6], + 10: None, + 11: None, + 12: None, + 13: None, + 14: None, + 15: None, + 16: None, + 17: None, + 18: None, + 19: None, + 20: None, + 21: None, + 22: None, + 23: None, + 24: None, + 25: None, + 26: None, + 27: None, + }, + "INPUT_MAP_OUTPUT": { + 1: [4, 5, 0, 1, 3, 7, 2, 6], + 2: None, + 3: [4, 5, 0, 1, 3, 7, 2, 6, 8], + 4: None, + 5: [4, 5, 0, 1, 3, 7, 2, 6, 8], + 6: [4, 5, 0, 1, 3, 7, 2, 6, 8], + 7: [4, 5, 0, 1, 3, 7, 2, 6], + 8: [4, 5, 0, 1, 3, 6], + 9: [4, 5, 0, 1, 3, 7, 2, 6], + 10: [4, 5, 0, 1, 3, 7, 2, 6], + 11: [4, 5, 0, 1, 3, 7, 2, 6], + 12: [4, 5, 0, 1, 3, 7, 2, 6], + 13: [4, 5, 0, 1, 3, 7, 2, 6], + 14: [4, 5, 0, 1, 3, 7, 2, 6], + 15: [4, 5, 0, 1, 3, 7, 2, 6], + 16: [7, 2], + 17: [7, 2], + 18: [4, 5, 0, 1, 3, 6], + 19: [4, 5, 0, 1, 3, 7, 2, 6], + 20: [4, 5, 0, 1, 3, 7, 2, 6], + 21: [4, 5, 0, 1, 3, 7, 2, 6], + 22: [4, 5, 0, 1, 3, 7, 2, 6], + 23: [4, 5, 0, 1, 3, 7, 2, 6], + 24: [4, 3], + 25: [4, 0, 1, 3], + 26: [4, 5, 0, 1, 3, 7, 2, 6], + 27: [4, 5, 0, 1, 3, 7, 2, 6], + }, + "FORECAST_HORIZONS": { + 1: None, + 2: None, + 3: None, + 4: None, + 5: [ + 18, + 18, + 18, + 18, + 18, + 18, + 36, + 18, + 18, + 18, + 18, + 18, + 36, + 18, + 18, + 18, + 18, + 18, + 36, + 18, + 18, + 18, + 18, + 18, + ], + 6: [ + 21, + 21, + 21, + 39, + 21, + 21, + 21, + 21, + 21, + 39, + 21, + 21, + 21, + 21, + 21, + 39, + 21, + 21, + 21, + 21, + 21, + 39, + 21, + 21, + ], + 7: None, + 8: None, + 9: None, + 10: None, + 11: None, + 12: None, + 13: None, + 14: None, + 15: None, + 16: None, + 17: None, + 18: None, + 19: None, + 20: None, + 21: None, + 22: None, + 23: None, + 24: None, + 25: None, + 26: [ + 18, + 18, + 18, + 18, + 18, + 18, + 36, + 18, + 18, + 18, + 18, + 18, + 36, + 18, + 18, + 18, + 18, + 18, + 36, + 18, + 18, + 18, + 18, + 18, + ], + 27: None, + }, + "FIND_NEIGHBOR_FILES_MAP": { + 1: time_handling.find_nldas_neighbors, + 3: time_handling.find_gfs_neighbors, + 5: time_handling.find_input_neighbors, + 6: time_handling.find_input_neighbors, + 7: time_handling.find_cfsv2_neighbors, + 8: time_handling.find_hourly_wrf_arw_neighbors, + 9: time_handling.find_gfs_neighbors, + 10: time_handling.find_custom_hourly_neighbors, + 11: time_handling.find_custom_hourly_neighbors, + 12: time_handling.find_aorc_neighbors, + 13: time_handling.find_nam_nest_neighbors, + 14: time_handling.find_nam_nest_neighbors, + 15: time_handling.find_nam_nest_neighbors, + 16: time_handling.find_nam_nest_neighbors, + 17: time_handling.find_nam_nest_neighbors, + 18: time_handling.find_hourly_wrf_arw_neighbors, + 19: time_handling.find_ak_hrrr_neighbors, + 20: time_handling.find_ak_hrrr_neighbors, + 21: time_handling.find_aorc_neighbors, + 22: time_handling.find_ak_hrrr_neighbors, + 23: time_handling.find_era5_neighbors, + 24: time_handling.find_hourly_nbm_neighbors, + 25: time_handling.find_ndfd_neighbors, + 26: time_handling.find_input_neighbors, + 27: time_handling.find_nwm_neighbors, + }, + "REGRID_MAP": { + 1: regrid.regrid_conus_rap, + 3: regrid.regrid_gfs, + 5: regrid.regrid_conus_hrrr, + 6: regrid.regrid_conus_rap, + 7: regrid.regrid_cfsv2, + 8: regrid.regrid_hourly_wrf_arw, + 9: regrid.regrid_gfs, + 10: regrid.regrid_custom_hourly_netcdf, + 11: regrid.regrid_custom_hourly_netcdf, + 12: regrid.regrid_custom_hourly_netcdf, + 13: regrid.regrid_nam_nest, + 14: regrid.regrid_nam_nest, + 15: regrid.regrid_nam_nest, + 16: regrid.regrid_nam_nest, + 17: regrid.regrid_nam_nest, + 18: regrid.regrid_hourly_wrf_arw, + 19: regrid.regrid_conus_hrrr, + 20: regrid.regrid_conus_hrrr, + 21: regrid.regrid_custom_hourly_netcdf, + 22: regrid.regrid_conus_hrrr, + 23: regrid.regrid_era5, + 24: regrid.regrid_hourly_nbm, + 25: regrid.regrid_ndfd, + 26: regrid.regrid_conus_hrrr, + 27: regrid.regrid_nwm, + }, + "TEMPORAL_INTERPOLATE_INPUTS_MAP": { + 0: no_interpolation, + 1: nearest_neighbor, + 2: weighted_average, + }, + "FILE_EXT": { + "GRIB1": ".grb", + "GRIB2": ".grib2", + "NETCDF": ".nc", + "NETCDF4": ".nc4", + "NWM": ".LDASIN_DOMAIN1", + "ZARR": ".zarr", + }, + }, + "test_utils": { + "OLD_NEW_VAR_MAP": { + "q2dBiasCorrectOpt": "q2BiasCorrectOpt", + "paramDir": "dScaleParamDirs", + "border": "ignored_border_widths", + "regridOpt": "regrid_opt", + "userFcstHorizon": "fcst_input_horizons", + "inDir": "input_force_dirs", + "swDowscaleOpt": "swDownscaleOpt", + "t2dBiasCorrectOpt": "t2BiasCorrectOpt", + "userCycleOffset": "fcst_input_offsets", + "windBiasCorrectOpt": "windBiasCorrect", + "timeInterpOpt": "forceTemoralInterp", + "enforce": "input_force_mandatory", + "file_type": "input_force_types", + } + }, +} diff --git a/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/forcingInputMod.py b/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/forcingInputMod.py index 6948fb98..b24bf1cb 100755 --- a/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/forcingInputMod.py +++ b/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/forcingInputMod.py @@ -1101,33 +1101,35 @@ def init_dict( # temporary temperature arrays that are un-downscaled. if input_dict[force_key].q2dDownscaleOpt > 0: if config_options.grid_type == "gridded": - input_dict[force_key].t2dTmp = np.empty( + input_dict[force_key].t2dTmp = np.full( [geo_meta_wrf_hydro.ny_local, geo_meta_wrf_hydro.nx_local], - np.float32, + np.nan, + dtype=np.float32, ) - input_dict[force_key].psfcTmp = np.empty( + input_dict[force_key].psfcTmp = np.full( [geo_meta_wrf_hydro.ny_local, geo_meta_wrf_hydro.nx_local], - np.float32, + np.nan, + dtype=np.float32, ) elif config_options.grid_type == "unstructured": - input_dict[force_key].t2dTmp = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].t2dTmp = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) - input_dict[force_key].psfcTmp = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].psfcTmp = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) - input_dict[force_key].t2dTmp_elem = np.empty( - [geo_meta_wrf_hydro.ny_local_elem], np.float32 + input_dict[force_key].t2dTmp_elem = np.full( + [geo_meta_wrf_hydro.ny_local_elem], np.nan, dtype=np.float32 ) - input_dict[force_key].psfcTmp_elem = np.empty( - [geo_meta_wrf_hydro.ny_local_elem], np.float32 + input_dict[force_key].psfcTmp_elem = np.full( + [geo_meta_wrf_hydro.ny_local_elem], np.nan, dtype=np.float32 ) elif config_options.grid_type == "hydrofabric": - input_dict[force_key].t2dTmp = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].t2dTmp = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) - input_dict[force_key].psfcTmp = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].psfcTmp = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) # Initialize the local final grid of values. This is represntative # of the local grid for this forcing, for a specific output timesetp. @@ -1139,56 +1141,65 @@ def init_dict( input_dict[force_key].grib_vars = input_dict[force_key].grib_vars[:-1] if config_options.grid_type == "gridded": - input_dict[force_key].final_forcings = np.empty( + input_dict[force_key].final_forcings = np.full( [force_count, geo_meta_wrf_hydro.ny_local, geo_meta_wrf_hydro.nx_local], - np.float64, + np.nan, + dtype=np.float64, ) - input_dict[force_key].height = np.empty( - [geo_meta_wrf_hydro.ny_local, geo_meta_wrf_hydro.nx_local], np.float32 + input_dict[force_key].height = np.full( + [geo_meta_wrf_hydro.ny_local, geo_meta_wrf_hydro.nx_local], + np.nan, + dtype=np.float32, ) - input_dict[force_key].regridded_mask = np.empty( - [geo_meta_wrf_hydro.ny_local, geo_meta_wrf_hydro.nx_local], np.float32 + input_dict[force_key].regridded_mask = np.full( + [geo_meta_wrf_hydro.ny_local, geo_meta_wrf_hydro.nx_local], + np.nan, + dtype=np.float32, ) - input_dict[force_key].regridded_mask_AORC = np.empty( - [geo_meta_wrf_hydro.ny_local, geo_meta_wrf_hydro.nx_local], np.float32 + input_dict[force_key].regridded_mask_AORC = np.full( + [geo_meta_wrf_hydro.ny_local, geo_meta_wrf_hydro.nx_local], + np.nan, + dtype=np.float32, ) elif config_options.grid_type == "unstructured": - input_dict[force_key].final_forcings = np.empty( - [force_count, geo_meta_wrf_hydro.ny_local], np.float64 + input_dict[force_key].final_forcings = np.full( + [force_count, geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float64 ) - input_dict[force_key].height = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].height = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) - input_dict[force_key].regridded_mask = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].regridded_mask = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) - input_dict[force_key].regridded_mask_AORC = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].regridded_mask_AORC = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) - input_dict[force_key].final_forcings_elem = np.empty( - [force_count, geo_meta_wrf_hydro.ny_local_elem], np.float64 + input_dict[force_key].final_forcings_elem = np.full( + [force_count, geo_meta_wrf_hydro.ny_local_elem], + np.nan, + dtype=np.float64, ) - input_dict[force_key].height_elem = np.empty( - [geo_meta_wrf_hydro.ny_local_elem], np.float32 + input_dict[force_key].height_elem = np.full( + [geo_meta_wrf_hydro.ny_local_elem], np.nan, dtype=np.float32 ) - input_dict[force_key].regridded_mask_elem = np.empty( - [geo_meta_wrf_hydro.ny_local_elem], np.float32 + input_dict[force_key].regridded_mask_elem = np.full( + [geo_meta_wrf_hydro.ny_local_elem], np.nan, dtype=np.float32 ) - input_dict[force_key].regridded_mask_elem_AORC = np.empty( - [geo_meta_wrf_hydro.ny_local_elem], np.float32 + input_dict[force_key].regridded_mask_elem_AORC = np.full( + [geo_meta_wrf_hydro.ny_local_elem], np.nan, dtype=np.float32 ) elif config_options.grid_type == "hydrofabric": - input_dict[force_key].final_forcings = np.empty( - [force_count, geo_meta_wrf_hydro.ny_local], np.float64 + input_dict[force_key].final_forcings = np.full( + [force_count, geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float64 ) - input_dict[force_key].height = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].height = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) - input_dict[force_key].regridded_mask = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].regridded_mask = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) - input_dict[force_key].regridded_mask_AORC = np.empty( - [geo_meta_wrf_hydro.ny_local], np.float32 + input_dict[force_key].regridded_mask_AORC = np.full( + [geo_meta_wrf_hydro.ny_local], np.nan, dtype=np.float32 ) # Obtain custom input cycle frequencies if force_key == 10 or force_key == 11: diff --git a/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/general_utils.py b/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/general_utils.py index 953af214..07bc33e0 100644 --- a/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/general_utils.py +++ b/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/general_utils.py @@ -3,6 +3,7 @@ import json import logging import typing +from collections import OrderedDict import numpy as np @@ -73,6 +74,7 @@ def assert_equal_with_tol( keys_to_check: tuple | None = None, absolute_tolerance: float = 1e-6, relative_tolerance: float = 1e-10, + new_keys_in_actual_ok: bool = False, ): """Assert that the key,value pairs in `expect` have matching key,value pairs in `actual`, with numerical tolerance. It is okay if actual has extra keys that are not present in expect. @@ -93,21 +95,26 @@ def assert_equal_with_tol( errors.append(KeyError(f"Missing keys from actual: {keys_missing_from_actual}")) keys_missing_from_expected = set(keys_to_check) - set(expect) - if keys_missing_from_expected: - errors.append( - KeyError(f"Missing keys from expected: {keys_missing_from_expected}") - ) + if not new_keys_in_actual_ok: + if keys_missing_from_expected: + errors.append( + KeyError(f"Missing keys from expected: {keys_missing_from_expected}") + ) for k in keys_to_check: ### Check key existence try: v_expect = expect[k] + if isinstance(v_expect, dict): + v_expect = OrderedDict(sorted(list(v_expect.items()))) except KeyError: errors.append(KeyError(f"Key {k} is missing from expected")) continue try: v_actual = actual[k] + if isinstance(v_actual, dict): + v_actual = OrderedDict(sorted(list(v_actual.items()))) except KeyError: msg = f"Key {k} is missing from actual" errors.append(KeyError(msg)) @@ -155,14 +162,32 @@ def assert_equal_with_tol( except np.exceptions.DTypePromotionError: errors.append( ValueError( - f"Expected not equal to actual, and could not apply np.allclose. expect={expect}, actual={actual}." + f"Expected not equal to actual, and could not apply np.allclose. key={k}, expect={expect}, actual={actual}." ) ) continue - + except TypeError: + if isinstance(v_expect, (dict, OrderedDict)) and isinstance( + v_actual, (dict, OrderedDict) + ): + keys_not_in_v_actual = set(dict(v_expect)) - set(dict(v_actual)) + keys_in_v_expect_and_v_actual = set(dict(v_expect)) & set( + dict(v_actual) + ) + keys_with_vals_not_matching = [ + key + for key in keys_in_v_expect_and_v_actual + if v_expect[key] != v_actual[key] + ] + errors.append( + ValueError( + f"Expected not equal to actual for key: {k}. Keys not in actual for {k}: {keys_not_in_v_actual} | keys in actual with values not matching expected for {k}: {keys_with_vals_not_matching}" + ) + ) + continue errors.append( ValueError( - f"Objects not equal, and numerical tolerances (atol={absolute_tolerance} rtol={relative_tolerance}) exceeded for at least one element. {v_expect} vs {v_actual}." + f"Objects not equal, and numerical tolerances (atol={absolute_tolerance} rtol={relative_tolerance}) exceeded for {k}. {v_expect} vs {v_actual}." ) ) diff --git a/pytest.ini b/pytest.ini index 4dc7646f..5ac5cbe6 100644 --- a/pytest.ini +++ b/pytest.ini @@ -6,3 +6,5 @@ log_cli_level = INFO addopts = --full-trace -vv testpaths = tests/esmf_regrid + tests/geomod + tests/input_forcing diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 00000000..c8f6e50c --- /dev/null +++ b/tests/README.md @@ -0,0 +1,155 @@ +# Tests README + +This directory contains tests for the NextGen Forcing BMI Engine. + +## Initial test data + +Tests data is included in the `test_data` directory and includes configs, gpkgs, esmf_meshes, expected results and actual results. While the configs, gpkgs, esmf_meshes and expectd results are included in the repo and can be used as is, the following steps can be taken to re-create these test inputs. + +--- +The initial test data was generated using `nwm-rte` to create a calibration realization +for gage 01123000, starting at time 2013-07-01 00:00:00, and running for 3 timesteps, +using `nwm-rte's` run_suite.sh. See RETRO_FORCING_CONFIG_FILE__AORC_CONUS. + +More specifically the initial expected test data was developed with these specific configurations in `config.bashrc`. +``` +REPO_TAG_FCST_MGR="856fc0e1201076df909e56c7cd384f58e82965a2" +REPO_TAG_MSW_MGR="693c206a22b5e9ffcca3103166c0ca59e2b11b25" +REPO_TAG_CAL_MGR="7e56bf01477ea77e72dfb25a166ac26ff6090ecb" +REPO_TAG_NGEN_FORCING="LOCAL" +NGEN_SOURCE_MODE="ghcr" +NGEN_BASE__REMOTE_GHCR_TAG="844c5f6" +``` + +And these two commands in `nwm-rte's` `run_suite.sh`: +```bash +docker_run python "/ngen-app/bin/bin_mounted/run_calibration.py" -n 2 -fsrc "aorc" -start "2013-07-01 00:00:00" -dur 3 + +docker_run python "/ngen-app/bin/bin_mounted/run_forecast.py" -fconfig "short_range" -dt "2025-07-10 04:00:00" -rname "fcst_run1_short_range" +``` +## Test Structure + +The test suite is organized into the following modules: + +- **`esmf_regrid/`** - Tests for ESMF regridding functionality +- **`geomod/`** - Tests for geomod components +- **`input_forcing/`** - Tests for input forcing data processing +- **`nextgen_forcings_ewts/`** - Tests for EWTS (Error, Warning, and Trapping System) forcings +- **`test_utils.py`** - Shared test utilities and fixtures +- **`conftest.py`** - Pytest configuration and shared fixtures + +## Prerequisites +### Setup requirements: + 1. Create the forcing config.yml files using RTE. + 2. Enter the RTE devcontainer. + +### Required Dependencies + +The test suite requires Python 3.11 or higher. Install the package with test dependencies inside of the `dev container`: + +```bash +# From the repository root directory +pip install -e ".[develop]" +``` + +Or install pytest directly inside of the `dev container`: + +```bash +pip install pytest +``` + +### Additional Requirements + +Ensure all main package dependencies are installed inside of the `dev container` (this typically should happen when the `dev container` is built): + +```bash +pip install -e . +``` + +## Running Tests + +### Run All Tests From the Dev Container + +```bash +Single processor: (cd src/ngen-forcing && pytest ) +Multiple processors: ( cd src/ngen-forcing && mpirun -n 2 pytest ) +``` +### Run Specific Test Modules From the Dev Container + +Run tests for a specific module: + +```bash +# ESMF regridding tests +Single processor: ( cd src/ngen-forcing && pytest tests/esmf_regrid) +Multiple processors: ( cd src/ngen-forcing && mpirun -n 2 pytest tests/esmf_regrid) + +# GeoMod tests +Single processor: ( cd src/ngen-forcing && pytest tests/geomod) +Multiple processors: ( cd src/ngen-forcing && mpirun -n 2 pytest tests/geomod) + +# Input forcing tests +Single processor: ( cd src/ngen-forcing && pytest tests/input_forcing) +Multiple processors: ( cd src/ngen-forcing && mpirun -n 2 pytest tests/input_forcing) +``` + +Create new test output data (creates expected outputs for subsequent tests) +```bash +# ESMF regridding tests +Single processor: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true pytest tests/esmf_regrid) +Multiple processors: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true mpirun -n 2 pytest tests/esmf_regrid) + +# GeoMod tests +Single processor: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true pytest tests/geomod) +Multiple processors: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true mpirun -n 2 pytest tests/geomod) + +# Input forcing tests +Single processor: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true pytest tests/input_forcing) +Multiple processors: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true mpirun -n 2 pytest tests/input_forcing) +``` + +In the rare case where you want to create new `expected` data and run the tests using `old` variable names use the following for `Input Forcing Tests`: +```bash +# Input forcing tests +Single processor: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true pytest tests/input_forcing --map_old_to_new_var_names False) +Multiple processors: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true mpirun -n 2 pytest tests/input_forcing --map_old_to_new_var_names False) +``` +## Test Configuration + +The test suite is configured via `pytest.ini` at the repository root: + +- **Python path**: Set to repository root (`.`) +- **Logging**: Enabled with INFO level (DEBUG available by uncommenting) +- **Verbosity**: Full trace with verbose output (`-vv`) +- **Test paths**: Pre-configured to discover tests in `esmf_regrid`, `geomod`, and `input_forcing` + + +## Test Data + +Test data is stored in the `test_data/` directory. Tests may reference files from this location for input data and expected results validation. + +## Writing New Tests + +When adding new tests: + +1. Place test files in the appropriate subdirectory +2. Name test files with the `test_*.py` prefix +3. Name test functions with the `test_*` prefix +4. Use fixtures from `conftest.py` for common setup +5. Place test data files in `test_data/` with descriptive names + +Example test structure: + +```python +import pytest + +def test_my_feature(): + """Test description.""" + # Arrange + input_data = ... + + # Act + result = function_under_test(input_data) + + # Assert + assert result == expected_output +``` diff --git a/tests/conftest.py b/tests/conftest.py index 2fdec931..37f39a79 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,21 +1,29 @@ """Conventional pytest file conftest.py. Automatically discovered and implicitly imported by pytest.""" import pytest +from test_utils import ( + BMIForcingFixture, + BMIForcingFixture_GeoMod, + BMIForcingFixture_InputForcing, + BMIForcingFixture_Regrid, +) from NextGen_Forcings_Engine_BMI.NextGen_Forcings_Engine.bmi_model import ( + # BMIMODEL, NWMv3_Forcing_Engine_BMI_model, ) -from test_utils import BMIForcingFixture, BMIForcingFixture_Regrid - @pytest.fixture def bmi_forcing_fixture(request) -> BMIForcingFixture: - """Constructor for minimal class of classes for running BMI forcing. + """Construct minimal class of classes for running BMI forcing. + + Constructor for minimal class of classes for running BMI forcing. For example usage, see: tests/esmf_regrid/test_esmf_regrid.test_regrid. - Parameters: - request is a built-in convention for pytest.fixture. It may be passed from @pytest.mark.parametrize usage elsewhere. + Args: + request: A built-in convention for pytest.fixture. It may be passed from @pytest.mark.parametrize usage elsewhere. + """ (config_file,) = request.param bmi_model = NWMv3_Forcing_Engine_BMI_model() @@ -32,11 +40,14 @@ def bmi_forcing_fixture(request) -> BMIForcingFixture: def bmi_forcing_fixture_regrid( request, ) -> BMIForcingFixture_Regrid: - """Constructor for minimal class of classes for running forcing ESMF regrid functions. + """Construct minimal class of callas for running forcing ESMF regrid functions. + + Constructor for minimal class of classes for running forcing ESMF regrid functions. For example usage, see: tests/esmf_regrid/test_esmf_regrid.test_regrid. - Parameters: - request is a built-in convention for pytest.fixture. It may be passed from @pytest.mark.parametrize usage elsewhere. + Args: + request: A built-in convention for pytest.fixture. It may be passed from @pytest.mark.parametrize usage elsewhere. + """ ( regrid_func, @@ -45,6 +56,7 @@ def bmi_forcing_fixture_regrid( extra_attrs, regrid_arrays_to_trim_extra_elements, keys_to_check, + grid_type, ) = request.param bmi_model = NWMv3_Forcing_Engine_BMI_model() @@ -62,3 +74,92 @@ def bmi_forcing_fixture_regrid( regrid_arrays_to_trim_extra_elements=regrid_arrays_to_trim_extra_elements, keys_to_check=keys_to_check, ) + + +@pytest.fixture +def bmi_forcing_fixture_geomod( + request, +) -> BMIForcingFixture_GeoMod: + """Construct minimal class of classes for running forcing GeoMod. + + Constructor for minimal class of classes for running forcing GeoMod. + + For example usage, see: tests/geomod/test_geomod.test_geomod. + + Args: + request: A built-in convention for pytest.fixture. It may be passed from @pytest.mark.parametrize usage elsewhere. + + """ + ( + config_file, + keys_to_check, + grid_type, + ) = request.param + + bmi_model = NWMv3_Forcing_Engine_BMI_model() + bmi_model.initialize_with_params( + config_file=config_file, + b_date=None, + geogrid=None, + output_path=None, + ) + return BMIForcingFixture_GeoMod( + bmi_model=bmi_model, + keys_to_check=keys_to_check, + ) + + +def pytest_addoption(parser): + """Add command line options to pytest.""" + parser.addoption( + "--map_old_to_new_var_names", + action="store", + default=True, + help="Argument to specify if old variables names should be mapped to new variable names.", + ) + + +@pytest.fixture +def bmi_forcing_fixture_input_forcing( + request, +) -> BMIForcingFixture_InputForcing: + """Construct minimal class of class for running forcing input_forcing. + + Constructor for minimal class of classes for running forcing input_forcing. + + For example usage, see: tests/forcing_input/test_forcing_input.test_forcing_input. + + Args: + request: A built-in convention for pytest.fixture. It may be passed from @pytest.mark.parametrize usage elsewhere. + + """ + ( + config_file, + keys_to_check, + grid_type, + force_key, + ) = request.param + + bmi_model = NWMv3_Forcing_Engine_BMI_model() + bmi_model.initialize_with_params( + config_file=config_file, + b_date=None, + geogrid=None, + output_path=None, + ) + map_old_to_new_var_names = request.config.getoption("--map_old_to_new_var_names") + if map_old_to_new_var_names == "True" or map_old_to_new_var_names is True: + map_old_to_new_var_names = True + elif map_old_to_new_var_names == "False" or map_old_to_new_var_names is False: + map_old_to_new_var_names = False + else: + raise ValueError( + f"Unexpected value for arg: map_old_to_new_var_names. Expected True or False; recieved: {map_old_to_new_var_names}" + ) + + return BMIForcingFixture_InputForcing( + bmi_model=bmi_model, + keys_to_check=keys_to_check, + force_key=force_key, + map_old_to_new_var_names=map_old_to_new_var_names, + ) diff --git a/tests/esmf_regrid/test_esmf_regrid.py b/tests/esmf_regrid/test_esmf_regrid.py index 18b77eab..64e1ce8f 100644 --- a/tests/esmf_regrid/test_esmf_regrid.py +++ b/tests/esmf_regrid/test_esmf_regrid.py @@ -1,23 +1,3 @@ -"""pytest tests for ESMF regrid functions. - -Setup requirements: - 1. Create the forcing config.yml files using RTE. - 2. Enter the RTE devcontainer. - -Usage: - The initial test data was generated using RTE to create a calibration realization - for gage 01123000, starting at time 2013-07-01 00:00:00, and running for 3 timesteps, - using RTE's run_suite.sh. See RETRO_FORCING_CONFIG_FILE__AORC_CONUS. - - Run like this for a typical test run (checking against existing test output data) - Single processor: ( cd src/ngen-forcing && pytest ) - Multiple processors: ( cd src/ngen-forcing && mpirun -n 2 pytest ) - - Run like this to create new test output data (created expected outputs for subsequent tests): - Single processor: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true pytest ) - Multiple processors: ( cd src/ngen-forcing && FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA=true mpirun -n 2 pytest ) -""" - import importlib.util import logging import os @@ -45,9 +25,9 @@ RETRO_FORCING_CONFIG_FILE__AORC_CONUS = ( - "/ngwpc/run_ngen/kge_dds/test_bmi/01123000/Input/forcing_config/aorc_config.yml" + "/workspaces/nwm-rte/src/ngen-forcing/tests/test_data/configs/aorc_config.yml" ) -FORECAST_FORCING_CONFIG_FILE__SHORT_RANGE_CONUS = "/ngwpc/run_ngen/kge_dds/test_bmi/01123000/Output/Forecast_Run/fcst_run1_short_range/forcing_config/short_range_config.yml" +FORECAST_FORCING_CONFIG_FILE__SHORT_RANGE_CONUS = "/workspaces/nwm-rte/src/ngen-forcing/tests/test_data/configs/short_range_config.yml" ### These are output arrays which can contain extra unused elements which need to be removed during an equality check. @@ -81,13 +61,12 @@ ### While the InputForcings class instance is the primary source of test results data, ### this is used to add supplemental attributes to the results data, ### for example "element_ids" (for hydrofabric discretization, these are catchment IDs). -EXTRA_ATTRS: tuple[ClassAttrFetcher] = ( - ClassAttrFetcher("wrf_hydro_geo_meta", "element_ids"), -) +EXTRA_ATTRS: tuple[ClassAttrFetcher] = (ClassAttrFetcher("geo_meta", "element_ids"),) COMPOSITE_KEYS_TO_CHECK: tuple[str] = REGRID_KEYS_TO_CHECK + tuple( _.results_key_name for _ in EXTRA_ATTRS ) +GRID_TYPE = "hydrofabric" # ["gridded","hydrofabric","unstructured"] @pytest.mark.parametrize( @@ -100,6 +79,7 @@ EXTRA_ATTRS, REGRID_ARRAYS_TO_TRIM_EXTRA_ELEMENTS, COMPOSITE_KEYS_TO_CHECK, + GRID_TYPE, ), ( regrid_conus_hrrr, @@ -108,6 +88,7 @@ EXTRA_ATTRS, REGRID_ARRAYS_TO_TRIM_EXTRA_ELEMENTS, COMPOSITE_KEYS_TO_CHECK, + GRID_TYPE, ), ( regrid_conus_rap, @@ -116,6 +97,7 @@ EXTRA_ATTRS, REGRID_ARRAYS_TO_TRIM_EXTRA_ELEMENTS, COMPOSITE_KEYS_TO_CHECK, + GRID_TYPE, ), ], indirect=True, diff --git a/tests/geomod/test_geomod.py b/tests/geomod/test_geomod.py new file mode 100644 index 00000000..a164b23d --- /dev/null +++ b/tests/geomod/test_geomod.py @@ -0,0 +1,52 @@ +import importlib.util +import os + +import pytest + +### Load import tests.test_utils as test_utils, referring explicitly to its path. +### This explicit load is necessary since March 2026 versions of ngen which introduced /ngen-app/ngen/extern/topoflow-glacier/tests +spec = importlib.util.spec_from_file_location( + "tests.test_utils", os.path.abspath("tests/test_utils.py") +) +test_utils = importlib.util.module_from_spec(spec) +spec.loader.exec_module(test_utils) + + +### This disables a LOG call which was causing a crash at ioMod.py: LOG.debug(f"Wgrib2 command: {Wgrib2Cmd}", True) +os.environ["MFE_SILENT"] = "true" + + +RETRO_FORCING_CONFIG_FILE__AORC_CONUS = ( + "/workspaces/nwm-rte/src/ngen-forcing/tests/test_data/configs/aorc_config.yml" +) +FORECAST_FORCING_CONFIG_FILE__SHORT_RANGE_CONUS = "/workspaces/nwm-rte/src/ngen-forcing/tests/test_data/configs/short_range_config.yml" +COMPOSITE_KEYS_TO_CHECK = () +GRID_TYPE = "hydrofabric" # ["gridded","hydrofabric","unstructured"] + + +@pytest.mark.parametrize( + "bmi_forcing_fixture_geomod", + [(RETRO_FORCING_CONFIG_FILE__AORC_CONUS, COMPOSITE_KEYS_TO_CHECK, GRID_TYPE)], + indirect=True, +) +def test_geomod( + bmi_forcing_fixture_geomod: test_utils.BMIForcingFixture_GeoMod, # pyright: ignore +) -> None: + """Pytest function for testing GeoMod functionality.""" + ### Total number of timesteps needs to be at least 2, since the 1st one behaves differently than the others, e.g. see `if config_options.current_output_step == 1` throughout the code. + total_timesteps = 3 + + fixt = bmi_forcing_fixture_geomod + if len(fixt.input_forcing_mod) != 1: + raise ValueError( + f"Expected 1 key for input_forcing_mod, got {len(fixt.input_forcing_mod)}: {list(fixt.input_forcing_mod.keys())}" + ) + + fixt.after_intitialization_check() + for i in range(total_timesteps): + fixt.bmi_model.update() + fixt.after_bmi_model_update( + current_output_step=i + 1, + ) + fixt.bmi_model.finalize() + fixt.after_finalize() diff --git a/tests/input_forcing/test_input_forcing.py b/tests/input_forcing/test_input_forcing.py new file mode 100644 index 00000000..4da01d16 --- /dev/null +++ b/tests/input_forcing/test_input_forcing.py @@ -0,0 +1,52 @@ +import importlib.util +import os + +import pytest + +### Load import tests.test_utils as test_utils, referring explicitly to its path. +### This explicit load is necessary since March 2026 versions of ngen which introduced /ngen-app/ngen/extern/topoflow-glacier/tests +spec = importlib.util.spec_from_file_location( + "tests.test_utils", os.path.abspath("tests/test_utils.py") +) +test_utils = importlib.util.module_from_spec(spec) +spec.loader.exec_module(test_utils) + + +### This disables a LOG call which was causing a crash at ioMod.py: LOG.debug(f"Wgrib2 command: {Wgrib2Cmd}", True) +os.environ["MFE_SILENT"] = "true" + + +RETRO_FORCING_CONFIG_FILE__AORC_CONUS = ( + "/workspaces/nwm-rte/src/ngen-forcing/tests/test_data/configs/aorc_config.yml" +) +FORECAST_FORCING_CONFIG_FILE__SHORT_RANGE_CONUS = "/workspaces/nwm-rte/src/ngen-forcing/tests/test_data/configs/short_range_config.yml" +COMPOSITE_KEYS_TO_CHECK = () +GRID_TYPE = "hydrofabric" # ["gridded","hydrofabric","unstructured"] + + +@pytest.mark.parametrize( + "bmi_forcing_fixture_input_forcing", + [(RETRO_FORCING_CONFIG_FILE__AORC_CONUS, COMPOSITE_KEYS_TO_CHECK, GRID_TYPE, 12)], + indirect=True, +) +def test_input_forcing( + bmi_forcing_fixture_input_forcing: test_utils.BMIForcingFixture_InputForcing, # pyright: ignore +) -> None: + """Pytest function for testing InputForcing functionality.""" + ### Total number of timesteps needs to be at least 2, since the 1st one behaves differently than the others, e.g. see `if config_options.current_output_step == 1` throughout the code. + total_timesteps = 3 + + fixt = bmi_forcing_fixture_input_forcing + if len(fixt.input_forcing_mod) != 1: + raise ValueError( + f"Expected 1 key for input_forcing_mod, got {len(fixt.input_forcing_mod)}: {list(fixt.input_forcing_mod.keys())}" + ) + + fixt.after_intitialization_check() + for i in range(total_timesteps): + fixt.bmi_model.update() + fixt.after_bmi_model_update( + current_output_step=i + 1, + ) + fixt.bmi_model.finalize() + fixt.after_finalize() diff --git a/tests/test_data/configs/aorc_config.yml b/tests/test_data/configs/aorc_config.yml new file mode 100644 index 00000000..a092ee2c --- /dev/null +++ b/tests/test_data/configs/aorc_config.yml @@ -0,0 +1,63 @@ +time_step_seconds: 3600 +initial_time: 0 +NWM_VERSION: 4.0 +NWM_CONFIG: AORC +InputForcings: [12] +InputForcingDirectories: ['s3://null'] +InputForcingTypes: [GRIB2] +InputMandatory: [0] +OutputFrequency: 60 +SubOutputHour: 0 +SubOutFreq: 0 +ScratchDir: /ngen-app/data/scratch/AORC/ +Output: 0 +compressOutput: 0 +floatOutput: 0 +AnAFlag: 0 +LookBack: -9999 +RefcstBDateProc: '201307010000' +ForecastFrequency: 60 +ForecastShift: 0 +ForecastInputHorizons: [4260] +ForecastInputOffsets: [0] +Geopackage: /workspaces/nwm-rte/src/ngen-forcing/tests/test_data/gpkg/gauge_01123000.gpkg +GeogridIn: /workspaces/nwm-rte/src/ngen-forcing/tests/test_data/esmf_mesh/gauge_01123000_ESMF_Mesh.nc +SpatialMetaIn: '' +GRID_TYPE: hydrofabric +NodeCoords: nodeCoords +ElemCoords: centerCoords +ElemConn: elementConn +ElemID: element_id +NumElemConn: numElementConn +HGTVAR: Element_Elevation +SLOPE: Element_Slope +SLOPE_AZIMUTH: Element_Slope_Azmuith +IgnoredBorderWidths: [0] +RegridOpt: [1] +ForcingTemporalInterpolation: [0] +TemperatureBiasCorrection: [0] +PressureBiasCorrection: [0] +HumidityBiasCorrection: [0] +WindBiasCorrection: [0] +SwBiasCorrection: [0] +LwBiasCorrection: [0] +PrecipBiasCorrection: [0] +TemperatureDownscaling: [0] +ShortwaveDownscaling: [0] +PressureDownscaling: [0] +PrecipDownscaling: [0] +HumidityDownscaling: [0] +DownscalingParamDirs: [/ngen-app/data] +SuppPcp: [] +SuppPcpForcingTypes: [] +SuppPcpDirectories: [] +SuppPcpParamDir: '' +RegridOptSuppPcp: [] +SuppPcpTemporalInterpolation: [] +SuppPcpInputOffsets: [] +SuppPcpMandatory: [] +RqiMethod: 0 +RqiThreshold: 0.9 +cfsEnsNumber: 1 +custom_input_fcst_freq: [] +includeLQFrac: 1 diff --git a/tests/test_data/configs/short_range_config.yml b/tests/test_data/configs/short_range_config.yml new file mode 100644 index 00000000..74641cdc --- /dev/null +++ b/tests/test_data/configs/short_range_config.yml @@ -0,0 +1,63 @@ +time_step_seconds: 3600 +initial_time: 0 +NWM_VERSION: 4.0 +NWM_CONFIG: short_range +InputForcings: [6, 5] +InputForcingDirectories: [/ngen-app/data/raw_input/RAP, /ngen-app/data/raw_input/HRRR] +InputForcingTypes: [GRIB2, GRIB2] +InputMandatory: [0, 0] +OutputFrequency: 60 +SubOutputHour: 0 +SubOutFreq: 0 +ScratchDir: /ngen-app/data/scratch/short_range/ +Output: 0 +compressOutput: 0 +floatOutput: 0 +AnAFlag: 0 +LookBack: -9999 +RefcstBDateProc: '202507100400' +ForecastFrequency: 60 +ForecastShift: 0 +ForecastInputHorizons: [1080, 1080] +ForecastInputOffsets: [0, 0] +Geopackage: /workspaces/nwm-rte/src/ngen-forcing/tests/test_data/gpkg/gauge_01123000.gpkg +GeogridIn: /workspaces/nwm-rte/src/ngen-forcing/tests/test_data/esmf_mesh/gauge_01123000_ESMF_Mesh.nc +SpatialMetaIn: '' +GRID_TYPE: hydrofabric +NodeCoords: nodeCoords +ElemID: element_id +ElemCoords: centerCoords +ElemConn: elementConn +NumElemConn: numElementConn +HGTVAR: Element_Elevation +SLOPE: Element_Slope +SLOPE_AZIMUTH: Element_Slope_Azmuith +IgnoredBorderWidths: [0, 0] +RegridOpt: [1, 1] +ForcingTemporalInterpolation: [0, 0] +TemperatureBiasCorrection: [0, 0] +PressureBiasCorrection: [0, 0] +HumidityBiasCorrection: [0, 0] +WindBiasCorrection: [0, 0] +SwBiasCorrection: [0, 0] +LwBiasCorrection: [0, 0] +PrecipBiasCorrection: [0, 0] +TemperatureDownscaling: [0, 0] +ShortwaveDownscaling: [0, 0] +PressureDownscaling: [0, 0] +PrecipDownscaling: [0, 0] +HumidityDownscaling: [0, 0] +DownscalingParamDirs: [/ngen-app/data, /ngen-app/data] +SuppPcp: [] +SuppPcpForcingTypes: [] +SuppPcpDirectories: [] +SuppPcpParamDir: /ngen-app/data +RegridOptSuppPcp: [] +SuppPcpTemporalInterpolation: [] +SuppPcpInputOffsets: [] +SuppPcpMandatory: [] +RqiMethod: 0 +RqiThreshold: 0.9 +cfsEnsNumber: '' +custom_input_fcst_freq: [] +includeLQFrac: 1 diff --git a/tests/test_data/esmf_mesh/gauge_01123000_ESMF_Mesh.nc b/tests/test_data/esmf_mesh/gauge_01123000_ESMF_Mesh.nc new file mode 100644 index 00000000..8052eb70 Binary files /dev/null and b/tests/test_data/esmf_mesh/gauge_01123000_ESMF_Mesh.nc differ diff --git a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep0.json b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep0.json index a6158892..21b1103a 100644 --- a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep0.json +++ b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep0.json @@ -1,4 +1,13 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ 1.100000023841858, @@ -163,14 +172,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469, - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep1.json b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep1.json index f3fb6979..9fb716a8 100644 --- a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep1.json +++ b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep1.json @@ -1,4 +1,13 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ 1.100000023841858, @@ -163,14 +172,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469, - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep2.json b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep2.json index a1a2c408..cc3d7067 100644 --- a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep2.json +++ b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n1_rank0_timestep2.json @@ -1,4 +1,13 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ 1.100000023841858, @@ -163,14 +172,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469, - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep0.json b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep0.json index 7657f877..f056de8f 100644 --- a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep0.json +++ b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep0.json @@ -1,4 +1,10 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], "regridded_forcings1": [ [ 1.100000023841858, @@ -112,11 +118,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep1.json b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep1.json index 9233bc7f..9f795e84 100644 --- a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep1.json +++ b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep1.json @@ -1,4 +1,10 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], "regridded_forcings1": [ [ 1.100000023841858, @@ -112,11 +118,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep2.json b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep2.json index 543c849c..54df5ec1 100644 --- a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep2.json +++ b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank0_timestep2.json @@ -1,4 +1,10 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], "regridded_forcings1": [ [ 1.100000023841858, @@ -112,11 +118,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep0.json b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep0.json index 7a6121d2..e460bb14 100644 --- a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep0.json +++ b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep0.json @@ -1,4 +1,9 @@ { + "geo_meta__element_ids": [ + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ 0.800000011920929, @@ -95,10 +100,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep1.json b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep1.json index 056fd276..bb68bd2a 100644 --- a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep1.json +++ b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep1.json @@ -1,4 +1,9 @@ { + "geo_meta__element_ids": [ + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ 0.800000011920929, @@ -95,10 +100,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep2.json b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep2.json index 5e46d098..888f8c89 100644 --- a/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep2.json +++ b/tests/test_data/expected_results/test_expect_regrid_aorc_aws__gauge_01123000_start20130701000000_n2_rank1_timestep2.json @@ -1,4 +1,9 @@ { + "geo_meta__element_ids": [ + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ 0.800000011920929, @@ -95,10 +100,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep0.json b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep0.json index 5ba02848..ac04cbdb 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep0.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep0.json @@ -1,4 +1,13 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -1.7653571367263794, @@ -181,14 +190,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469, - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep1.json b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep1.json index 586f5a3b..49b0caf0 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep1.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep1.json @@ -1,4 +1,13 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -1.7653571367263794, @@ -181,14 +190,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469, - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep2.json b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep2.json index 8ab153a0..e0fdb031 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep2.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n1_rank0_timestep2.json @@ -1,4 +1,13 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -2.3971173763275146, @@ -181,14 +190,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469, - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep0.json b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep0.json index f8fa395e..8804fe93 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep0.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep0.json @@ -1,4 +1,10 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], "regridded_forcings1": [ [ -1.7653571367263794, @@ -124,11 +130,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep1.json b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep1.json index c32ab4c8..396d9039 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep1.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep1.json @@ -1,4 +1,10 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], "regridded_forcings1": [ [ -1.7653571367263794, @@ -124,11 +130,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep2.json b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep2.json index 81a3c24b..1de9a389 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep2.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank0_timestep2.json @@ -1,4 +1,10 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], "regridded_forcings1": [ [ -2.3971173763275146, @@ -124,11 +130,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep0.json b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep0.json index 84987eca..84a88379 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep0.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep0.json @@ -1,4 +1,9 @@ { + "geo_meta__element_ids": [ + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -2.1877381801605225, @@ -105,10 +110,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep1.json b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep1.json index e51e0077..b3404c7c 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep1.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep1.json @@ -1,4 +1,9 @@ { + "geo_meta__element_ids": [ + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -2.1877381801605225, @@ -105,10 +110,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep2.json b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep2.json index 030af749..0dbd57cb 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep2.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_hrrr__gauge_01123000_start20250710040000_n2_rank1_timestep2.json @@ -1,4 +1,9 @@ { + "geo_meta__element_ids": [ + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -2.794367551803589, @@ -105,10 +110,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep0.json b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep0.json index 402295be..bba9b45a 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep0.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep0.json @@ -1,4 +1,13 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -1.0761322975158691, @@ -181,14 +190,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469, - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep1.json b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep1.json index 694e399d..516181c5 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep1.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep1.json @@ -1,4 +1,13 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -1.0761322975158691, @@ -181,14 +190,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469, - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep2.json b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep2.json index f8cd1334..418b8a18 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep2.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n1_rank0_timestep2.json @@ -1,4 +1,13 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -1.068263053894043, @@ -181,14 +190,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469, - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep0.json b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep0.json index 64e15c93..2d7c5683 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep0.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep0.json @@ -1,4 +1,10 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], "regridded_forcings1": [ [ -1.0761322975158691, @@ -124,11 +130,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep1.json b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep1.json index 7fce493c..03cb13e1 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep1.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep1.json @@ -1,4 +1,10 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], "regridded_forcings1": [ [ -1.0761322975158691, @@ -124,11 +130,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep2.json b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep2.json index cb7505c0..53a10af6 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep2.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank0_timestep2.json @@ -1,4 +1,10 @@ { + "geo_meta__element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], "regridded_forcings1": [ [ -1.068263053894043, @@ -124,11 +130,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11466, - 11467, - 11468, - 11469 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep0.json b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep0.json index 6e7ffbba..011bb784 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep0.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep0.json @@ -1,4 +1,9 @@ { + "geo_meta__element_ids": [ + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -1.223454236984253, @@ -105,10 +110,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep1.json b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep1.json index 62546aa3..ad55be40 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep1.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep1.json @@ -1,4 +1,9 @@ { + "geo_meta__element_ids": [ + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -1.223454236984253, @@ -105,10 +110,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep2.json b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep2.json index 473c6245..a06d56b1 100644 --- a/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep2.json +++ b/tests/test_data/expected_results/test_expect_regrid_conus_rap__gauge_01123000_start20250710040000_n2_rank1_timestep2.json @@ -1,4 +1,9 @@ { + "geo_meta__element_ids": [ + 11470, + 11475, + 11476 + ], "regridded_forcings1": [ [ -1.1119216680526733, @@ -105,10 +110,5 @@ "regridded_precip1": null, "regridded_precip1_elem": null, "regridded_precip2": null, - "regridded_precip2_elem": null, - "wrf_hydro_geo_meta__element_ids": [ - 11470, - 11475, - 11476 - ] + "regridded_precip2_elem": null } \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_after_update_n1_rank0__step_1.json b/tests/test_data/expected_results/test_expected_geomod_after_update_n1_rank0__step_1.json new file mode 100644 index 00000000..dc6b5caf --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_after_update_n1_rank0__step_1.json @@ -0,0 +1,136 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-4728106294047550556", + "hash_4066407811557226096" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 653, + 7 + ], + "_size_owned": [ + 653, + 7 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 7, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 7, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_after_update_n1_rank0__step_2.json b/tests/test_data/expected_results/test_expected_geomod_after_update_n1_rank0__step_2.json new file mode 100644 index 00000000..dc6b5caf --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_after_update_n1_rank0__step_2.json @@ -0,0 +1,136 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-4728106294047550556", + "hash_4066407811557226096" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 653, + 7 + ], + "_size_owned": [ + 653, + 7 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 7, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 7, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_after_update_n1_rank0__step_3.json b/tests/test_data/expected_results/test_expected_geomod_after_update_n1_rank0__step_3.json new file mode 100644 index 00000000..dc6b5caf --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_after_update_n1_rank0__step_3.json @@ -0,0 +1,136 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-4728106294047550556", + "hash_4066407811557226096" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 653, + 7 + ], + "_size_owned": [ + 653, + 7 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 7, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 7, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank0__step_1.json b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank0__step_1.json new file mode 100644 index 00000000..2acf30ba --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank0__step_1.json @@ -0,0 +1,118 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-2029877471422530764", + "hash_-2626201295507711994" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 496, + 4 + ], + "_size_owned": [ + 496, + 4 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 4, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 4, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank0__step_2.json b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank0__step_2.json new file mode 100644 index 00000000..2acf30ba --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank0__step_2.json @@ -0,0 +1,118 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-2029877471422530764", + "hash_-2626201295507711994" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 496, + 4 + ], + "_size_owned": [ + 496, + 4 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 4, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 4, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank0__step_3.json b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank0__step_3.json new file mode 100644 index 00000000..2acf30ba --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank0__step_3.json @@ -0,0 +1,118 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-2029877471422530764", + "hash_-2626201295507711994" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 496, + 4 + ], + "_size_owned": [ + 496, + 4 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 4, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 4, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank1__step_1.json b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank1__step_1.json new file mode 100644 index 00000000..a3f11c93 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank1__step_1.json @@ -0,0 +1,112 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_7251470926797134324", + "hash_-8431632255294118507" + ], + [ + [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 327, + 3 + ], + "_size_owned": [ + 157, + 3 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": null, + "latitude_grid": [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": null, + "longitude_grid": [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 3, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 3, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank1__step_2.json b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank1__step_2.json new file mode 100644 index 00000000..a3f11c93 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank1__step_2.json @@ -0,0 +1,112 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_7251470926797134324", + "hash_-8431632255294118507" + ], + [ + [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 327, + 3 + ], + "_size_owned": [ + 157, + 3 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": null, + "latitude_grid": [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": null, + "longitude_grid": [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 3, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 3, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank1__step_3.json b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank1__step_3.json new file mode 100644 index 00000000..a3f11c93 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_after_update_n2_rank1__step_3.json @@ -0,0 +1,112 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_7251470926797134324", + "hash_-8431632255294118507" + ], + [ + [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 327, + 3 + ], + "_size_owned": [ + 157, + 3 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": null, + "latitude_grid": [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": null, + "longitude_grid": [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 3, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 3, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_finalize_n1_rank0_.json b/tests/test_data/expected_results/test_expected_geomod_finalize_n1_rank0_.json new file mode 100644 index 00000000..dc6b5caf --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_finalize_n1_rank0_.json @@ -0,0 +1,136 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-4728106294047550556", + "hash_4066407811557226096" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 653, + 7 + ], + "_size_owned": [ + 653, + 7 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 7, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 7, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_finalize_n2_rank0_.json b/tests/test_data/expected_results/test_expected_geomod_finalize_n2_rank0_.json new file mode 100644 index 00000000..2acf30ba --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_finalize_n2_rank0_.json @@ -0,0 +1,118 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-2029877471422530764", + "hash_-2626201295507711994" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 496, + 4 + ], + "_size_owned": [ + 496, + 4 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 4, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 4, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_finalize_n2_rank1_.json b/tests/test_data/expected_results/test_expected_geomod_finalize_n2_rank1_.json new file mode 100644 index 00000000..a3f11c93 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_finalize_n2_rank1_.json @@ -0,0 +1,112 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_7251470926797134324", + "hash_-8431632255294118507" + ], + [ + [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 327, + 3 + ], + "_size_owned": [ + 157, + 3 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": null, + "latitude_grid": [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": null, + "longitude_grid": [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 3, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 3, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_init_n1_rank0_.json b/tests/test_data/expected_results/test_expected_geomod_init_n1_rank0_.json new file mode 100644 index 00000000..dc6b5caf --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_init_n1_rank0_.json @@ -0,0 +1,136 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-4728106294047550556", + "hash_4066407811557226096" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 653, + 7 + ], + "_size_owned": [ + 653, + 7 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 7, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 7, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_init_n2_rank0_.json b/tests/test_data/expected_results/test_expected_geomod_init_n2_rank0_.json new file mode 100644 index 00000000..2acf30ba --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_init_n2_rank0_.json @@ -0,0 +1,118 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11466, + 11467, + 11468, + 11469 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-2029877471422530764", + "hash_-2626201295507711994" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 496, + 4 + ], + "_size_owned": [ + 496, + 4 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": "hash_4066407811557226096", + "latitude_grid": [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ], + "latitude_grid_elem": null, + "lon_bounds": "hash_-4728106294047550556", + "longitude_grid": [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 0, + 1, + 2, + 3 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 4, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 4, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_geomod_init_n2_rank1_.json b/tests/test_data/expected_results/test_expected_geomod_init_n2_rank1_.json new file mode 100644 index 00000000..a3f11c93 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_geomod_init_n2_rank1_.json @@ -0,0 +1,112 @@ +{ + "centerCoords": null, + "cosa_grid": null, + "crs_atts": null, + "dx_meters": null, + "dy_meters": null, + "element_ids": [ + 11470, + 11475, + 11476 + ], + "element_ids_global": [ + 11466, + 11467, + 11468, + 11469, + 11470, + 11475, + 11476 + ], + "esmf_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_7251470926797134324", + "hash_-8431632255294118507" + ], + [ + [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 327, + 3 + ], + "_size_owned": [ + 157, + 3 + ], + "_spatial_dim": null, + "_struct": {} + }, + "esmf_lat": null, + "esmf_lon": null, + "height": null, + "height_elem": null, + "inds": null, + "lat_bounds": null, + "latitude_grid": [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ], + "latitude_grid_elem": null, + "lon_bounds": null, + "longitude_grid": [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + "longitude_grid_elem": null, + "mesh_inds": [ + 4, + 5, + 6 + ], + "mesh_inds_elem": null, + "nodeCoords": null, + "nx_global": 7, + "nx_global_elem": null, + "nx_local": 3, + "nx_local_elem": null, + "ny_global": 7, + "ny_global_elem": null, + "ny_local": 3, + "ny_local_elem": null, + "sina_grid": null, + "slope": null, + "slope_elem": null, + "slp_azi": null, + "slp_azi_elem": null, + "spatial_global_atts": null, + "x_coord_atts": null, + "x_coords": null, + "x_lower_bound": null, + "x_upper_bound": null, + "y_coord_atts": null, + "y_coords": null, + "y_lower_bound": null, + "y_upper_bound": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_after_update_n1_rank0__step_1.json b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n1_rank0__step_1.json new file mode 100644 index 00000000..797e0fd1 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n1_rank0__step_1.json @@ -0,0 +1,717 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 28, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 0, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 28, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 99160.26249161118, + 99751.30173387309, + 99866.56459840063, + 99835.52273003284, + 100140.1144036002, + 99762.71103274089, + 98958.290765121 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-4728106294047550556", + "hash_4066407811557226096" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 653, + 7 + ], + "_size_owned": [ + 653, + 7 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 7 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 28, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070101z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070101z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 1.100000023841858, + 1.100000023841858, + 1.0, + 0.9000000357627869, + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.5624279975891113, + 3.6000001430511475, + 3.6000001430511475, + 3.6000001430511475, + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.1370544433594, + 401.5856628417969, + 401.5168762207031, + 401.3915100097656, + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 296.09698486328125, + 296.16192626953125, + 296.07421875, + 296.009033203125, + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016559408977627754, + 0.016499999910593033, + 0.016462579369544983, + 0.01636631414294243, + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 99160.265625, + 99751.3046875, + 99866.5625, + 99835.5234375, + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 7.987401246651457e-44, + 8.127531093083939e-44, + 8.267660939516421e-44, + 8.407790785948902e-44, + 8.547920632381384e-44, + 8.688050478813866e-44, + 8.828180325246348e-44 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 28, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 1.100000023841858, + 1.100000023841858, + 1.0, + 0.9000000357627869, + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.5624279975891113, + 3.6000001430511475, + 3.6000001430511475, + 3.6000001430511475, + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.1370544433594, + 401.5856628417969, + 401.5168762207031, + 401.3915100097656, + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 296.09698486328125, + 296.16192626953125, + 296.07421875, + 296.009033203125, + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016559408977627754, + 0.016499999910593033, + 0.016462579369544983, + 0.01636631414294243, + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 99160.265625, + 99751.3046875, + 99866.5625, + 99835.5234375, + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 1.6255062186167878e-43, + 6.305843089461677e-44, + 6.866362475191604e-44, + 6.866362475191604e-44, + 7.286752014489049e-44, + 7.707141553786494e-44, + 6.726232628759122e-44 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 1.100000023841858, + 1.100000023841858, + 1.0, + 0.9000000357627869, + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.5624279975891113, + 3.6000001430511475, + 3.6000001430511475, + 3.6000001430511475, + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.1370544433594, + 401.5856628417969, + 401.5168762207031, + 401.3915100097656, + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 296.09698486328125, + 296.16192626953125, + 296.07421875, + 296.009033203125, + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016559408977627754, + 0.016499999910593033, + 0.016462579369544983, + 0.01636631414294243, + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 99160.265625, + 99751.3046875, + 99866.5625, + 99835.5234375, + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 7.987401246651457e-44, + 8.127531093083939e-44, + 8.267660939516421e-44, + 8.407790785948902e-44, + 8.547920632381384e-44, + 8.688050478813866e-44, + 8.828180325246348e-44 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 0, + "y_lower_bound_corner": null, + "y_upper_bound": 28, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_after_update_n1_rank0__step_2.json b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n1_rank0__step_2.json new file mode 100644 index 00000000..6e61a1bf --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n1_rank0__step_2.json @@ -0,0 +1,717 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 28, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 0, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 28, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 99263.83797955123, + 99864.20759754519, + 99984.1178572765, + 99951.00373610242, + 100253.86506548879, + 99872.71103274089, + 99065.63984167964 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-4728106294047550556", + "hash_4066407811557226096" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 653, + 7 + ], + "_size_owned": [ + 653, + 7 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 7 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 28, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070102z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070102z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 1.100000023841858, + 1.0, + 0.8858484625816345, + 0.7788757085800171, + 0.699999988079071, + 0.800000011920929, + 0.9000000357627869 + ], + [ + 3.2642452716827393, + 3.2708349227905273, + 3.2864480018615723, + 3.254810094833374, + 3.299999952316284, + 3.200000047683716, + 3.299999952316284 + ], + [ + 402.1012878417969, + 402.48565673828125, + 402.3548889160156, + 401.989013671875, + 402.19110107421875, + 402.15179443359375, + 401.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 295.295166015625, + 295.3619384765625, + 295.36065673828125, + 295.25482177734375, + 295.3125305175781, + 295.2787170410156, + 295.20001220703125 + ], + [ + 0.016059407964348793, + 0.01599999889731407, + 0.015986448153853416, + 0.01599999889731407, + 0.015975013375282288, + 0.016007820144295692, + 0.01599999889731407 + ], + [ + 99263.8359375, + 99864.2109375, + 99984.1171875, + 99951.0, + 100253.8671875, + 99872.7109375, + 99065.640625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 28, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 1.100000023841858, + 1.100000023841858, + 1.0, + 0.9000000357627869, + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.5624279975891113, + 3.6000001430511475, + 3.6000001430511475, + 3.6000001430511475, + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.1370544433594, + 401.5856628417969, + 401.5168762207031, + 401.3915100097656, + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 296.09698486328125, + 296.16192626953125, + 296.07421875, + 296.009033203125, + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016559408977627754, + 0.016499999910593033, + 0.016462579369544983, + 0.01636631414294243, + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 99160.265625, + 99751.3046875, + 99866.5625, + 99835.5234375, + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 7.987401246651457e-44, + 8.127531093083939e-44, + 8.267660939516421e-44, + 8.407790785948902e-44, + 8.547920632381384e-44, + 8.688050478813866e-44, + 8.828180325246348e-44 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 1.100000023841858, + 1.0, + 0.8858484625816345, + 0.7788757085800171, + 0.699999988079071, + 0.800000011920929, + 0.9000000357627869 + ], + [ + 3.2642452716827393, + 3.2708349227905273, + 3.2864480018615723, + 3.254810094833374, + 3.299999952316284, + 3.200000047683716, + 3.299999952316284 + ], + [ + 402.1012878417969, + 402.48565673828125, + 402.3548889160156, + 401.989013671875, + 402.19110107421875, + 402.15179443359375, + 401.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 295.295166015625, + 295.3619384765625, + 295.36065673828125, + 295.25482177734375, + 295.3125305175781, + 295.2787170410156, + 295.20001220703125 + ], + [ + 0.016059407964348793, + 0.01599999889731407, + 0.015986448153853416, + 0.01599999889731407, + 0.015975013375282288, + 0.016007820144295692, + 0.01599999889731407 + ], + [ + 99263.8359375, + 99864.2109375, + 99984.1171875, + 99951.0, + 100253.8671875, + 99872.7109375, + 99065.640625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 0, + "y_lower_bound_corner": null, + "y_upper_bound": 28, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_after_update_n1_rank0__step_3.json b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n1_rank0__step_3.json new file mode 100644 index 00000000..67a6c576 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n1_rank0__step_3.json @@ -0,0 +1,717 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 28, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 0, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 28, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 99363.83797955124, + 99970.04062791045, + 100085.72479451672, + 100059.85331996171, + 100370.1144036002, + 99988.90210915556, + 99170.00124612782 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-4728106294047550556", + "hash_4066407811557226096" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 653, + 7 + ], + "_size_owned": [ + 653, + 7 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 7 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 28, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070103z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070103z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 1.0, + 0.9000000357627869, + 0.7116342782974243, + 0.6000000238418579, + 0.6000000238418579, + 0.699999988079071, + 0.800000011920929 + ], + [ + 2.964245080947876, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 392.61285400390625, + 394.7234802246094, + 397.58953857421875, + 399.78857421875, + 400.2782897949219, + 398.3241882324219, + 394.5147705078125 + ], + [ + 7.205791916931048e-05, + 8.333333244081587e-05, + 7.940235082060099e-05, + 8.92011885298416e-05, + 0.00011111111234640703, + 8.333333244081587e-05, + 8.333333244081587e-05 + ], + [ + 294.45458984375, + 294.5556335449219, + 294.5748291015625, + 294.5548095703125, + 294.57501220703125, + 294.5787048339844, + 294.3999938964844 + ], + [ + 0.01549999974668026, + 0.01549999974668026, + 0.015586447902023792, + 0.015599999576807022, + 0.015584511682391167, + 0.015607818961143494, + 0.01549999974668026 + ], + [ + 99363.8359375, + 99970.0390625, + 100085.7265625, + 100059.8515625, + 100370.1171875, + 99988.8984375, + 99170.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 28, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 1.100000023841858, + 1.0, + 0.8858484625816345, + 0.7788757085800171, + 0.699999988079071, + 0.800000011920929, + 0.9000000357627869 + ], + [ + 3.2642452716827393, + 3.2708349227905273, + 3.2864480018615723, + 3.254810094833374, + 3.299999952316284, + 3.200000047683716, + 3.299999952316284 + ], + [ + 402.1012878417969, + 402.48565673828125, + 402.3548889160156, + 401.989013671875, + 402.19110107421875, + 402.15179443359375, + 401.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 295.295166015625, + 295.3619384765625, + 295.36065673828125, + 295.25482177734375, + 295.3125305175781, + 295.2787170410156, + 295.20001220703125 + ], + [ + 0.016059407964348793, + 0.01599999889731407, + 0.015986448153853416, + 0.01599999889731407, + 0.015975013375282288, + 0.016007820144295692, + 0.01599999889731407 + ], + [ + 99263.8359375, + 99864.2109375, + 99984.1171875, + 99951.0, + 100253.8671875, + 99872.7109375, + 99065.640625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 1.0, + 0.9000000357627869, + 0.7116342782974243, + 0.6000000238418579, + 0.6000000238418579, + 0.699999988079071, + 0.800000011920929 + ], + [ + 2.964245080947876, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 392.61285400390625, + 394.7234802246094, + 397.58953857421875, + 399.78857421875, + 400.2782897949219, + 398.3241882324219, + 394.5147705078125 + ], + [ + 7.205791916931048e-05, + 8.333333244081587e-05, + 7.940235082060099e-05, + 8.92011885298416e-05, + 0.00011111111234640703, + 8.333333244081587e-05, + 8.333333244081587e-05 + ], + [ + 294.45458984375, + 294.5556335449219, + 294.5748291015625, + 294.5548095703125, + 294.57501220703125, + 294.5787048339844, + 294.3999938964844 + ], + [ + 0.01549999974668026, + 0.01549999974668026, + 0.015586447902023792, + 0.015599999576807022, + 0.015584511682391167, + 0.015607818961143494, + 0.01549999974668026 + ], + [ + 99363.8359375, + 99970.0390625, + 100085.7265625, + 100059.8515625, + 100370.1171875, + 99988.8984375, + 99170.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 0, + "y_lower_bound_corner": null, + "y_upper_bound": 28, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank0__step_1.json b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank0__step_1.json new file mode 100644 index 00000000..1c3479b5 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank0__step_1.json @@ -0,0 +1,618 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 14, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 0, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 14, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 99160.26249161118, + 99751.30173387309, + 99866.56459840063, + 99835.52273003284 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-2029877471422530764", + "hash_-2626201295507711994" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 496, + 4 + ], + "_size_owned": [ + 496, + 4 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 4 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 14, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070101z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070101z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 1.100000023841858, + 1.100000023841858, + 1.0, + 0.9000000357627869 + ], + [ + 3.5624279975891113, + 3.6000001430511475, + 3.6000001430511475, + 3.6000001430511475 + ], + [ + 401.1370544433594, + 401.5856628417969, + 401.5168762207031, + 401.3915100097656 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 296.09698486328125, + 296.16192626953125, + 296.07421875, + 296.009033203125 + ], + [ + 0.016559408977627754, + 0.016499999910593033, + 0.016462579369544983, + 0.01636631414294243 + ], + [ + 99160.265625, + 99751.3046875, + 99866.5625, + 99835.5234375 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 9.18803377088496e-41, + 4.364694391755724e-40, + 0.0, + -6.165852519510108e+34 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 14, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 1.100000023841858, + 1.100000023841858, + 1.0, + 0.9000000357627869 + ], + [ + 3.5624279975891113, + 3.6000001430511475, + 3.6000001430511475, + 3.6000001430511475 + ], + [ + 401.1370544433594, + 401.5856628417969, + 401.5168762207031, + 401.3915100097656 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 296.09698486328125, + 296.16192626953125, + 296.07421875, + 296.009033203125 + ], + [ + 0.016559408977627754, + 0.016499999910593033, + 0.016462579369544983, + 0.01636631414294243 + ], + [ + 99160.265625, + 99751.3046875, + 99866.5625, + 99835.5234375 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 9.18915480965642e-41, + 4.350345095481038e-40, + 0.0, + 0.11376953125 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 1.100000023841858, + 1.100000023841858, + 1.0, + 0.9000000357627869 + ], + [ + 3.5624279975891113, + 3.6000001430511475, + 3.6000001430511475, + 3.6000001430511475 + ], + [ + 401.1370544433594, + 401.5856628417969, + 401.5168762207031, + 401.3915100097656 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 296.09698486328125, + 296.16192626953125, + 296.07421875, + 296.009033203125 + ], + [ + 0.016559408977627754, + 0.016499999910593033, + 0.016462579369544983, + 0.01636631414294243 + ], + [ + 99160.265625, + 99751.3046875, + 99866.5625, + 99835.5234375 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 9.18803377088496e-41, + 4.364694391755724e-40, + 0.0, + -6.165852519510108e+34 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 0, + "y_lower_bound_corner": null, + "y_upper_bound": 14, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank0__step_2.json b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank0__step_2.json new file mode 100644 index 00000000..2a8e3f58 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank0__step_2.json @@ -0,0 +1,618 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 14, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 0, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 14, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 99263.83797955123, + 99864.20759754519, + 99984.1178572765, + 99951.00373610242 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-2029877471422530764", + "hash_-2626201295507711994" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 496, + 4 + ], + "_size_owned": [ + 496, + 4 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 4 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 14, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070102z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070102z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 1.100000023841858, + 1.0, + 0.8858484625816345, + 0.7788757085800171 + ], + [ + 3.2642452716827393, + 3.2708349227905273, + 3.2864480018615723, + 3.254810094833374 + ], + [ + 402.1012878417969, + 402.48565673828125, + 402.3548889160156, + 401.989013671875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 295.295166015625, + 295.3619384765625, + 295.36065673828125, + 295.25482177734375 + ], + [ + 0.016059407964348793, + 0.01599999889731407, + 0.015986448153853416, + 0.01599999889731407 + ], + [ + 99263.8359375, + 99864.2109375, + 99984.1171875, + 99951.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 14, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 1.100000023841858, + 1.100000023841858, + 1.0, + 0.9000000357627869 + ], + [ + 3.5624279975891113, + 3.6000001430511475, + 3.6000001430511475, + 3.6000001430511475 + ], + [ + 401.1370544433594, + 401.5856628417969, + 401.5168762207031, + 401.3915100097656 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 296.09698486328125, + 296.16192626953125, + 296.07421875, + 296.009033203125 + ], + [ + 0.016559408977627754, + 0.016499999910593033, + 0.016462579369544983, + 0.01636631414294243 + ], + [ + 99160.265625, + 99751.3046875, + 99866.5625, + 99835.5234375 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 9.18803377088496e-41, + 4.364694391755724e-40, + 0.0, + -6.165852519510108e+34 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 1.100000023841858, + 1.0, + 0.8858484625816345, + 0.7788757085800171 + ], + [ + 3.2642452716827393, + 3.2708349227905273, + 3.2864480018615723, + 3.254810094833374 + ], + [ + 402.1012878417969, + 402.48565673828125, + 402.3548889160156, + 401.989013671875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 295.295166015625, + 295.3619384765625, + 295.36065673828125, + 295.25482177734375 + ], + [ + 0.016059407964348793, + 0.01599999889731407, + 0.015986448153853416, + 0.01599999889731407 + ], + [ + 99263.8359375, + 99864.2109375, + 99984.1171875, + 99951.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 0, + "y_lower_bound_corner": null, + "y_upper_bound": 14, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank0__step_3.json b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank0__step_3.json new file mode 100644 index 00000000..3198b0e9 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank0__step_3.json @@ -0,0 +1,618 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 14, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 0, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 14, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 99363.83797955124, + 99970.04062791045, + 100085.72479451672, + 100059.85331996171 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-2029877471422530764", + "hash_-2626201295507711994" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 496, + 4 + ], + "_size_owned": [ + 496, + 4 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 4 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 14, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070103z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070103z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 1.0, + 0.9000000357627869, + 0.7116342782974243, + 0.6000000238418579 + ], + [ + 2.964245080947876, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 392.61285400390625, + 394.7234802246094, + 397.58953857421875, + 399.78857421875 + ], + [ + 7.205791916931048e-05, + 8.333333244081587e-05, + 7.940235082060099e-05, + 8.92011885298416e-05 + ], + [ + 294.45458984375, + 294.5556335449219, + 294.5748291015625, + 294.5548095703125 + ], + [ + 0.01549999974668026, + 0.01549999974668026, + 0.015586447902023792, + 0.015599999576807022 + ], + [ + 99363.8359375, + 99970.0390625, + 100085.7265625, + 100059.8515625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 14, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 1.100000023841858, + 1.0, + 0.8858484625816345, + 0.7788757085800171 + ], + [ + 3.2642452716827393, + 3.2708349227905273, + 3.2864480018615723, + 3.254810094833374 + ], + [ + 402.1012878417969, + 402.48565673828125, + 402.3548889160156, + 401.989013671875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 295.295166015625, + 295.3619384765625, + 295.36065673828125, + 295.25482177734375 + ], + [ + 0.016059407964348793, + 0.01599999889731407, + 0.015986448153853416, + 0.01599999889731407 + ], + [ + 99263.8359375, + 99864.2109375, + 99984.1171875, + 99951.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 1.0, + 0.9000000357627869, + 0.7116342782974243, + 0.6000000238418579 + ], + [ + 2.964245080947876, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 392.61285400390625, + 394.7234802246094, + 397.58953857421875, + 399.78857421875 + ], + [ + 7.205791916931048e-05, + 8.333333244081587e-05, + 7.940235082060099e-05, + 8.92011885298416e-05 + ], + [ + 294.45458984375, + 294.5556335449219, + 294.5748291015625, + 294.5548095703125 + ], + [ + 0.01549999974668026, + 0.01549999974668026, + 0.015586447902023792, + 0.015599999576807022 + ], + [ + 99363.8359375, + 99970.0390625, + 100085.7265625, + 100059.8515625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 0, + "y_lower_bound_corner": null, + "y_upper_bound": 14, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank1__step_1.json b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank1__step_1.json new file mode 100644 index 00000000..641b95a6 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank1__step_1.json @@ -0,0 +1,585 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 14, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 14, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 28, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 100140.1144036002, + 99762.71103274089, + 98958.290765121 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_7251470926797134324", + "hash_-8431632255294118507" + ], + [ + [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 327, + 3 + ], + "_size_owned": [ + 157, + 3 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 3 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 14, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070101z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070101z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 2.5638655642978847e-09, + 0.0, + 0.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 14, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 2.5638655642978847e-09, + 0.0, + 0.0 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 2.5638655642978847e-09, + 0.0, + 0.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 14, + "y_lower_bound_corner": null, + "y_upper_bound": 28, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank1__step_2.json b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank1__step_2.json new file mode 100644 index 00000000..b15f95c2 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank1__step_2.json @@ -0,0 +1,585 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 14, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 14, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 28, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 100253.86506548879, + 99872.71103274089, + 99065.63984167964 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_7251470926797134324", + "hash_-8431632255294118507" + ], + [ + [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 327, + 3 + ], + "_size_owned": [ + 157, + 3 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 3 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 14, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070102z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070102z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 0.699999988079071, + 0.800000011920929, + 0.9000000357627869 + ], + [ + 3.299999952316284, + 3.200000047683716, + 3.299999952316284 + ], + [ + 402.19110107421875, + 402.15179443359375, + 401.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 295.3125305175781, + 295.2787170410156, + 295.20001220703125 + ], + [ + 0.015975013375282288, + 0.016007820144295692, + 0.01599999889731407 + ], + [ + 100253.8671875, + 99872.7109375, + 99065.640625 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 14, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 2.5638655642978847e-09, + 0.0, + 0.0 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 0.699999988079071, + 0.800000011920929, + 0.9000000357627869 + ], + [ + 3.299999952316284, + 3.200000047683716, + 3.299999952316284 + ], + [ + 402.19110107421875, + 402.15179443359375, + 401.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 295.3125305175781, + 295.2787170410156, + 295.20001220703125 + ], + [ + 0.015975013375282288, + 0.016007820144295692, + 0.01599999889731407 + ], + [ + 100253.8671875, + 99872.7109375, + 99065.640625 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 14, + "y_lower_bound_corner": null, + "y_upper_bound": 28, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank1__step_3.json b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank1__step_3.json new file mode 100644 index 00000000..094eaadb --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_after_update_n2_rank1__step_3.json @@ -0,0 +1,585 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 14, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 14, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 28, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 100370.1144036002, + 99988.90210915556, + 99170.00124612782 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_7251470926797134324", + "hash_-8431632255294118507" + ], + [ + [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 327, + 3 + ], + "_size_owned": [ + 157, + 3 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 3 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 14, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070103z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070103z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 0.6000000238418579, + 0.699999988079071, + 0.800000011920929 + ], + [ + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 400.2782897949219, + 398.3241882324219, + 394.5147705078125 + ], + [ + 0.00011111111234640703, + 8.333333244081587e-05, + 8.333333244081587e-05 + ], + [ + 294.57501220703125, + 294.5787048339844, + 294.3999938964844 + ], + [ + 0.015584511682391167, + 0.015607818961143494, + 0.01549999974668026 + ], + [ + 100370.1171875, + 99988.8984375, + 99170.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 14, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 2.5638655642978847e-09, + 0.0, + 0.0 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 0.6000000238418579, + 0.699999988079071, + 0.800000011920929 + ], + [ + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 400.2782897949219, + 398.3241882324219, + 394.5147705078125 + ], + [ + 0.00011111111234640703, + 8.333333244081587e-05, + 8.333333244081587e-05 + ], + [ + 294.57501220703125, + 294.5787048339844, + 294.3999938964844 + ], + [ + 0.015584511682391167, + 0.015607818961143494, + 0.01549999974668026 + ], + [ + 100370.1171875, + 99988.8984375, + 99170.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 14, + "y_lower_bound_corner": null, + "y_upper_bound": 28, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_finalize_n1_rank0_.json b/tests/test_data/expected_results/test_expected_input_forcing_finalize_n1_rank0_.json new file mode 100644 index 00000000..67a6c576 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_finalize_n1_rank0_.json @@ -0,0 +1,717 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 28, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 0, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 28, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 99363.83797955124, + 99970.04062791045, + 100085.72479451672, + 100059.85331996171, + 100370.1144036002, + 99988.90210915556, + 99170.00124612782 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-4728106294047550556", + "hash_4066407811557226096" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834, + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741, + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 653, + 7 + ], + "_size_owned": [ + 653, + 7 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 7 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 28, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070103z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070103z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 1.0, + 0.9000000357627869, + 0.7116342782974243, + 0.6000000238418579, + 0.6000000238418579, + 0.699999988079071, + 0.800000011920929 + ], + [ + 2.964245080947876, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 392.61285400390625, + 394.7234802246094, + 397.58953857421875, + 399.78857421875, + 400.2782897949219, + 398.3241882324219, + 394.5147705078125 + ], + [ + 7.205791916931048e-05, + 8.333333244081587e-05, + 7.940235082060099e-05, + 8.92011885298416e-05, + 0.00011111111234640703, + 8.333333244081587e-05, + 8.333333244081587e-05 + ], + [ + 294.45458984375, + 294.5556335449219, + 294.5748291015625, + 294.5548095703125, + 294.57501220703125, + 294.5787048339844, + 294.3999938964844 + ], + [ + 0.01549999974668026, + 0.01549999974668026, + 0.015586447902023792, + 0.015599999576807022, + 0.015584511682391167, + 0.015607818961143494, + 0.01549999974668026 + ], + [ + 99363.8359375, + 99970.0390625, + 100085.7265625, + 100059.8515625, + 100370.1171875, + 99988.8984375, + 99170.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 28, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 1.100000023841858, + 1.0, + 0.8858484625816345, + 0.7788757085800171, + 0.699999988079071, + 0.800000011920929, + 0.9000000357627869 + ], + [ + 3.2642452716827393, + 3.2708349227905273, + 3.2864480018615723, + 3.254810094833374, + 3.299999952316284, + 3.200000047683716, + 3.299999952316284 + ], + [ + 402.1012878417969, + 402.48565673828125, + 402.3548889160156, + 401.989013671875, + 402.19110107421875, + 402.15179443359375, + 401.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 295.295166015625, + 295.3619384765625, + 295.36065673828125, + 295.25482177734375, + 295.3125305175781, + 295.2787170410156, + 295.20001220703125 + ], + [ + 0.016059407964348793, + 0.01599999889731407, + 0.015986448153853416, + 0.01599999889731407, + 0.015975013375282288, + 0.016007820144295692, + 0.01599999889731407 + ], + [ + 99263.8359375, + 99864.2109375, + 99984.1171875, + 99951.0, + 100253.8671875, + 99872.7109375, + 99065.640625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 1.0, + 0.9000000357627869, + 0.7116342782974243, + 0.6000000238418579, + 0.6000000238418579, + 0.699999988079071, + 0.800000011920929 + ], + [ + 2.964245080947876, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 392.61285400390625, + 394.7234802246094, + 397.58953857421875, + 399.78857421875, + 400.2782897949219, + 398.3241882324219, + 394.5147705078125 + ], + [ + 7.205791916931048e-05, + 8.333333244081587e-05, + 7.940235082060099e-05, + 8.92011885298416e-05, + 0.00011111111234640703, + 8.333333244081587e-05, + 8.333333244081587e-05 + ], + [ + 294.45458984375, + 294.5556335449219, + 294.5748291015625, + 294.5548095703125, + 294.57501220703125, + 294.5787048339844, + 294.3999938964844 + ], + [ + 0.01549999974668026, + 0.01549999974668026, + 0.015586447902023792, + 0.015599999576807022, + 0.015584511682391167, + 0.015607818961143494, + 0.01549999974668026 + ], + [ + 99363.8359375, + 99970.0390625, + 100085.7265625, + 100059.8515625, + 100370.1171875, + 99988.8984375, + 99170.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 0, + "y_lower_bound_corner": null, + "y_upper_bound": 28, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_finalize_n2_rank0_.json b/tests/test_data/expected_results/test_expected_input_forcing_finalize_n2_rank0_.json new file mode 100644 index 00000000..3198b0e9 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_finalize_n2_rank0_.json @@ -0,0 +1,618 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 14, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 0, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 14, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 99363.83797955124, + 99970.04062791045, + 100085.72479451672, + 100059.85331996171 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_-2029877471422530764", + "hash_-2626201295507711994" + ], + [ + [ + -72.04918711744217, + -72.0498876679477, + -72.05118870198277, + -72.04754380872834 + ], + [ + 41.824530105139985, + 41.79153684369973, + 41.739617787523294, + 41.68903878715741 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 496, + 4 + ], + "_size_owned": [ + 496, + 4 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 4 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 0, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 14, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070103z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070103z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 1.0, + 0.9000000357627869, + 0.7116342782974243, + 0.6000000238418579 + ], + [ + 2.964245080947876, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 392.61285400390625, + 394.7234802246094, + 397.58953857421875, + 399.78857421875 + ], + [ + 7.205791916931048e-05, + 8.333333244081587e-05, + 7.940235082060099e-05, + 8.92011885298416e-05 + ], + [ + 294.45458984375, + 294.5556335449219, + 294.5748291015625, + 294.5548095703125 + ], + [ + 0.01549999974668026, + 0.01549999974668026, + 0.015586447902023792, + 0.015599999576807022 + ], + [ + 99363.8359375, + 99970.0390625, + 100085.7265625, + 100059.8515625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 14, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 1.100000023841858, + 1.0, + 0.8858484625816345, + 0.7788757085800171 + ], + [ + 3.2642452716827393, + 3.2708349227905273, + 3.2864480018615723, + 3.254810094833374 + ], + [ + 402.1012878417969, + 402.48565673828125, + 402.3548889160156, + 401.989013671875 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 295.295166015625, + 295.3619384765625, + 295.36065673828125, + 295.25482177734375 + ], + [ + 0.016059407964348793, + 0.01599999889731407, + 0.015986448153853416, + 0.01599999889731407 + ], + [ + 99263.8359375, + 99864.2109375, + 99984.1171875, + 99951.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 1.0, + 0.9000000357627869, + 0.7116342782974243, + 0.6000000238418579 + ], + [ + 2.964245080947876, + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 392.61285400390625, + 394.7234802246094, + 397.58953857421875, + 399.78857421875 + ], + [ + 7.205791916931048e-05, + 8.333333244081587e-05, + 7.940235082060099e-05, + 8.92011885298416e-05 + ], + [ + 294.45458984375, + 294.5556335449219, + 294.5748291015625, + 294.5548095703125 + ], + [ + 0.01549999974668026, + 0.01549999974668026, + 0.015586447902023792, + 0.015599999576807022 + ], + [ + 99363.8359375, + 99970.0390625, + 100085.7265625, + 100059.8515625 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 0, + "y_lower_bound_corner": null, + "y_upper_bound": 14, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_finalize_n2_rank1_.json b/tests/test_data/expected_results/test_expected_input_forcing_finalize_n2_rank1_.json new file mode 100644 index 00000000..094eaadb --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_finalize_n2_rank1_.json @@ -0,0 +1,585 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": { + "_data": null, + "_finalized": false, + "_grid": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 14, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "_lower_bounds": [ + 14, + 0 + ], + "_meta": {}, + "_name": "AORC_NATIVE", + "_ndbounds": null, + "_rank": 2, + "_staggerloc": 0, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 28, + 14 + ], + "_xd": 0 + }, + "esmf_field_in_elem": null, + "esmf_field_out": { + "_data": [ + 100370.1144036002, + 99988.90210915556, + 99170.00124612782 + ], + "_finalized": false, + "_grid": { + "_area": [ + null, + null + ], + "_coord_sys": null, + "_coords": [ + [ + "hash_7251470926797134324", + "hash_-8431632255294118507" + ], + [ + [ + -72.0554434265969, + -72.03341338948294, + -72.07444419922648 + ], + [ + 41.66453348086255, + 41.721705460500516, + 41.77940007526497 + ] + ] + ], + "_finalized": false, + "_mask": [ + null, + null + ], + "_meta": {}, + "_parametric_dim": 2, + "_rank": 1, + "_size": [ + 327, + 3 + ], + "_size_owned": [ + 157, + 3 + ], + "_spatial_dim": null, + "_struct": {} + }, + "_lower_bounds": [ + 0 + ], + "_meta": {}, + "_name": "AORCFORCING_REGRIDDED", + "_ndbounds": null, + "_rank": 1, + "_staggerloc": 1, + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + 3 + ], + "_xd": 0 + }, + "esmf_field_out_elem": null, + "esmf_grid_in": { + "_area": [ + null, + null, + null, + null + ], + "_areatype": 6, + "_coord_sys": 1, + "_coords": [ + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ], + [ + null, + null + ] + ], + "_decount": 1, + "_finalized": false, + "_has_corners": false, + "_lower_bounds": [ + [ + 14, + 0 + ], + null, + null, + null + ], + "_mask": [ + null, + null, + null, + null + ], + "_max_index": [ + 28, + 14 + ], + "_meta": {}, + "_ndims": 2, + "_num_peri_dims": 0, + "_ocgis": {}, + "_periodic_dim": null, + "_pole_dim": null, + "_pole_kind": null, + "_rank": 2, + "_size": [ + [ + 14, + 14 + ], + null, + null, + null + ], + "_staggerloc": [ + true, + false, + false, + false + ], + "_struct": {}, + "_type": 6, + "_upper_bounds": [ + [ + 28, + 14 + ], + null, + null, + null + ] + }, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": "s3://null/AORC-OWP_2013070103z.grib2", + "file_in2": "s3://null/AORC-OWP_2013070103z.grib2", + "file_type": "GRIB2", + "final_forcings": [ + [ + 0.6000000238418579, + 0.699999988079071, + 0.800000011920929 + ], + [ + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 400.2782897949219, + 398.3241882324219, + 394.5147705078125 + ], + [ + 0.00011111111234640703, + 8.333333244081587e-05, + 8.333333244081587e-05 + ], + [ + 294.57501220703125, + 294.5787048339844, + 294.3999938964844 + ], + [ + 0.015584511682391167, + 0.015607818961143494, + 0.01549999974668026 + ], + [ + 100370.1171875, + 99988.8984375, + 99170.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0 + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": 14, + "nx_local": 14, + "nx_local_corner": null, + "ny_global": 28, + "ny_local": 14, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": [ + [ + 0.800000011920929, + 0.9708916544914246, + 1.0 + ], + [ + 3.700000047683716, + 3.6000001430511475, + 3.665524959564209 + ], + [ + 401.5160827636719, + 401.2808837890625, + 400.64373779296875 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 296.02203369140625, + 296.0078125, + 296.0 + ], + [ + 0.016375012695789337, + 0.016407819464802742, + 0.016441447660326958 + ], + [ + 100140.1171875, + 99762.7109375, + 98958.2890625 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + 2.5638655642978847e-09, + 0.0, + 0.0 + ] + ], + "regridded_forcings1_elem": null, + "regridded_forcings2": [ + [ + 0.6000000238418579, + 0.699999988079071, + 0.800000011920929 + ], + [ + 2.9000000953674316, + 2.9000000953674316, + 2.9000000953674316 + ], + [ + 400.2782897949219, + 398.3241882324219, + 394.5147705078125 + ], + [ + 0.00011111111234640703, + 8.333333244081587e-05, + 8.333333244081587e-05 + ], + [ + 294.57501220703125, + 294.5787048339844, + 294.3999938964844 + ], + [ + 0.015584511682391167, + 0.015607818961143494, + 0.01549999974668026 + ], + [ + 100370.1171875, + 99988.8984375, + 99170.0 + ], + [ + 0.0, + 0.0, + 0.0 + ], + [ + -9999.0, + -9999.0, + -9999.0 + ] + ], + "regridded_forcings2_elem": null, + "regridded_mask": [ + 1.0, + 1.0, + 1.0 + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": 0, + "x_lower_bound_corner": null, + "x_upper_bound": 14, + "x_upper_bound_corner": null, + "y_lower_bound": 14, + "y_lower_bound_corner": null, + "y_upper_bound": 28, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_init_n1_rank0_.json b/tests/test_data/expected_results/test_expected_input_forcing_init_n1_rank0_.json new file mode 100644 index 00000000..238cfa4c --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_init_n1_rank0_.json @@ -0,0 +1,292 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": null, + "esmf_field_in_elem": null, + "esmf_field_out": null, + "esmf_field_out_elem": null, + "esmf_grid_in": null, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": null, + "file_in2": null, + "file_type": "GRIB2", + "final_forcings": [ + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": null, + "nx_local": null, + "nx_local_corner": null, + "ny_global": null, + "ny_local": null, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj": null, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": null, + "regridded_forcings1_elem": null, + "regridded_forcings2": null, + "regridded_forcings2_elem": null, + "regridded_mask": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": null, + "x_lower_bound_corner": null, + "x_upper_bound": null, + "x_upper_bound_corner": null, + "y_lower_bound": null, + "y_lower_bound_corner": null, + "y_upper_bound": null, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_init_n2_rank0_.json b/tests/test_data/expected_results/test_expected_input_forcing_init_n2_rank0_.json new file mode 100644 index 00000000..302e1df0 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_init_n2_rank0_.json @@ -0,0 +1,256 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": null, + "esmf_field_in_elem": null, + "esmf_field_out": null, + "esmf_field_out_elem": null, + "esmf_grid_in": null, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": null, + "file_in2": null, + "file_type": "GRIB2", + "final_forcings": [ + [ + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN, + NaN + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": null, + "nx_local": null, + "nx_local_corner": null, + "ny_global": null, + "ny_local": null, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj": null, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": null, + "regridded_forcings1_elem": null, + "regridded_forcings2": null, + "regridded_forcings2_elem": null, + "regridded_mask": [ + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": null, + "x_lower_bound_corner": null, + "x_upper_bound": null, + "x_upper_bound_corner": null, + "y_lower_bound": null, + "y_lower_bound_corner": null, + "y_upper_bound": null, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/expected_results/test_expected_input_forcing_init_n2_rank1_.json b/tests/test_data/expected_results/test_expected_input_forcing_init_n2_rank1_.json new file mode 100644 index 00000000..db9a46a1 --- /dev/null +++ b/tests/test_data/expected_results/test_expected_input_forcing_init_n2_rank1_.json @@ -0,0 +1,244 @@ +{ + "border": 0, + "coarse_input_forcings1": null, + "coarse_input_forcings2": null, + "cycle_freq": -9999, + "enforce": 0, + "esmf_field_in": null, + "esmf_field_in_elem": null, + "esmf_field_out": null, + "esmf_field_out_elem": null, + "esmf_grid_in": null, + "esmf_grid_in_elem": null, + "esmf_lats": null, + "esmf_lons": null, + "fcst_date1": null, + "fcst_date2": null, + "fcst_hour1": null, + "fcst_hour2": null, + "file_ext": ".grib2", + "file_in1": null, + "file_in2": null, + "file_type": "GRIB2", + "final_forcings": [ + [ + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN + ], + [ + NaN, + NaN, + NaN + ] + ], + "final_forcings_elem": null, + "find_neighbor_files_map": { + "1": "find_nldas_neighbors", + "10": "find_custom_hourly_neighbors", + "11": "find_custom_hourly_neighbors", + "12": "find_aorc_neighbors", + "13": "find_nam_nest_neighbors", + "14": "find_nam_nest_neighbors", + "15": "find_nam_nest_neighbors", + "16": "find_nam_nest_neighbors", + "17": "find_nam_nest_neighbors", + "18": "find_hourly_wrf_arw_neighbors", + "19": "find_ak_hrrr_neighbors", + "20": "find_ak_hrrr_neighbors", + "21": "find_aorc_neighbors", + "22": "find_ak_hrrr_neighbors", + "23": "find_era5_neighbors", + "24": "find_hourly_nbm_neighbors", + "25": "find_ndfd_neighbors", + "26": "find_input_neighbors", + "27": "find_nwm_neighbors", + "3": "find_gfs_neighbors", + "5": "find_conus_hrrr_neighbors", + "6": "find_conus_rap_neighbors", + "7": "find_cfsv2_neighbors", + "8": "find_hourly_wrf_arw_neighbors", + "9": "find_gfs_neighbors" + }, + "forecast_horizons": null, + "globalPcpRate1": null, + "globalPcpRate1_elem": null, + "globalPcpRate2": null, + "globalPcpRate2_elem": null, + "grib_levels": null, + "grib_mes_idx": null, + "grib_vars": [ + "TMP", + "SPFH", + "UGRD", + "VGRD", + "APCP", + "DSWRF", + "DLWRF", + "PRES" + ], + "height": [ + NaN, + NaN, + NaN + ], + "height_elem": null, + "inDir": "s3://null", + "input_map_output": [ + 4, + 5, + 0, + 1, + 3, + 7, + 2, + 6 + ], + "keyValue": 12, + "lapseGrid": null, + "lwBiasCorrectOpt": 0, + "ndv": null, + "netcdf_var_names": [ + "TMP_2maboveground", + "SPFH_2maboveground", + "UGRD_10maboveground", + "VGRD_10maboveground", + "APCP_surface", + "DSWRF_surface", + "DLWRF_surface", + "PRES_surface" + ], + "nwmPRISM_denGrid": null, + "nwmPRISM_numGrid": null, + "nx_global": null, + "nx_local": null, + "nx_local_corner": null, + "ny_global": null, + "ny_local": null, + "ny_local_corner": null, + "outFreq": null, + "paramDir": "/ngen-app/data", + "precipBiasCorrectOpt": 0, + "precipDownscaleOpt": 0, + "product_name": "AORC", + "psfcBiasCorrectOpt": 0, + "psfcDownscaleOpt": 0, + "psfcTmp": null, + "psfcTmp_elem": null, + "q2dBiasCorrectOpt": 0, + "q2dDownscaleOpt": 0, + "regridComplete": false, + "regridObj": null, + "regridObj_elem": null, + "regridOpt": 1, + "regrid_map": { + "1": "regrid_conus_rap", + "10": "regrid_custom_hourly_netcdf", + "11": "regrid_custom_hourly_netcdf", + "12": "regrid_custom_hourly_netcdf", + "13": "regrid_nam_nest", + "14": "regrid_nam_nest", + "15": "regrid_nam_nest", + "16": "regrid_nam_nest", + "17": "regrid_nam_nest", + "18": "regrid_hourly_wrf_arw", + "19": "regrid_conus_hrrr", + "20": "regrid_conus_hrrr", + "21": "regrid_custom_hourly_netcdf", + "22": "regrid_conus_hrrr", + "23": "regrid_era5", + "24": "regrid_hourly_nbm", + "25": "regrid_ndfd", + "26": "regrid_conus_hrrr", + "27": "regrid_nwm", + "3": "regrid_gfs", + "5": "regrid_conus_hrrr", + "6": "regrid_conus_rap", + "7": "regrid_cfsv2", + "8": "regrid_hourly_wrf_arw", + "9": "regrid_gfs" + }, + "regridded_forcings1": null, + "regridded_forcings1_elem": null, + "regridded_forcings2": null, + "regridded_forcings2_elem": null, + "regridded_mask": [ + NaN, + NaN, + NaN + ], + "regridded_mask_AORC": [ + NaN, + NaN, + NaN + ], + "regridded_mask_elem": null, + "regridded_mask_elem_AORC": null, + "regridded_precip1": null, + "regridded_precip1_elem": null, + "regridded_precip2": null, + "regridded_precip2_elem": null, + "rqiClimoGrid": null, + "rstFlag": 0, + "skip": false, + "swBiasCorrectOpt": 0, + "swDowscaleOpt": 0, + "t2dBiasCorrectOpt": 0, + "t2dDownscaleOpt": 0, + "t2dTmp": null, + "t2dTmp_elem": null, + "temporal_interpolate_inputs_map": { + "0": "no_interpolation", + "1": "nearest_neighbor", + "2": "weighted_average" + }, + "timeInterpOpt": 0, + "tmpFile": null, + "tmpFileHeight": null, + "userCycleOffset": 0, + "userFcstHorizon": 4260, + "windBiasCorrectOpt": 0, + "x_lower_bound": null, + "x_lower_bound_corner": null, + "x_upper_bound": null, + "x_upper_bound_corner": null, + "y_lower_bound": null, + "y_lower_bound_corner": null, + "y_upper_bound": null, + "y_upper_bound_corner": null +} \ No newline at end of file diff --git a/tests/test_data/gpkg/gauge_01123000.gpkg b/tests/test_data/gpkg/gauge_01123000.gpkg new file mode 100644 index 00000000..379a3923 Binary files /dev/null and b/tests/test_data/gpkg/gauge_01123000.gpkg differ diff --git a/tests/test_utils.py b/tests/test_utils.py index d1e4c9fa..c629058b 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,12 +1,17 @@ """Utilities for ngen-forcing tests.""" -from dataclasses import dataclass import json import logging import os +import types import typing +from collections import OrderedDict +from dataclasses import dataclass +from pathlib import Path +import numpy as np import pytest +import shapely from NextGen_Forcings_Engine_BMI.NextGen_Forcings_Engine.bmi_model import ( NWMv3_Forcing_Engine_BMI_model, @@ -14,6 +19,7 @@ from NextGen_Forcings_Engine_BMI.NextGen_Forcings_Engine.core.config import ( ConfigOptions, ) +from NextGen_Forcings_Engine_BMI.NextGen_Forcings_Engine.core.consts import CONSTS from NextGen_Forcings_Engine_BMI.NextGen_Forcings_Engine.core.forcingInputMod import ( InputForcings, ) @@ -24,16 +30,89 @@ from NextGen_Forcings_Engine_BMI.NextGen_Forcings_Engine.general_utils import ( JSON_NOT_SERIALIZABLE_SENTINEL, ExpectVsActualError, - serialize_to_json, assert_equal_with_tol, + serialize_to_json, ) +INPUT_FORCING_CONSTS = CONSTS["forcingInputMod"] +CONSTS = CONSTS[Path(__file__).stem] + +try: + import esmpy as ESMF +except ImportError: + import ESMF + OS_VAR__CREATE_TEST_EXPECT_DATA = "FORCING_PYTEST_WRITE_TEST_EXPECTED_DATA" +def class_to_dict(class_to_convert: typing.Any): + """Get the attributes of the test class as a dictionary, where the keys are the attribute names and the values are the attribute values. + + This is useful for serializing the test class to JSON for comparison against expected results. + """ + data = {} + # parrent_class_dict=self.test_class.__class__.__base__.__dict__ + # child_class_dict=self.test_class.__class__.__dict__ + for key in dir(class_to_convert): + val = getattr(class_to_convert, key) + if not callable(val) and not key.startswith("_"): + data[key] = val + return data + + +def copy_and_stringify_functions(d): + """Copy dict and stringify functions in the dict.""" + new_dict = {} + for key, value in d.items(): + if isinstance(value, dict): + # Recursively handle nested dictionaries + new_dict[key] = copy_and_stringify_functions(value) + elif callable(value): + # Convert function to its string representation (e.g., function name) + new_dict[key] = value.__name__ + else: + # Keep other values (strings, ints, etc.) as they are + new_dict[key] = value + return new_dict + + +def convert_long_lists(data: typing.Any, max_length: int = 10) -> typing.Any: + """Recursively iterate over a nested data dictionary and convert all lists longer than max_length to a hash. + + Args: + data: The data structure to process (dict, list, or other) + max_length: Maximum list length before conversion (default: 10) + + Returns: + Modified copy of the data structure + + """ + if max_length is None: + return data + if isinstance(data, dict): + return { + key: convert_long_lists(value, max_length) for key, value in data.items() + } + elif isinstance(data, list): + if len(data) > max_length: + if isinstance(data[0], list): + for i, val in enumerate(data): + if len(val) > max_length: + data[i] = f"hash_{hash(tuple(val))}" + else: + return f"hash_{hash(tuple(data))}" + else: + return [convert_long_lists(item, max_length) for item in data] + else: + return data + + def assert_no_not_serializable_sentinel(json_str: str) -> None: - """Inspect the provided string and raise an error if it contains - the sentinel indicating that it contains objects that could not be serialized to JSON.""" + """Assert no not serializable sentinel. + + Inspect the provided string and raise an error if it contains + the sentinel indicating that it contains objects that could not be serialized to JSON. + """ if not isinstance(json_str, str): raise TypeError(f"Expected type str for json_str, but got {type(json_str)}") if JSON_NOT_SERIALIZABLE_SENTINEL in json_str: @@ -44,19 +123,23 @@ def assert_no_not_serializable_sentinel(json_str: str) -> None: @dataclass class ClassAttrFetcher: - """Class attribute fetcher, for helping to collect data + """Fetach class Attributes. + + Class attribute fetcher, for helping to collect data from various in-memory objects in a parameterized way when building test results json files. The string dunder of this class is used to build a test result data key. - Parameters: + Parameters + ---------- fixture_attr_name: The name of the high-level fixture attribute that contains - the desired child attribute, e.g. "wrf_hydro_geo_meta" + the desired child attribute, e.g. "geo_meta" child_attr_name: The name of the child attribute to be collected, e.g. "element_ids". + """ fixture_attr_name: str @@ -64,20 +147,26 @@ class ClassAttrFetcher: @property def results_key_name(self) -> str: + """Get the key name to be used in test results data for this attribute.""" return f"{self.fixture_attr_name}__{self.child_attr_name}" def __str__(self) -> str: + """Return string representation of the ClassAttrFetcher.""" return self.results_key_name def get( self, fixture_instance: typing.Any, serialize_and_deserialize: bool = False ) -> typing.Any: - """From the fixture, fetch the parent class instance, + """Get attribute value. + + From the fixture, fetch the parent class instance, and the value of the child attribute, and return that value. - Parameters + Args: + ---- fixture_instance: the fixture instance which contains the attributes to fetch from serialize_and_deserialize: if true, the returned attribute will be serialized to JSON and then deserialized before returned. + """ parent = getattr(fixture_instance, self.fixture_attr_name) child = getattr(parent, self.child_attr_name) @@ -88,17 +177,226 @@ def get( class BMIForcingFixture: """Minimal class of classes for running BMI forcing. + For example usage, see: tests/esmf_regrid/test_esmf_regrid.test_regrid. """ - def __init__(self, bmi_model: NWMv3_Forcing_Engine_BMI_model): + def __init__(self, bmi_model: NWMv3_Forcing_Engine_BMI_model) -> None: + """Initialize BMIForcingFixture.""" self.bmi_model: NWMv3_Forcing_Engine_BMI_model = bmi_model self.mpi_config: MpiConfig = bmi_model._mpi_meta self.config_options: ConfigOptions = bmi_model._job_meta - self.wrf_hydro_geo_meta: GeoMetaWrfHydro = bmi_model._wrf_hydro_geo_meta + self.geo_meta: GeoMetaWrfHydro = bmi_model._wrf_hydro_geo_meta self.input_forcing_mod: dict = self.bmi_model._input_forcing_mod +class BMIForcingFixture_Class(BMIForcingFixture): + """Test fixture for Class-based tests.""" + + def __init__( + self, + bmi_model: NWMv3_Forcing_Engine_BMI_model, + keys_to_check: tuple[str] = (), + map_old_to_new_var_names: bool = True, + ) -> None: + """Initialize BMIForcingFixture_Class. + + Args: + ---- + bmi_model: The BMI model to be used in the test fixture + keys_to_check: The keys to check + map_old_to_new_var_names: Whether to map old variable names to new variable names in the expected results data, which is needed when updating the test expected outputs dataset but should be false for regular test runs. + """ + super().__init__(bmi_model=bmi_model) + + self.keys_to_check = keys_to_check + self.map_old_to_new_var_names = map_old_to_new_var_names + + self.expected_sub_dir = "test_data/expected_results" + self.actual_sub_dir = "test_data/actual_results" + self.test_dir = os.path.dirname(os.path.abspath(__file__)) + + def deserial_actual( + self, suffix: str, current_output_step: str = "", write_to_file: bool = True + ) -> dict: + """Get the actual metadata results as a deserialized dictionary.""" + deserial_actual = json.loads( + serialize_to_json( + copy_and_stringify_functions(self.test_class_as_dict), sort_keys=True + ) + ) + # order and reverse so private attributes are last + deserial_actual = OrderedDict(reversed(list(deserial_actual.items()))) + deserial_actual = convert_long_lists(deserial_actual, 10) + if write_to_file: + self.write_json( + deserial_actual, + self.actual_results_file_path(suffix, current_output_step), + ) + return deserial_actual + + def write_json(self, dictionary_to_write: dict, json_path: str) -> None: + """Write the deserialized results to a JSON file.""" + json_str = serialize_to_json(dictionary_to_write, sort_keys=True) + with open(json_path, "w") as f: + f.write(json_str) + + def deserial_expected(self, suffix: str, current_output_step: str = "") -> dict: + """Get the expected metadata results as a deserialized dictionary.""" + file_path = self.expected_results_file_path(suffix, current_output_step) + + if os.environ.get(OS_VAR__CREATE_TEST_EXPECT_DATA, "").lower() == "true": + # Dump current results to disk, to save it as "expected" results for later test runs. + # Should only be used when committing new test results to the repository. + logging.warning(f"Writing test data: {file_path}") + deserial_expected = self.deserial_actual( + suffix, current_output_step, write_to_file=False + ) + with open(file_path, "w") as f: + f.write(serialize_to_json(deserial_expected, sort_keys=True)) + if self.map_old_to_new_var_names: + deserial_expected = self.map_old_to_new_variable_names( + deserial_expected + ) + return deserial_expected + else: + try: + with open(file_path) as f: + deserial_expected = json.load(f) + if self.map_old_to_new_var_names: + deserial_expected = self.map_old_to_new_variable_names( + deserial_expected + ) + # order and reverse so private attributes are last + return OrderedDict(reversed(list(deserial_expected.items()))) + except FileNotFoundError as e: + raise FileNotFoundError( + f"Could not find {file_path}. Try running the test using OS var {OS_VAR__CREATE_TEST_EXPECT_DATA}=true first to set up the test results expected data." + ) from e + + def map_old_to_new_variable_names(self, data: dict) -> dict: + """Map old variable names to new variable names in the expected results data.""" + data_new_keys = {} + for key, val in data.items(): + if key in CONSTS["OLD_NEW_VAR_MAP"].keys(): + data_new_keys[CONSTS["OLD_NEW_VAR_MAP"][key]] = val + else: + data_new_keys[key] = val + return data_new_keys + + def after_intitialization_check(self) -> None: + """Run checks after initialization but before any run has been called. + + This is useful for checking the state of the model immediately after initialization, before any updates have occurred. + """ + self.compare(self.deserial_actual("init"), self.deserial_expected("init")) + + def compare(self, actual: dict, expected: dict) -> None: + """Compare actual vs expected results.""" + try: + assert_equal_with_tol( + expect=expected, actual=actual, new_keys_in_actual_ok=True + ) + except ExpectVsActualError as e: + raise RuntimeError( + f"Unexpected results compared to the expected results json: {e}" + ) from e + + @property + def test_class_as_dict(self) -> dict: + """Get the attributes of the test class as a dictionary, where the keys are the attribute names and the values are the attribute values. + + This is useful for serializing the test class to JSON for comparison against expected results. + """ + return class_to_dict(self.test_class) + + def after_bmi_model_update(self, current_output_step: int) -> None: + """Run checks after bmi_model.update() has been called. + + Args: + ---- + current_output_step: The current output step, which can be used to conditionally run different checks on the first step vs subsequent steps, since the first step behaves differently in some ways. + + """ + self.compare( + self.deserial_actual("after_update", f"_step_{current_output_step}"), + self.deserial_expected("after_update", f"_step_{current_output_step}"), + ) + + def after_finalize(self) -> None: + """Run checks after bmi_model.finalize() has been called.""" + self.compare( + self.deserial_actual("finalize"), self.deserial_expected("finalize") + ) + + def actual_results_file_path( + self, suffix: str, current_output_step: str = "" + ) -> str: + """Get the file path for the actual metadata results JSON file.""" + return f"{self.test_dir}/{self.actual_sub_dir}/test_actual_{self.test_file_name_prefix}_{suffix}_n{self.mpi_config.size}_rank{self.mpi_config.rank}_{current_output_step}.json" + + def expected_results_file_path( + self, suffix: str, current_output_step: str = "" + ) -> str: + """Get the file path for the expected metadata results JSON file.""" + return f"{self.test_dir}/{self.expected_sub_dir}/test_expected_{self.test_file_name_prefix}_{suffix}_n{self.mpi_config.size}_rank{self.mpi_config.rank}_{current_output_step}.json" + + +class BMIForcingFixture_GeoMod(BMIForcingFixture_Class): + """Test fixture for GeoMod tests.""" + + def __init__( + self, + bmi_model: NWMv3_Forcing_Engine_BMI_model, + keys_to_check: tuple = (), + ) -> None: + """Initialize BMIForcingFixture_GeoMod. + + Args: + ---- + bmi_model: the BMI model to be used in the test fixture + keys_to_chek: The keys to check + + """ + super().__init__( + bmi_model=bmi_model, + keys_to_check=keys_to_check, + ) + self.test_class = self.geo_meta + + self.test_file_name_prefix = "geomod" + + +class BMIForcingFixture_InputForcing(BMIForcingFixture_Class): + """Test fixture for InputForcing tests.""" + + def __init__( + self, + bmi_model: NWMv3_Forcing_Engine_BMI_model, + keys_to_check: tuple = (), + force_key: int = None, + map_old_to_new_var_names: bool = True, + ) -> None: + """Initialize BMIForcingFixture_InputForcing. + + Args: + ---- + bmi_model: the BMI model to be used in the test fixture + keys_to_chek: The keys to check + force_key: Key for the forcing type + map_old_to_new_var_names: whether to map old variable names to new variable names in the expected results data, which is needed when updating the test expected outputs dataset but should be false for regular test runs. + + """ + super().__init__( + bmi_model=bmi_model, + keys_to_check=keys_to_check, + map_old_to_new_var_names=map_old_to_new_var_names, + ) + self.force_key = force_key + self.test_class = self.input_forcing_mod[self.force_key] + self.test_file_name_prefix = "input_forcing" + + class BMIForcingFixture_Regrid(BMIForcingFixture): def __init__( self, @@ -108,19 +406,23 @@ def __init__( extra_attrs: tuple[ClassAttrFetcher], regrid_arrays_to_trim_extra_elements: tuple[str], keys_to_check: tuple[str], - ): + ) -> None: """Writers of regrid tests must call the methods in this order. This is enforced by state attributes. + self.pre_regrid() self.run_regrid() self.check_regrid_results() self.post_regrid() - Parameters: + Args: + ---- + bmi_model: the BMI model to be used in the test fixture regrid_func: The regrid function that is being tested. force_key: Should agree with the regrid function being tested, e.g. see ginputfunc.forcing_map extra_attrs: These are extra attributes to be added to the test results JSON, to supplement the primary InputForcings attributes. regrid_arrays_to_trim_extra_elements: These are output arrays which can contain extra unused elements which need to be removed during an equality check. keys_to_check: These are keys to include in the "expected" test results json, and are checked for equality versus "actual" results from regrid operation. + """ super().__init__(bmi_model=bmi_model) @@ -136,9 +438,11 @@ def __init__( self._state = None # Test fixture state used to help ensure things happen in the right order def cull_force_keys_not_used_this_test(self) -> None: - """Remove force keys that are not used during this test. For example, - Short Range contains 2 total force keys, one for HRRR and one for RAP, - but we only want to test one at a time, so remove the other one.""" + """Remove force keys that are not used during this test. + + For example, Short Range contains 2 total force keys, one for HRRR and one for RAP, + but we only want to test one at a time, so remove the other one. + """ tmp = {k: v for k, v in self.input_forcing_mod.items() if k == self.force_key} if len(tmp) != 1: raise ValueError( @@ -155,7 +459,7 @@ def cull_force_keys_not_used_this_test(self) -> None: @property def serialized_file_suffix(self) -> str: - """Suffix for the file name for expected test results""" + """Suffix for the file name for expected test results.""" gpkg_basename = os.path.splitext( os.path.basename(self.config_options.geopackage) )[0] @@ -185,7 +489,7 @@ def regrid_results_file_name_actual(self) -> str: return file_path def pre_regrid(self) -> None: - """Run various timing setup methods and preprocessing steps needed *before* each regrid call""" + """Run various timing setup methods and preprocessing steps needed *before* each regrid call.""" if self._state not in (None, "post_ran"): raise ValueError( f"In pre_regrid, expected state to be either None or 'post_ran' but got {repr(self._state)}. The test is set up incorrectly." @@ -193,7 +497,7 @@ def pre_regrid(self) -> None: config_options = self.config_options mpi_config = self.mpi_config - wrf_hydro_geo_meta = self.wrf_hydro_geo_meta + geo_meta = self.geo_meta supp_pcp_mod = self.bmi_model._supp_pcp_mod output_obj = self.bmi_model._output_obj input_forcing_mod = self.bmi_model._input_forcing_mod @@ -234,7 +538,7 @@ def pre_regrid(self) -> None: ( future_time, config_options, - wrf_hydro_geo_meta, + geo_meta, input_forcing_mod, supp_pcp_mod, mpi_config, @@ -243,7 +547,7 @@ def pre_regrid(self) -> None: ) = model.loop_through_forcing_products( future_time, config_options, - wrf_hydro_geo_meta, + geo_meta, input_forcing_mod, supp_pcp_mod, mpi_config, @@ -264,12 +568,13 @@ def set_input_forcings_skip_flags(self) -> None: def run_regrid(self, arg1: typing.Any) -> None: """Run the regrid function. - Parameters: - arg1 is the first argument to the regrid function, which can vary. + Args: + ---- + arg1: The first argument to the regrid function, which can vary. For example is may be `input_forcings`, or `supplemental_precip`, or potentially others. Subsequent arguments to the regrid function should be standard and do not need to be provided by the test caller. - """ + """ if self._state != "pre_ran": raise ValueError( f"In run_regrid, expected state to 'pre_ran' but got {repr(self._state)}. The test is set up incorrectly." @@ -280,9 +585,9 @@ def run_regrid(self, arg1: typing.Any) -> None: # out_file=f"tmp_regrid_inputs{self.serialized_file_suffix}.json", # sort_keys=True, # ) - # wrf_hydro_geo_meta_json_str = serialize_to_json( - # self.wrf_hydro_geo_meta, - # out_file=f"tmp_wrf_hydro_geo_meta{self.serialized_file_suffix}.json", + # geo_meta_json_str = serialize_to_json( + # self.geo_meta, + # out_file=f"tmp_geo_meta{self.serialized_file_suffix}.json", # sort_keys=True, # ) @@ -292,7 +597,7 @@ def run_regrid(self, arg1: typing.Any) -> None: self.regrid_func( arg1, config_options=self.config_options, - wrf_hydro_geo_meta=self.wrf_hydro_geo_meta, + wrf_hydro_geo_meta=self.geo_meta, mpi_config=self.mpi_config, ) logging.info(f"Done calling regrid function: {self.regrid_func.__name__}") @@ -303,6 +608,7 @@ def remove_extra_data_from_regrid_results( self, input_forcings: InputForcings ) -> dict: """Validate some high-level aspects of the InputForcings object, such as length and sequence of some arrays. + Then build a dictionary equivalent of it, and trim some of the arrays to the needed size for tests, and return that dictionary. Resulting output numerical arrays of regridding process may contain extra elements that are @@ -317,14 +623,19 @@ def remove_extra_data_from_regrid_results( We assert that this is the case by confirming that index 8 does not exist in `input_map_output`. Then we remove that element from the right end of `regridded_forcings1` and `regridded_forcings2`. - Parameters: - input_forcings is the InputForcings object immediately after a ESMF regridding has occurred. + Args: + ---- + input_forcings: The InputForcings object immediately after a ESMF regridding has occurred. Returns: + ------- A dictionary representation of input_forcings, but with some arrays trimmed and some keys dropped. + """ ### This is returned after being modified. - input_forcings_deserial = json.loads(serialize_to_json(input_forcings)) + input_forcings_deserial = json.loads( + serialize_to_json(class_to_dict(input_forcings)) + ) ### e.g. ['TMP_2maboveground', 'SPFH_2maboveground', 'UGRD_10maboveground', 'VGRD_10maboveground', 'APCP_surface', 'DSWRF_surface', 'DLWRF_surface', 'PRES_surface'] netcdf_var_names = input_forcings.netcdf_var_names ### e.g. ['TMP', 'SPFH', 'UGRD', 'VGRD', 'APCP', 'DSWRF', 'DLWRF', 'PRES'] @@ -412,12 +723,14 @@ def remove_extra_data_from_regrid_results( def check_regrid_results(self, input_forcings: InputForcings) -> None: """Check the regrid results against previously serialized expected results data, which should be in the repository. + Run this with a certain OS var to set up fresh test results expected data files. - Parameters: - input_forcings is the InputForcings object immediately after a ESMF regridding has occurred. - """ + Args: + ---- + input_forcings: The InputForcings object immediately after a ESMF regridding has occurred. + """ if self._state != "regrid_ran": raise ValueError( f"In check_regrid_results, expected state to 'regrid_ran' but got {repr(self._state)}. The test is set up incorrectly." @@ -497,7 +810,7 @@ def check_regrid_results(self, input_forcings: InputForcings) -> None: ) from e def post_regrid(self) -> None: - """Run various timing setup methods and postprocessing steps needed *after* each regrid call""" + """Run various timing setup methods and postprocessing steps needed *after* each regrid call.""" if self._state != "regrid_ran": raise ValueError( f"In post_regrid, expected state to 'regrid_ran' but got {repr(self._state)}. The test is set up incorrectly."