Re: [arts-users] Write single scattering properties for ARTS with typhon

2019-11-18 Thread Oliver Lemke
Hi Frank,

To initialize the SSD from a dictionary, you can use the from_data classmethod. 
Also note that using integer numbers for ptype is obsolete, they have been 
replaced by strings ("general", "totally_random", "azimuthally_random" for 
version 3 of the SSD).

Here's an example with data dimensions adjusted for the azimuthally random case:

import typhon
import numpy as np

params = {'f_grid': [1740.0, 2100.0],
  'T_grid': [190, 200, 210, 220.0, 230],
  'za_grid': [0,  10,  20,  30,  40,  50,  60,  70,  80,  90, 100, 110, 
120, 130, 140, 150, 160, 170, 180],
  'aa_grid': [0,  10,  20,  30,  40,  50,  60,  70,  80,  90, 100, 110, 
120, 130, 140, 150, 160, 170, 180],
  'aspect_ratio': 1.5,
  'NP': -1, 'precision': .001,
  'phase': 'ice',
  'ptype': 'azimuthally_random',
  'equiv_radius': 100}

scatt_data = typhon.arts.scattering.SingleScatteringData.from_data(params)
scatt_data.pha_mat_data = np.zeros(
(len(params['f_grid']), len(params['T_grid']),
 len(params['za_grid']), len(params['aa_grid']), len(params['za_grid']), 1, 
16))
scatt_data.ext_mat_data = np.zeros(
(len(params['f_grid']), len(params['T_grid']),
 len(params['za_grid']), 1, 3))
scatt_data.abs_vec_data = np.zeros(
(len(params['f_grid']), len(params['T_grid']),
 len(params['za_grid']), 1, 2))

typhon.arts.xml.save(scatt_data, 'scattering.xml')


Cheers,
Oliver


> On 15. Nov 2019, at 19:31, Werner, Frank (329D)  
> wrote:
> 
> Hi all,
>  
> For some ARTS runs including scattering by cirrus I am trying to create and 
> write single scattering properties with the module ‘SingleScatteringData’ 
> from the typhon package. Unfortunately, I cannot seem to get the syntax right 
> (just calculating the data, not even writing it into an xml file). A very 
> simple example would be highly appreciated. Here is what I tried to do:
>  
> import typhon 
> params = {'f_grid':[1740.0, 2100.0],'T_grid':[190,200,210, 
> 220.0,230],
> 'za_grid':[0,  10,  20,  30,  40,  50,  60,  70,  80,  90, 100, 110, 120, 
> 130, 140, 150, 160, 170, 180],
> 'aa_grid':[0,  10,  20,  30,  40,  50,  60,  70,  80,  90, 100, 110, 120, 
> 130, 140, 150, 160, 170, 180],
> 'aspect_ratio':1.5,'NP':-1,'precision':.001,'phase':'ice','ptype':30,'equiv_radius':100}
>  
> scatt_data  = typhon.arts.scattering.SingleScatteringData (params)
>  
> This yields the error:
>  
> ‘TypeError: __init__() takes 1 positional argument but 2 were given’. This is 
> probably a trivial issue; the possible parameters are described in the user 
> manual. I just cannot seem to invoke the function correctly.
>  
> Thanks for your help and best wishes,
> Frank
>  
> -- 
> Frank Werner
> Mail Stop 183-701, Jet Propulsion Laboratory
> 4800 Oak Grove Drive, Pasadena, California 91109, United States
> Phone: +1 818 354-1918
> Fax: +1 818 393 5065
> ___
> 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] Write single scattering properties for ARTS with typhon

2019-11-17 Thread Werner, Frank (329D)
Hi all,

For some ARTS runs including scattering by cirrus I am trying to create and 
write single scattering properties with the module ‘SingleScatteringData’ from 
the typhon package. Unfortunately, I cannot seem to get the syntax right (just 
calculating the data, not even writing it into an xml file). A very simple 
example would be highly appreciated. Here is what I tried to do:

import typhon
params = {'f_grid':[1740.0, 2100.0],'T_grid':[190,200,210, 
220.0,230],
'za_grid':[0,  10,  20,  30,  40,  50,  60,  70,  80,  90, 100, 110, 120, 130, 
140, 150, 160, 170, 180],
'aa_grid':[0,  10,  20,  30,  40,  50,  60,  70,  80,  90, 100, 110, 120, 130, 
140, 150, 160, 170, 180],
'aspect_ratio':1.5,'NP':-1,'precision':.001,'phase':'ice','ptype':30,'equiv_radius':100}

scatt_data  = typhon.arts.scattering.SingleScatteringData (params)

This yields the error:

‘TypeError: __init__() takes 1 positional argument but 2 were given’. This is 
probably a trivial issue; the possible parameters are described in the user 
manual. I just cannot seem to invoke the function correctly.

Thanks for your help and best wishes,
Frank

--
Frank Werner
Mail Stop 183-701, Jet Propulsion Laboratory
4800 Oak Grove Drive, Pasadena, California 91109, United States
Phone: +1 818 354-1918
Fax: +1 818 393 5065
___
arts_users.mi mailing list
arts_users.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi