We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using the gwyfile Python package.
Export example from RHK .sm4:
from gwyfile.objects import GwyContainer, GwyDataField, GwySIUnit obj = GwyContainer() filename = 'VT210531_A1_0025.sm4' f = spym.load(filename) for i, ch in enumerate(f.data_vars): datarr = f[ch] si_units_xy = GwySIUnit() si_units_z = GwySIUnit() meta = GwyContainer() df = GwyDataField(datarr.values) si_units_xy['unitstr'] = datarr.attrs['RHK_Xunits'] si_units_z['unitstr'] = datarr.attrs['RHK_Zunits'] for k,v in datarr.attrs.items(): meta[k] = str(v) df['xres'] = datarr.attrs['RHK_Xsize'] df['yres'] = datarr.attrs['RHK_Ysize'] df['xreal'] = abs( datarr.attrs['RHK_Xscale'] * datarr.attrs['RHK_Xsize']) df['yreal'] = abs( datarr.attrs['RHK_Yscale'] * datarr.attrs['RHK_Ysize']) df['si_unit_xy'] = si_units_xy df['si_unit_z'] = si_units_z data_path = "/{}/data".format(i) meta_path = "/{}/meta".format(i) obj[data_path] = df obj[data_path+'/title'] = ch obj[meta_path] = meta if i==0: obj['/0/data/visible'] = True obj.tofile(filename+'.gwy')
The text was updated successfully, but these errors were encountered:
Import example:
from xarray import Dataset, DataArray import gwyfile import numpy as np filename = 'VT210531_A1_0032.sm4.gwy' obj = gwyfile.load(filename) ds = Dataset() i = 0 while True: data_path = "/{}/data".format(i) meta_path = "/{}/meta".format(i) try: name = obj[data_path+"/title"] except KeyError: break xres = obj[data_path]["xres"] yres = obj[data_path]["yres"] xreal = obj[data_path]["xreal"] yreal = obj[data_path]["yreal"] data = obj[data_path]["data"].reshape(xres, yres) attrs = dict(obj[meta_path]) for k,v in attrs.items(): if k in ["scaling_factor", "offset", "bias", "setpoint", "feedback_pgain", "scan_angle", "time_per_point"]: attrs[k] = float(v) coords = [("x", np.linspace(0.0, xreal, num=xres)), ("y", np.linspace(0.0, yreal, num=yres))] ds[name] = DataArray(data, coords=coords, attrs=attrs) i += 1
Sorry, something went wrong.
No branches or pull requests
Using the gwyfile Python package.
Export example from RHK .sm4:
The text was updated successfully, but these errors were encountered: