Skip to content

Commit 89926cc

Browse files
committed
Improve messaging when NSRDB Data Query fails
1 parent 6682fe4 commit 89926cc

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

deploy/runtime/ui/Solar Resource Download.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,8 @@
698698
"\trefresh();\r",
699699
"}\r",
700700
"\r",
701+
"// NSRDB Download Functions Start Here //////\r",
702+
"\r",
701703
"// check JSON returned by a call to NSRDB Data Query for a valid response\r",
702704
"function nsrdb_query_json_check( json_str ) {\r",
703705
"\tvar = json_read( json_str );\r",
@@ -725,14 +727,14 @@
725727
"\t\t\t\tif ( strpos( lower(var.code), 'api' ) > -1 ) { msg += 'See private.h to set API keys.'; }\r",
726728
"\t\t\t}\t\r",
727729
"\t\t}\r",
728-
"\t\t// some locations are not covered by the NSRDB, e.g., Anchorage AK\r",
730+
"\t\t// some locations are not covered by the NSRDB\r",
729731
"\t\tif ( var.outputs == null ) {\r",
730732
"\t\t\tjson_ok = false;\r",
731-
"\t\t\tmsg += 'NSRDB Data Query returns no data (outputs = null).\\n\\nSee https://sam.nrel.gov/weather for links to other data sources.\\n';\r",
733+
"\t\t\tmsg += 'NSRDB Data Query returns no data (outputs = null) for this location.\\n\\nSee https://sam.nrel.gov/weather for links to other data sources.\\n';\r",
732734
"\t\t}\r",
733735
"\t\telseif ( var.outputs == [] ) {\r",
734736
"\t\t\tjson_ok = false;\r",
735-
"\t\t\tmsg += 'NSRDB Data Query returns no data (outputs = []).\\n\\nSee https://sam.nrel.gov/weather for links to other data sources.\\n';\r",
737+
"\t\t\tmsg += 'NSRDB Data Query returns no data (outputs = []) for this location.\\n\\nSee https://sam.nrel.gov/weather for links to other data sources.\\n';\r",
736738
"\t\t}\r",
737739
"\t}\r",
738740
"\t// NSRDB API service could be down\r",
@@ -892,6 +894,7 @@
892894
"\t}\r",
893895
"\tok_test = ( lat != null && lon != null && dataset_ok == true );\r",
894896
"\t//msgbox('Debug\\nok_test = ' + ok_test + '\\nlat = ' + lat\t+ '\\nlon = ' + lon + '\\ndataset_ok = ' + dataset_ok );\r",
897+
"\t//msgbox('Debug\\nmsg = ' + msg);\r",
895898
"\treturn { 'name' = name , 'msg' = msg , 'url' = url, 'years' = years , 'ok' = ok_test };\r",
896899
"}\r",
897900
"\r",
@@ -993,9 +996,11 @@
993996
"\t\twrite_line( flog, 'Location ' + to_string(n+1) + ' of ' + #coordinate_list + ': ' + coordinate_list[n] + '');\r",
994997
"\t\twrite_line( flog, '----------------------------------------------------------\\n');\t\r",
995998
"\t\tdataset[n] = nsrdb_query( lat, lon, download_option == TMY );\r",
999+
"\t\t//msgbox('Debug\\ndataset[n] = ' + dataset[n]);\r",
9961000
"\t\tif ( !dataset[n].ok ) {\r",
9971001
"\t\t\twrite_line( flog, dataset[n].msg + '\\n');\r",
998-
"\t\t\tprogressbar(pb, {'message' = dataset[n].msg, 'value'= pb_count});\r",
1002+
"\t\t\tprogressbar(pb, {'message' = 'NSRDB Data Query failed.', 'value'= pb_count});\r",
1003+
"\t\t\tmsgbox('NSRDB Data Query Failed.\\n' + dataset[n].msg);\r",
9991004
"\t\t\tcontinue;\r",
10001005
"\t\t}\t\r",
10011006
"\t\tif ( download_option == TMY ) { // this needs to work for both nsrdb-GOES-tmy-v4-0-0 and suny-india-tmy\r",

0 commit comments

Comments
 (0)