Re: [arts-users] sensor_time definition through PyARTS

2021-02-16 Thread eric.sauvageat
Dear Richard,


Thanks for the detailed explanation.


I used the following line as a workaround for now and it seems to work fine.

ws.timeNow()
ws.ArrayOfTimeSetConstant(ws.sensor_time, 1, ws.time)


No stress then but I am looking forward to your new implementation.


Thanks again and best regards,
Eric



De : Richard Larsson 
Envoyé : mardi 16 février 2021 16:26:49
À : Patrick Eriksson
Cc : Sauvageat, Eric (IAP); arts_users...@mailman.rrz.uni-hamburg.de
Objet : Re: [arts-users] sensor_time definition through PyARTS

Hi,

This is my fault.  Explanation if wanted:  sensor_time is now a different type. 
 It now stores actual time stamps like "1970-01-01 01:00:01" (which is what "1" 
means in time stamps if you are in CET).

I will fix it so you can set the time from a numpy array again in pyarts.  
However, I don't understand the workspace interactions all that well.  The 
solution you will have to use before that is fixed will look like this:

pyarts.classes.from_workspace(ws.sensor_time).data = np.array([1])
or
pyarts.classes.from_workspace(ws.sensor_time).data = [1]
or
pyarts.classes.from_workspace(ws.sensor_time).data = ["2021-02-16 16:19:00"]

I am committing code for this shortly and it should be updated and merged soon.

Note that you have reading/writing routines for all ARTS variables via the 
"pyarts.classes.from_workspace(x).savexml("filename.xml")" interface.  In 
addition about the new type for time, using 
pyarts.classes.Time.TimeGrid(pyarts.classes.from_workspace(ws.sensor_time)), 
you will be able to use matplotlib's time-series plotting features if you are 
so inclined.

I hope we can find a way so that when there are no explicit workspace methods, 
then the fall-back is to use the pyarts.classes interface but my python is not 
that good to fix this myself.

Anyways, please give it a day or so for the code to do the above to be merged 
before updating the development branch and you should have vector-interaction 
back.

With hope,
//Richard

Den tis 16 feb. 2021 kl 15:05 skrev Patrick Eriksson 
mailto:patrick.eriks...@chalmers.se>>:
Hi,

There is the same/similar problem on the Matlab side (as there is no
writing and reading of xml-files including the time group).

So a general hint for all. If you just want to set sensor_time to some
value, you can do this by these method calls

timeNow
ArrayOfTimeSetConstant( sensor_time, 1, time )

Bye,

Patrick


On 2021-02-16 14:53, 
eric.sauvag...@iap.unibe.ch wrote:
> Dear ARTS community,
>
>
> In order to try a recent fix suggested and implemented (commit n.
> 5951a72fbef6d7ac9a3de8d2c503b58ef5af7d17, fromTyphon mailing list) on
> the development version of ARTS I came into another problem trying to
> implement my ground-based retrievals through PyARTS. In fact, I can't
> succeed anymore in setting the sensor_time variable through PyARTS,
> which is then required to perform the retrievals.
>
>
> I'm not sure if something got mixed maybe between the 2 ARTS version
> installed on my laptop and the 2 attached PyARTS versions (each in a
> separate conda env) or if this is really a bug from the development
> version.
>
>
> As a very short example, please find below a minimalist python script
> that reproduces the problem. It seems to work fine if I use ARTS2.4 and
> produces the following error with ARTS Dev version:
>
>
>
> ###
> import os
> import numpy as np
> import xarray as xr
> import matplotlib.pyplot as plt
>
> from pyarts.workspace import Workspace, arts_agenda
> from dotenv import load_dotenv
>
> #load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.5')
> load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.4')
> ARTS_DATA_PATH = os.environ['ARTS_DATA_PATH']
> ARTS_BUILD_PATH = os.environ['ARTS_BUILD_PATH']
> ARTS_INCLUDE_PATH = os.environ['ARTS_INCLUDE_PATH']
>
> def test_sensor():
>  # Initializing Workspace object
>  ws = Workspace(verbosity=0, agenda_verbosity=0)
>  ws.execute_controlfile("general/general.arts")
>  ws.execute_controlfile("general/agendas.arts")
>  ws.execute_controlfile("general/continua.arts")
>  ws.execute_controlfile("general/planet_earth.arts")
>
>  ws.sensor_los = np.array([50])
>  ws.sensor_pos = np.array([1e3])
>  ws.sensor_time =  np.array([1])
>
>  print('sensor_time is :', ws.sensor_time.value)
>
> if __name__=="__main__":
>  test_sensor()
>
> ###
>
>
>
> ___
> arts_users.mi mailing list
> arts_users.mi@lists.uni-hamburg.de
> https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi
>
___
arts_users.mi mailing list
arts_users.mi@lists.uni-hamburg.de

