Skip to content

Commit

Permalink
Merge pull request #15 from umr-lops/fix_nano_seconds_warnings
Browse files Browse the repository at this point in the history
precision nano seconds for the np.datetime64 values
  • Loading branch information
agrouaze authored Jun 13, 2023
2 parents e761476 + 93d8179 commit 15e4ffe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/xradarsat2/radarSat2_xarray_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def get_dic_orbit_information(dictio):
ds_attr[key] = content_dict[key]
elif isinstance(content_dict[key], list):
for value in content_dict[key]:
timestamp.append(np.datetime64(value["timeStamp"]))
timestamp.append(np.datetime64(value["timeStamp"]).astype("datetime64[ns]"))
xPosition["values"].append(float(value["xPosition"]["#text"]))
xPosition["attr"]["units"] = value["xPosition"]["@units"]
yPosition["values"].append(float(value["yPosition"]["#text"]))
Expand Down Expand Up @@ -459,7 +459,7 @@ def get_dic_attitude_info(dictio):
ds_attr[key] = content_dict[key]
elif isinstance(content_dict[key], list):
for value in content_dict[key]:
timestamp.append(np.datetime64(value["timeStamp"]))
timestamp.append(np.datetime64(value["timeStamp"]).astype("datetime64[ns]"))
yaw["values"].append(float(value["yaw"]["#text"]))
yaw["attr"]["units"] = value["yaw"]["@units"]
roll["values"].append(float(value["roll"]["#text"]))
Expand Down Expand Up @@ -567,7 +567,7 @@ def get_dict_doppler_centroid(dictio):
if key == "dopplerCentroid":
xpath = os.path.join(xpath, key)
for value in content_dict[key]:
times.append(np.datetime64(value["timeOfDopplerCentroidEstimate"]))
times.append(np.datetime64(value["timeOfDopplerCentroidEstimate"]).astype("datetime64[ns]"))
Ambiguity["values"].append(int(value["dopplerAmbiguity"]))
Ambiguity["attr"]["xpath"] = os.path.join(xpath, "dopplerAmbiguity")
AmbiguityConfidence["values"].append(
Expand Down Expand Up @@ -2053,7 +2053,7 @@ def get_product_attributes(dic):
else:
if isinstance(dic[key], str) and key in useful_attributes:
if "Time" in key:
final_dic[key] = np.datetime64(dic[key])
final_dic[key] = np.datetime64(dic[key]).astype("datetime64[ns]")
else:
final_dic[key] = dic[key]
return final_dic
Expand Down

0 comments on commit 15e4ffe

Please sign in to comment.