Hi Frank, I'm sorry, after reading Michael's mail, I jumped to the conclusion that you're also using the latest version of ARTS. In version 2.4 things are of course very different. :-)
Due to some limitations in that version, you need to save the created antenna response to a file and then read it back into the antenna_response workspace variable. Here is the code for 2.4: ------------------- import numpy as np import pyarts ant = pyarts.classes.GriddedField4() ant.gridnames = ["Polarisation", "Frequency", "Zenith angle", "Azimuth angle"] ant.grids = [ pyarts.classes.ArrayOfString(["NaN"]), # Polarisation grid pyarts.classes.Vector([-999.]), # Frequency grid pyarts.classes.Vector(np.linspace(-1.91097, 1.91097, 61)), # Zenith angle grid pyarts.classes.Vector([0.]) # Azimuth angle grid ] ant.data = np.array( [[[[0.00260905], [0.00350429], [0.00465987], [0.00613486], [0.00799636], [0.010319], [0.01318377], [0.01667627], [0.02088407], [0.02589336], [0.03178475], [0.03862836], [0.04647835], [0.05536716], [0.06529965], [0.07624766], [0.08814531], [0.10088555], [0.1143183], [0.12825067], [0.14244938], [0.15664572], [0.17054287], [0.18382546], [0.19617099], [0.20726262], [0.21680248], [0.22452492], [0.23020879], [0.23368795], [0.23485932], [0.23368795], [0.23020879], [0.22452492], [0.21680248], [0.20726262], [0.19617099], [0.18382546], [0.17054287], [0.15664572], [0.14244938], [0.12825067], [0.1143183], [0.10088555], [0.08814531], [0.07624766], [0.06529965], [0.05536716], [0.04647835], [0.03862836], [0.03178475], [0.02589336], [0.02088407], [0.01667627], [0.01318377], [0.010319], [0.00799636], [0.00613486], [0.00465987], [0.00350429], [0.00260905]]]]) ant.savexml("antenna_response.xml") ws = pyarts.workspace.Workspace() ws.ReadXML(ws.antenna_response, "antenna_response.xml") print(ws.antenna_response.value) ------------------- Cheers, Oliver > On 19 Oct 2022, at 00:31, Werner, Frank (329D) <frank.wer...@jpl.nasa.gov> > wrote: > > Hi Oliver, > > Thanks for your quick response! For now I simply tried to run your code > examples to see whether they work. Unfortunately, I couldn’t get either of > your suggestions to run. > > The first one, where I change an already existing antenna response, give me > the following error: > >>> > ws.antenna_response.value.set_grid(ws.antenna_response.value.gridnames.index("Zenith > angle"), np.linspace(-2, 2, 61)) > - WriteXML > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'GriddedField4' object has no attribute > 'set_grid' > > The second example, where I set up a Gridded field myself, doesn’t run > because the compiler complains that: > "AttributeError: module 'pyarts' has no attribute 'arts' " > > Indeed, if I go to this directory: > '~/.conda/envs/fwerner-env/lib/python3.9/site-packages/pyarts/' > And check it's content, there is no 'arts.py' script in there. There is one > in the 'utilities' subdirectory, but this one doesn't work either. There is a > 'griddedfield.py' script, but this one does not get included in > '__init__.py'... > > FYI, I've been using the stable 2.4 version and pyarts has worked great for > me. This is the first time I am running into trouble. > > Any advice? Thanks again for your help and best wishes, > Frank
smime.p7s
Description: S/MIME cryptographic signature