Re: [arts-users] sensor_time definition through PyARTS

2021-02-16 Thread Richard Larsson
Hi,

This is my fault.  Explanation if wanted:  sensor_time is now a different
type.  It now stores actual time stamps like "1970-01-01 01:00:01" (which
is what "1" means in time stamps if you are in CET).

I will fix it so you can set the time from a numpy array again in pyarts.
However, I don't understand the workspace interactions all that well.  The
solution you will have to use before that is fixed will look like this:

pyarts.classes.from_workspace(ws.sensor_time).data = np.array([1])
or
pyarts.classes.from_workspace(ws.sensor_time).data = [1]
or
pyarts.classes.from_workspace(ws.sensor_time).data = ["2021-02-16 16:19:00"]

I am committing code for this shortly and it should be updated and merged
soon.

Note that you have reading/writing routines for all ARTS variables via the
"pyarts.classes.from_workspace(x).savexml("filename.xml")" interface.  In
addition about the new type for time, using
pyarts.classes.Time.TimeGrid(pyarts.classes.from_workspace(ws.sensor_time)),
you will be able to use matplotlib's time-series plotting features if you
are so inclined.

I hope we can find a way so that when there are no explicit workspace
methods, then the fall-back is to use the pyarts.classes interface but my
python is not that good to fix this myself.

Anyways, please give it a day or so for the code to do the above to be
merged before updating the development branch and you should have
vector-interaction back.

With hope,
//Richard

Den tis 16 feb. 2021 kl 15:05 skrev Patrick Eriksson <
patrick.eriks...@chalmers.se>:

> Hi,
>
> There is the same/similar problem on the Matlab side (as there is no
> writing and reading of xml-files including the time group).
>
> So a general hint for all. If you just want to set sensor_time to some
> value, you can do this by these method calls
>
> timeNow
> ArrayOfTimeSetConstant( sensor_time, 1, time )
>
> Bye,
>
> Patrick
>
>
> On 2021-02-16 14:53, eric.sauvag...@iap.unibe.ch wrote:
> > Dear ARTS community,
> >
> >
> > In order to try a recent fix suggested and implemented (commit n.
> > 5951a72fbef6d7ac9a3de8d2c503b58ef5af7d17, fromTyphon mailing list) on
> > the development version of ARTS I came into another problem trying to
> > implement my ground-based retrievals through PyARTS. In fact, I can't
> > succeed anymore in setting the sensor_time variable through PyARTS,
> > which is then required to perform the retrievals.
> >
> >
> > I'm not sure if something got mixed maybe between the 2 ARTS version
> > installed on my laptop and the 2 attached PyARTS versions (each in a
> > separate conda env) or if this is really a bug from the development
> > version.
> >
> >
> > As a very short example, please find below a minimalist python script
> > that reproduces the problem. It seems to work fine if I use ARTS2.4 and
> > produces the following error with ARTS Dev version:
> >
> >
> >
> >
> ###
> > import os
> > import numpy as np
> > import xarray as xr
> > import matplotlib.pyplot as plt
> >
> > from pyarts.workspace import Workspace, arts_agenda
> > from dotenv import load_dotenv
> >
> >
> #load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.5')
> >
> load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.4')
> > ARTS_DATA_PATH = os.environ['ARTS_DATA_PATH']
> > ARTS_BUILD_PATH = os.environ['ARTS_BUILD_PATH']
> > ARTS_INCLUDE_PATH = os.environ['ARTS_INCLUDE_PATH']
> >
> > def test_sensor():
> >  # Initializing Workspace object
> >  ws = Workspace(verbosity=0, agenda_verbosity=0)
> >  ws.execute_controlfile("general/general.arts")
> >  ws.execute_controlfile("general/agendas.arts")
> >  ws.execute_controlfile("general/continua.arts")
> >  ws.execute_controlfile("general/planet_earth.arts")
> >
> >  ws.sensor_los = np.array([50])
> >  ws.sensor_pos = np.array([1e3])
> >  ws.sensor_time =  np.array([1])
> >
> >  print('sensor_time is :', ws.sensor_time.value)
> >
> > if __name__=="__main__":
> >  test_sensor()
> >
> >
> ###
> >
> >
> >
> > ___
> > arts_users.mi mailing list
> > arts_users.mi@lists.uni-hamburg.de
> > https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi
> >
> ___
> arts_users.mi mailing list
> arts_users.mi@lists.uni-hamburg.de
> https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi
>
___
arts_users.mi mailing list
arts_users.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi


