MCPcopy Create free account
hub / github.com/NCAR/wrf-python / extract_proj_params

Function extract_proj_params

test/utests.py:871–892  ·  view source on GitHub ↗
(wrfnc, timeidx=0)

Source from the content-addressed store, hash-verified

869
870
871def extract_proj_params(wrfnc, timeidx=0):
872 attrs = extract_global_attrs(wrfnc, ("MAP_PROJ", "TRUELAT1", "TRUELAT2",
873 "STAND_LON", "POLE_LAT", "POLE_LON",
874 "DX", "DY"))
875
876 result = {key.lower(): val for key, val in viewitems(attrs)}
877
878 _timeidx = timeidx
879 if is_multi_file(wrfnc):
880 wrfnc0 = wrfnc[0]
881 num_times_per_file = len(wrfnc0.dimensions["Time"])
882 file_idx = timeidx // num_times_per_file
883 _timeidx = timeidx % num_times_per_file
884
885 wrfnc = wrfnc[file_idx]
886
887 result["known_x"] = 0
888 result["known_y"] = 0
889 result["ref_lat"] = wrfnc.variables["XLAT"][_timeidx, 0, 0]
890 result["ref_lon"] = wrfnc.variables["XLONG"][_timeidx, 0, 0]
891
892 return result
893
894
895def make_latlon_test(testid, dir, pattern, referent, single,

Callers 1

testFunction · 0.85

Calls 3

extract_global_attrsFunction · 0.90
viewitemsFunction · 0.90
is_multi_fileFunction · 0.90

Tested by

no test coverage detected