Re: [arts-users] sensor_time definition through PyARTS

2021-02-16 Thread eric.sauvageat

Dear Patrick,


Thanks a lot for the quick answer.

It seems indeed to define the sensor_time correctly in an ARTS file using your 
2 lines.


On the PyARTS side, it seems that the defintion of ws.sensor_time is fine as 
well but I can't access its value ("ws.sensor_time.value" fails, but not sure 
if this is really something I need to do). It seems to me that this is related 
to the lack of writing/reading routine for the time group as you mentionned 
which might be corrected in the future so I believe this should be fine for now.


Thanks again,

Eric




De : Patrick Eriksson 
Envoyé : mardi 16 février 2021 15:04:59
À : Sauvageat, Eric (IAP); arts_users...@mailman.rrz.uni-hamburg.de
Objet : Re: [arts-users] sensor_time definition through PyARTS

Hi,

There is the same/similar problem on the Matlab side (as there is no
writing and reading of xml-files including the time group).

So a general hint for all. If you just want to set sensor_time to some
value, you can do this by these method calls

timeNow
ArrayOfTimeSetConstant( sensor_time, 1, time )

Bye,

Patrick


On 2021-02-16 14:53, eric.sauvag...@iap.unibe.ch wrote:
> Dear ARTS community,
>
>
> In order to try a recent fix suggested and implemented (commit n.
> 5951a72fbef6d7ac9a3de8d2c503b58ef5af7d17, fromTyphon mailing list) on
> the development version of ARTS I came into another problem trying to
> implement my ground-based retrievals through PyARTS. In fact, I can't
> succeed anymore in setting the sensor_time variable through PyARTS,
> which is then required to perform the retrievals.
>
>
> I'm not sure if something got mixed maybe between the 2 ARTS version
> installed on my laptop and the 2 attached PyARTS versions (each in a
> separate conda env) or if this is really a bug from the development
> version.
>
>
> As a very short example, please find below a minimalist python script
> that reproduces the problem. It seems to work fine if I use ARTS2.4 and
> produces the following error with ARTS Dev version:
>
>
>
> ###
> import os
> import numpy as np
> import xarray as xr
> import matplotlib.pyplot as plt
>
> from pyarts.workspace import Workspace, arts_agenda
> from dotenv import load_dotenv
>
> #load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.5')
> load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.4')
> ARTS_DATA_PATH = os.environ['ARTS_DATA_PATH']
> ARTS_BUILD_PATH = os.environ['ARTS_BUILD_PATH']
> ARTS_INCLUDE_PATH = os.environ['ARTS_INCLUDE_PATH']
>
> def test_sensor():
>  # Initializing Workspace object
>  ws = Workspace(verbosity=0, agenda_verbosity=0)
>  ws.execute_controlfile("general/general.arts")
>  ws.execute_controlfile("general/agendas.arts")
>  ws.execute_controlfile("general/continua.arts")
>  ws.execute_controlfile("general/planet_earth.arts")
>
>  ws.sensor_los = np.array([50])
>  ws.sensor_pos = np.array([1e3])
>  ws.sensor_time =  np.array([1])
>
>  print('sensor_time is :', ws.sensor_time.value)
>
> if __name__=="__main__":
>  test_sensor()
>
> ###
>
>
>
> ___
> arts_users.mi mailing list
> arts_users.mi@lists.uni-hamburg.de
> https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi
>
___
arts_users.mi mailing list
arts_users.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi


Re: [arts-users] sensor_time definition through PyARTS

2021-02-16 Thread Patrick Eriksson

Hi,

There is the same/similar problem on the Matlab side (as there is no 
writing and reading of xml-files including the time group).


So a general hint for all. If you just want to set sensor_time to some 
value, you can do this by these method calls


timeNow
ArrayOfTimeSetConstant( sensor_time, 1, time )

Bye,

Patrick


On 2021-02-16 14:53, eric.sauvag...@iap.unibe.ch wrote:

Dear ARTS community,


In order to try a recent fix suggested and implemented (commit n. 
5951a72fbef6d7ac9a3de8d2c503b58ef5af7d17, fromTyphon mailing list) on 
the development version of ARTS I came into another problem trying to 
implement my ground-based retrievals through PyARTS. In fact, I can't 
succeed anymore in setting the sensor_time variable through PyARTS, 
which is then required to perform the retrievals.



I'm not sure if something got mixed maybe between the 2 ARTS version 
installed on my laptop and the 2 attached PyARTS versions (each in a 
separate conda env) or if this is really a bug from the development 
version.



As a very short example, please find below a minimalist python script 
that reproduces the problem. It seems to work fine if I use ARTS2.4 and 
produces the following error with ARTS Dev version:




###
import os
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt

from pyarts.workspace import Workspace, arts_agenda
from dotenv import load_dotenv

#load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.5')
load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.4')
ARTS_DATA_PATH = os.environ['ARTS_DATA_PATH']
ARTS_BUILD_PATH = os.environ['ARTS_BUILD_PATH']
ARTS_INCLUDE_PATH = os.environ['ARTS_INCLUDE_PATH']

def test_sensor():
     # Initializing Workspace object
     ws = Workspace(verbosity=0, agenda_verbosity=0)
     ws.execute_controlfile("general/general.arts")
     ws.execute_controlfile("general/agendas.arts")
     ws.execute_controlfile("general/continua.arts")
     ws.execute_controlfile("general/planet_earth.arts")

     ws.sensor_los = np.array([50])
     ws.sensor_pos = np.array([1e3])
     ws.sensor_time =  np.array([1])

     print('sensor_time is :', ws.sensor_time.value)

if __name__=="__main__":
     test_sensor()

###



___
arts_users.mi mailing list
arts_users.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi


___
arts_users.mi mailing list
arts_users.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi


[arts-users] sensor_time definition through PyARTS

2021-02-16 Thread eric.sauvageat
Dear ARTS community,


In order to try a recent fix suggested and implemented (commit n. 
5951a72fbef6d7ac9a3de8d2c503b58ef5af7d17, fromTyphon mailing list) on the 
development version of ARTS I came into another problem trying to implement my 
ground-based retrievals through PyARTS. In fact, I can't succeed anymore in 
setting the sensor_time variable through PyARTS, which is then required to 
perform the retrievals.


I'm not sure if something got mixed maybe between the 2 ARTS version installed 
on my laptop and the 2 attached PyARTS versions (each in a separate conda env) 
or if this is really a bug from the development version.


As a very short example, please find below a minimalist python script that 
reproduces the problem. It seems to work fine if I use ARTS2.4 and produces the 
following error with ARTS Dev version:


###
import os
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt

from pyarts.workspace import Workspace, arts_agenda
from dotenv import load_dotenv

#load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.5')
load_dotenv('/home/eric/Documents/PhD/ARTS/arts-examples/.env.t490-arts2.4')
ARTS_DATA_PATH = os.environ['ARTS_DATA_PATH']
ARTS_BUILD_PATH = os.environ['ARTS_BUILD_PATH']
ARTS_INCLUDE_PATH = os.environ['ARTS_INCLUDE_PATH']

def test_sensor():
# Initializing Workspace object
ws = Workspace(verbosity=0, agenda_verbosity=0)
ws.execute_controlfile("general/general.arts")
ws.execute_controlfile("general/agendas.arts")
ws.execute_controlfile("general/continua.arts")
ws.execute_controlfile("general/planet_earth.arts")

ws.sensor_los = np.array([50])
ws.sensor_pos = np.array([1e3])
ws.sensor_time =  np.array([1])

print('sensor_time is :', ws.sensor_time.value)

if __name__=="__main__":
test_sensor()


###

___
arts_users.mi mailing list
arts_users.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi