Re: [arts-users] scat_meta_single to scat_meta

2023-02-15 Thread Galligani

Hello!

Perfect. I adapted everything to use only the bulk approach. Thanks for 
the help.


Cheers,
Vito

On 03.02.2023 04:08, Patrick Eriksson wrote:

Vito,

Sorry, but partly filling pnd_field manually and partly filling it by
using the PSD methods will likely never work. At least this deviates
from how ARTS is designed. There are two main options here:

1: To fill pnd_field "manually". But this is likely more easily done
outside of ARTS.
2: To do all byparticle_bulkprop_field and PSD methods

If you explain what you want to do, it would be easier to give advice.
It would also be helpful to know if you use Matlab or Python?

Bye,

Patrick


On 2023-02-02 15:04, Galligani wrote:

Hello !

Yes, for example this:

ReadXML( pnd_field, "hail_pnddata1.xml" )
Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)

# RWC
ScatSpeciesSizeMassInfo( species_index=5, x_unit="dveq" )
Copy( psd_size_grid, scat_species_x )
Copy( pnd_size_grid, scat_species_x )
psdModifiedGammaMass( n0=8e6, mu=0, la=-999, ga=1, t_min = 230, t_max 
= 999 )

pndFromPsdBasic

# append pnd_data to pnd_field? For example I tried:
Append( pnd_field, pnd_data)

and I get:

Workspace variable belongs to the wrong group:
pnd_data is not Tensor3, it is Matrix

If I comment that out I've also realized that my psdModifiedGammaMass 
method also fails:


Method psdModifiedGammaMass needs input variable: pnd_agenda_input_t

Is it even possible to call this method outside the pnd_agenda_array? 
This open another question: Can I call a pnd_agenda_array only for RWC 
and not the other hail species?


I'm running into many errors in everything I tried.

Thanks for the time!

On 02.02.2023 03:15, Patrick Eriksson wrote:

Vito,

Can you explain how it failed?

Bye,

Patrick

On 2023-02-01 16:34, Galligani wrote:

Hi Patrick! Thanks that worked out!

I'm now running a Frankeinstein of code with pnd_data saved outside 
ARTS for different hail species, and using the ARTS 
psdModifiedGammaMass. Basically I'm trying to append the RWC 
pnd_data from


psdModifiedGammaMass
pndFromPsdBasic

to the pnd_field from the previous estructure:

i.e.,

ReadXML( pnd_field, "hail_pnddata1.xml" )

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)

etc. It this possible? All my attempts have failed.

Thank you!
Vito


On 25.01.2023 19:15, Patrick Eriksson wrote:

Vito,

scat_data and scat_data_raw are of type
ArrayOfArrayOfSingleScatteringData. The first Array dimension 
matches
scat_species and the second one size. So you need multiple Append 
to

scat_data_raw and scat_meta.

If I get it right, you should do this for each habit:

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" 
)
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" 
)

Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)
Append(scat_species, species_id_string )

Delete(scat_data_1habit)  # To remove appended data
Delete(scat_meta_1habit)

The creation of pnd_field looks fine, if I remember correctly how
works for appending a Tensor4 to a Tensor4.

Bye,

Patrick


On 2023-01-24 16:08, Galligani wrote:

Hello everyone,

I re-open this question because I am adding species to my 
simulations now (before I was running with only one species)


I've run into the following error:

'Number of scattering species specified by scat_species does
not agree with number of scattering species in scat_data:
scat_species has 5 entries, while scat_data has 1.
Stopping ARTS execution.
Goodbye.'

I have 5 different species. This is essentially what my code is 
doing (I will show only two of the species)


ArrayOfScatteringMetaDataCreate( scat_meta_1habit )
ArrayOfSingleScatteringDataCreate( scat_data_1habit )


ReadXML( scat_data_single, 
"TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, 
"TestTMatrix.scat_meta_single_hail1.xml" )

Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

ReadXML( scat_data_single, 
"TestTMatrix.scat_data_single_hail2.xml" )
ReadXML( scat_meta_single, 
"TestTMatrix.scat_meta_single_hail2.xml" )

Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

[... repeats for 3 more species]

Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)

scat_dataCalc(scat_data, scat_data_raw, f_grid)
scat_data_checkedCalc(  scat_data_checked, scat_data, f_grid, 0.1, 
"none", 5e-2 )

WriteXML( "ascii", scat_data,  "scat_data.xml" )


scat_dataCalc needs scat_data_raw to be an 
ArrayOfArrayOfSingleScatteringData, so essentially when I do 
Append(scat_data_raw, scat_data_1habit) I convert scat_data_1habit 
(ArrayOfSingleScatteringData) that has the right shape for the 5 
species into an 

Re: [arts-users] scat_meta_single to scat_meta

2023-02-02 Thread Patrick Eriksson

Vito,

Sorry, but partly filling pnd_field manually and partly filling it by 
using the PSD methods will likely never work. At least this deviates 
from how ARTS is designed. There are two main options here:


1: To fill pnd_field "manually". But this is likely more easily done 
outside of ARTS.

2: To do all byparticle_bulkprop_field and PSD methods

If you explain what you want to do, it would be easier to give advice. 
It would also be helpful to know if you use Matlab or Python?


Bye,

Patrick


On 2023-02-02 15:04, Galligani wrote:

Hello !

Yes, for example this:

ReadXML( pnd_field, "hail_pnddata1.xml" )
Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)

# RWC
ScatSpeciesSizeMassInfo( species_index=5, x_unit="dveq" )
Copy( psd_size_grid, scat_species_x )
Copy( pnd_size_grid, scat_species_x )
psdModifiedGammaMass( n0=8e6, mu=0, la=-999, ga=1, t_min = 230, t_max = 
999 )

pndFromPsdBasic

# append pnd_data to pnd_field? For example I tried:
Append( pnd_field, pnd_data)

and I get:

Workspace variable belongs to the wrong group:
pnd_data is not Tensor3, it is Matrix

If I comment that out I've also realized that my psdModifiedGammaMass 
method also fails:


Method psdModifiedGammaMass needs input variable: pnd_agenda_input_t

Is it even possible to call this method outside the pnd_agenda_array? 
This open another question: Can I call a pnd_agenda_array only for RWC 
and not the other hail species?


I'm running into many errors in everything I tried.

Thanks for the time!

On 02.02.2023 03:15, Patrick Eriksson wrote:

Vito,

Can you explain how it failed?

Bye,

Patrick

On 2023-02-01 16:34, Galligani wrote:

Hi Patrick! Thanks that worked out!

I'm now running a Frankeinstein of code with pnd_data saved outside 
ARTS for different hail species, and using the ARTS 
psdModifiedGammaMass. Basically I'm trying to append the RWC pnd_data 
from


psdModifiedGammaMass
pndFromPsdBasic

to the pnd_field from the previous estructure:

i.e.,

ReadXML( pnd_field, "hail_pnddata1.xml" )

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)

etc. It this possible? All my attempts have failed.

Thank you!
Vito


On 25.01.2023 19:15, Patrick Eriksson wrote:

Vito,

scat_data and scat_data_raw are of type
ArrayOfArrayOfSingleScatteringData. The first Array dimension matches
scat_species and the second one size. So you need multiple Append to
scat_data_raw and scat_meta.

If I get it right, you should do this for each habit:

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)
Append(scat_species, species_id_string )

Delete(scat_data_1habit)  # To remove appended data
Delete(scat_meta_1habit)

The creation of pnd_field looks fine, if I remember correctly how
works for appending a Tensor4 to a Tensor4.

Bye,

Patrick


On 2023-01-24 16:08, Galligani wrote:

Hello everyone,

I re-open this question because I am adding species to my 
simulations now (before I was running with only one species)


I've run into the following error:

'Number of scattering species specified by scat_species does
not agree with number of scattering species in scat_data:
scat_species has 5 entries, while scat_data has 1.
Stopping ARTS execution.
Goodbye.'

I have 5 different species. This is essentially what my code is 
doing (I will show only two of the species)


ArrayOfScatteringMetaDataCreate( scat_meta_1habit )
ArrayOfSingleScatteringDataCreate( scat_data_1habit )


ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail2.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail2.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

[... repeats for 3 more species]

Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)

scat_dataCalc(scat_data, scat_data_raw, f_grid)
scat_data_checkedCalc(  scat_data_checked, scat_data, f_grid, 0.1, 
"none", 5e-2 )

WriteXML( "ascii", scat_data,  "scat_data.xml" )


scat_dataCalc needs scat_data_raw to be an 
ArrayOfArrayOfSingleScatteringData, so essentially when I do 
Append(scat_data_raw, scat_data_1habit) I convert scat_data_1habit 
(ArrayOfSingleScatteringData) that has the right shape for the 5 
species into an ArrayOfArrayOfSingleScatteringData and makes this 
error.



Am I taking a bad approach at doing this?
Later I add the pndf_fields by doing something similar:


Re: [arts-users] scat_meta_single to scat_meta

2023-02-02 Thread Galligani

Hello !

Yes, for example this:

ReadXML( pnd_field, "hail_pnddata1.xml" )
Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)

# RWC
ScatSpeciesSizeMassInfo( species_index=5, x_unit="dveq" )
Copy( psd_size_grid, scat_species_x )
Copy( pnd_size_grid, scat_species_x )
psdModifiedGammaMass( n0=8e6, mu=0, la=-999, ga=1, t_min = 230, t_max = 
999 )

pndFromPsdBasic

# append pnd_data to pnd_field? For example I tried:
Append( pnd_field, pnd_data)

and I get:

Workspace variable belongs to the wrong group:
pnd_data is not Tensor3, it is Matrix

If I comment that out I've also realized that my psdModifiedGammaMass 
method also fails:


Method psdModifiedGammaMass needs input variable: pnd_agenda_input_t

Is it even possible to call this method outside the pnd_agenda_array? 
This open another question: Can I call a pnd_agenda_array only for RWC 
and not the other hail species?


I'm running into many errors in everything I tried.

Thanks for the time!

On 02.02.2023 03:15, Patrick Eriksson wrote:

Vito,

Can you explain how it failed?

Bye,

Patrick

On 2023-02-01 16:34, Galligani wrote:

Hi Patrick! Thanks that worked out!

I'm now running a Frankeinstein of code with pnd_data saved outside 
ARTS for different hail species, and using the ARTS 
psdModifiedGammaMass. Basically I'm trying to append the RWC pnd_data 
from


psdModifiedGammaMass
pndFromPsdBasic

to the pnd_field from the previous estructure:

i.e.,

ReadXML( pnd_field, "hail_pnddata1.xml" )

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)

etc. It this possible? All my attempts have failed.

Thank you!
Vito


On 25.01.2023 19:15, Patrick Eriksson wrote:

Vito,

scat_data and scat_data_raw are of type
ArrayOfArrayOfSingleScatteringData. The first Array dimension matches
scat_species and the second one size. So you need multiple Append to
scat_data_raw and scat_meta.

If I get it right, you should do this for each habit:

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)
Append(scat_species, species_id_string )

Delete(scat_data_1habit)  # To remove appended data
Delete(scat_meta_1habit)

The creation of pnd_field looks fine, if I remember correctly how
works for appending a Tensor4 to a Tensor4.

Bye,

Patrick


On 2023-01-24 16:08, Galligani wrote:

Hello everyone,

I re-open this question because I am adding species to my 
simulations now (before I was running with only one species)


I've run into the following error:

'Number of scattering species specified by scat_species does
not agree with number of scattering species in scat_data:
scat_species has 5 entries, while scat_data has 1.
Stopping ARTS execution.
Goodbye.'

I have 5 different species. This is essentially what my code is 
doing (I will show only two of the species)


ArrayOfScatteringMetaDataCreate( scat_meta_1habit )
ArrayOfSingleScatteringDataCreate( scat_data_1habit )


ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" 
)
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" 
)

Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail2.xml" 
)
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail2.xml" 
)

Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

[... repeats for 3 more species]

Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)

scat_dataCalc(scat_data, scat_data_raw, f_grid)
scat_data_checkedCalc(  scat_data_checked, scat_data, f_grid, 0.1, 
"none", 5e-2 )

WriteXML( "ascii", scat_data,  "scat_data.xml" )


scat_dataCalc needs scat_data_raw to be an 
ArrayOfArrayOfSingleScatteringData, so essentially when I do 
Append(scat_data_raw, scat_data_1habit) I convert scat_data_1habit 
(ArrayOfSingleScatteringData) that has the right shape for the 5 
species into an ArrayOfArrayOfSingleScatteringData and makes this 
error.



Am I taking a bad approach at doing this?
Later I add the pndf_fields by doing something similar:

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)


I hope this helps someone else too
Thank you!
Vito











On 15.12.2022 18:39, Patrick Eriksson wrote:

Hi,

Thanks Oliver, I looked in the wrong function!

Hm, it seems that I forgot about fixing the full chain for the mono
PSDs, and that nobody has tried to use them until now. My mistake 
is a
bit shameful, but I feel reluctant to fix it now, as the present 
PSD

system hopefully will be replaced soon.

Vito, it seems that you 

Re: [arts-users] scat_meta_single to scat_meta

2023-02-01 Thread Patrick Eriksson

Vito,

Can you explain how it failed?

Bye,

Patrick

On 2023-02-01 16:34, Galligani wrote:

Hi Patrick! Thanks that worked out!

I'm now running a Frankeinstein of code with pnd_data saved outside ARTS 
for different hail species, and using the ARTS psdModifiedGammaMass. 
Basically I'm trying to append the RWC pnd_data from


psdModifiedGammaMass
pndFromPsdBasic

to the pnd_field from the previous estructure:

i.e.,

ReadXML( pnd_field, "hail_pnddata1.xml" )

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)

etc. It this possible? All my attempts have failed.

Thank you!
Vito


On 25.01.2023 19:15, Patrick Eriksson wrote:

Vito,

scat_data and scat_data_raw are of type
ArrayOfArrayOfSingleScatteringData. The first Array dimension matches
scat_species and the second one size. So you need multiple Append to
scat_data_raw and scat_meta.

If I get it right, you should do this for each habit:

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)
Append(scat_species, species_id_string )

Delete(scat_data_1habit)  # To remove appended data
Delete(scat_meta_1habit)

The creation of pnd_field looks fine, if I remember correctly how
works for appending a Tensor4 to a Tensor4.

Bye,

Patrick


On 2023-01-24 16:08, Galligani wrote:

Hello everyone,

I re-open this question because I am adding species to my simulations 
now (before I was running with only one species)


I've run into the following error:

'Number of scattering species specified by scat_species does
not agree with number of scattering species in scat_data:
scat_species has 5 entries, while scat_data has 1.
Stopping ARTS execution.
Goodbye.'

I have 5 different species. This is essentially what my code is doing 
(I will show only two of the species)


ArrayOfScatteringMetaDataCreate( scat_meta_1habit )
ArrayOfSingleScatteringDataCreate( scat_data_1habit )


ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail2.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail2.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

[... repeats for 3 more species]

Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)

scat_dataCalc(scat_data, scat_data_raw, f_grid)
scat_data_checkedCalc(  scat_data_checked, scat_data, f_grid, 0.1, 
"none", 5e-2 )

WriteXML( "ascii", scat_data,  "scat_data.xml" )


scat_dataCalc needs scat_data_raw to be an 
ArrayOfArrayOfSingleScatteringData, so essentially when I do 
Append(scat_data_raw, scat_data_1habit) I convert scat_data_1habit 
(ArrayOfSingleScatteringData) that has the right shape for the 5 
species into an ArrayOfArrayOfSingleScatteringData and makes this error.



Am I taking a bad approach at doing this?
Later I add the pndf_fields by doing something similar:

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)


I hope this helps someone else too
Thank you!
Vito











On 15.12.2022 18:39, Patrick Eriksson wrote:

Hi,

Thanks Oliver, I looked in the wrong function!

Hm, it seems that I forgot about fixing the full chain for the mono
PSDs, and that nobody has tried to use them until now. My mistake is a
bit shameful, but I feel reluctant to fix it now, as the present PSD
system hopefully will be replaced soon.

Vito, it seems that you already have considered generating pnd_field
yourself. I hope you can live with this solution for the mono PSD. If
you get confused about the cloudbox limits, you can try to use
pnd_fieldCalcFrompnd_field_raw. That method will adjust pnd_field to
the selected cloudbox.

Bye,

Patrick



On 2022-12-15 07:51, Lemke, Oliver wrote:

Hi Patrick, hi Vito,

On 14. Dec 2022, at 20:04, Patrick Eriksson 
 wrote:



   pndFromPsdBasic
}
Append( scat_species, species_id_string )
Append( pnd_agenda_array_input_names, pnd_agenda_input_names )
But the error message is that:
The method requires that length of *psd_size_grid* is >= 2.


I must ask what ARTS version you are using? In the version I have 
on my computer it looks OK. At least, I can not find this error 
message.


Tbe check does exist in ARTS master as well as 2.4. It's the first 
check in pndFromPsdBasic in m_microphysics.cc.


Cheers,
Oliver





Re: [arts-users] scat_meta_single to scat_meta

2023-02-01 Thread Galligani

Hi Patrick! Thanks that worked out!

I'm now running a Frankeinstein of code with pnd_data saved outside ARTS 
for different hail species, and using the ARTS psdModifiedGammaMass. 
Basically I'm trying to append the RWC pnd_data from


psdModifiedGammaMass
pndFromPsdBasic

to the pnd_field from the previous estructure:

i.e.,

ReadXML( pnd_field, "hail_pnddata1.xml" )

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)

etc. It this possible? All my attempts have failed.

Thank you!
Vito


On 25.01.2023 19:15, Patrick Eriksson wrote:

Vito,

scat_data and scat_data_raw are of type
ArrayOfArrayOfSingleScatteringData. The first Array dimension matches
scat_species and the second one size. So you need multiple Append to
scat_data_raw and scat_meta.

If I get it right, you should do this for each habit:

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)
Append(scat_species, species_id_string )

Delete(scat_data_1habit)  # To remove appended data
Delete(scat_meta_1habit)

The creation of pnd_field looks fine, if I remember correctly how
works for appending a Tensor4 to a Tensor4.

Bye,

Patrick


On 2023-01-24 16:08, Galligani wrote:

Hello everyone,

I re-open this question because I am adding species to my simulations 
now (before I was running with only one species)


I've run into the following error:

'Number of scattering species specified by scat_species does
not agree with number of scattering species in scat_data:
scat_species has 5 entries, while scat_data has 1.
Stopping ARTS execution.
Goodbye.'

I have 5 different species. This is essentially what my code is doing 
(I will show only two of the species)


ArrayOfScatteringMetaDataCreate( scat_meta_1habit )
ArrayOfSingleScatteringDataCreate( scat_data_1habit )


ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail2.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail2.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

[... repeats for 3 more species]

Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)

scat_dataCalc(scat_data, scat_data_raw, f_grid)
scat_data_checkedCalc(  scat_data_checked, scat_data, f_grid, 0.1, 
"none", 5e-2 )

WriteXML( "ascii", scat_data,  "scat_data.xml" )


scat_dataCalc needs scat_data_raw to be an 
ArrayOfArrayOfSingleScatteringData, so essentially when I do 
Append(scat_data_raw, scat_data_1habit) I convert scat_data_1habit 
(ArrayOfSingleScatteringData) that has the right shape for the 5 
species into an ArrayOfArrayOfSingleScatteringData and makes this 
error.



Am I taking a bad approach at doing this?
Later I add the pndf_fields by doing something similar:

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)


I hope this helps someone else too
Thank you!
Vito











On 15.12.2022 18:39, Patrick Eriksson wrote:

Hi,

Thanks Oliver, I looked in the wrong function!

Hm, it seems that I forgot about fixing the full chain for the mono
PSDs, and that nobody has tried to use them until now. My mistake is 
a

bit shameful, but I feel reluctant to fix it now, as the present PSD
system hopefully will be replaced soon.

Vito, it seems that you already have considered generating pnd_field
yourself. I hope you can live with this solution for the mono PSD. If
you get confused about the cloudbox limits, you can try to use
pnd_fieldCalcFrompnd_field_raw. That method will adjust pnd_field to
the selected cloudbox.

Bye,

Patrick



On 2022-12-15 07:51, Lemke, Oliver wrote:

Hi Patrick, hi Vito,

On 14. Dec 2022, at 20:04, Patrick Eriksson 
 wrote:



   pndFromPsdBasic
}
Append( scat_species, species_id_string )
Append( pnd_agenda_array_input_names, pnd_agenda_input_names )
But the error message is that:
The method requires that length of *psd_size_grid* is >= 2.


I must ask what ARTS version you are using? In the version I have 
on my computer it looks OK. At least, I can not find this error 
message.


Tbe check does exist in ARTS master as well as 2.4. It's the first 
check in pndFromPsdBasic in m_microphysics.cc.


Cheers,
Oliver





Re: [arts-users] scat_meta_single to scat_meta

2023-01-25 Thread Patrick Eriksson

Vito,

scat_data and scat_data_raw are of type 
ArrayOfArrayOfSingleScatteringData. The first Array dimension matches 
scat_species and the second one size. So you need multiple Append to 
scat_data_raw and scat_meta.


If I get it right, you should do this for each habit:

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)
Append(scat_species, species_id_string )

Delete(scat_data_1habit)  # To remove appended data
Delete(scat_meta_1habit)

The creation of pnd_field looks fine, if I remember correctly how works 
for appending a Tensor4 to a Tensor4.


Bye,

Patrick


On 2023-01-24 16:08, Galligani wrote:

Hello everyone,

I re-open this question because I am adding species to my simulations 
now (before I was running with only one species)


I've run into the following error:

'Number of scattering species specified by scat_species does
not agree with number of scattering species in scat_data:
scat_species has 5 entries, while scat_data has 1.
Stopping ARTS execution.
Goodbye.'

I have 5 different species. This is essentially what my code is doing (I 
will show only two of the species)


ArrayOfScatteringMetaDataCreate( scat_meta_1habit )
ArrayOfSingleScatteringDataCreate( scat_data_1habit )


ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail2.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail2.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

[... repeats for 3 more species]

Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)

scat_dataCalc(scat_data, scat_data_raw, f_grid)
scat_data_checkedCalc(  scat_data_checked, scat_data, f_grid, 0.1, 
"none", 5e-2 )

WriteXML( "ascii", scat_data,  "scat_data.xml" )


scat_dataCalc needs scat_data_raw to be an 
ArrayOfArrayOfSingleScatteringData, so essentially when I do 
Append(scat_data_raw, scat_data_1habit) I convert scat_data_1habit 
(ArrayOfSingleScatteringData) that has the right shape for the 5 species 
into an ArrayOfArrayOfSingleScatteringData and makes this error.



Am I taking a bad approach at doing this?
Later I add the pndf_fields by doing something similar:

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)


I hope this helps someone else too
Thank you!
Vito











On 15.12.2022 18:39, Patrick Eriksson wrote:

Hi,

Thanks Oliver, I looked in the wrong function!

Hm, it seems that I forgot about fixing the full chain for the mono
PSDs, and that nobody has tried to use them until now. My mistake is a
bit shameful, but I feel reluctant to fix it now, as the present PSD
system hopefully will be replaced soon.

Vito, it seems that you already have considered generating pnd_field
yourself. I hope you can live with this solution for the mono PSD. If
you get confused about the cloudbox limits, you can try to use
pnd_fieldCalcFrompnd_field_raw. That method will adjust pnd_field to
the selected cloudbox.

Bye,

Patrick



On 2022-12-15 07:51, Lemke, Oliver wrote:

Hi Patrick, hi Vito,

On 14. Dec 2022, at 20:04, Patrick Eriksson 
 wrote:



   pndFromPsdBasic
}
Append( scat_species, species_id_string )
Append( pnd_agenda_array_input_names, pnd_agenda_input_names )
But the error message is that:
The method requires that length of *psd_size_grid* is >= 2.


I must ask what ARTS version you are using? In the version I have on 
my computer it looks OK. At least, I can not find this error message.


Tbe check does exist in ARTS master as well as 2.4. It's the first 
check in pndFromPsdBasic in m_microphysics.cc.


Cheers,
Oliver





Re: [arts-users] scat_meta_single to scat_meta

2023-01-24 Thread Galligani

Hello everyone,

I re-open this question because I am adding species to my simulations 
now (before I was running with only one species)


I've run into the following error:

'Number of scattering species specified by scat_species does
not agree with number of scattering species in scat_data:
scat_species has 5 entries, while scat_data has 1.
Stopping ARTS execution.
Goodbye.'

I have 5 different species. This is essentially what my code is doing (I 
will show only two of the species)


ArrayOfScatteringMetaDataCreate( scat_meta_1habit )
ArrayOfSingleScatteringDataCreate( scat_data_1habit )


ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail1.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail1.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

ReadXML( scat_data_single, "TestTMatrix.scat_data_single_hail2.xml" )
ReadXML( scat_meta_single, "TestTMatrix.scat_meta_single_hail2.xml" )
Append(scat_data_1habit, scat_data_single)
Append(scat_meta_1habit, scat_meta_single)
Append( scat_species, species_id_string )

[... repeats for 3 more species]

Append(scat_data_raw, scat_data_1habit)
Append(scat_meta, scat_meta_1habit)

scat_dataCalc(scat_data, scat_data_raw, f_grid)
scat_data_checkedCalc(  scat_data_checked, scat_data, f_grid, 0.1, 
"none", 5e-2 )

WriteXML( "ascii", scat_data,  "scat_data.xml" )


scat_dataCalc needs scat_data_raw to be an 
ArrayOfArrayOfSingleScatteringData, so essentially when I do 
Append(scat_data_raw, scat_data_1habit) I convert scat_data_1habit 
(ArrayOfSingleScatteringData) that has the right shape for the 5 species 
into an ArrayOfArrayOfSingleScatteringData and makes this error.



Am I taking a bad approach at doing this?
Later I add the pndf_fields by doing something similar:

Tensor4Create(pnd_field2)
ReadXML( pnd_field2, "hail_pnddata2.xml" )
Append( pnd_field, pnd_field2)


I hope this helps someone else too
Thank you!
Vito











On 15.12.2022 18:39, Patrick Eriksson wrote:

Hi,

Thanks Oliver, I looked in the wrong function!

Hm, it seems that I forgot about fixing the full chain for the mono
PSDs, and that nobody has tried to use them until now. My mistake is a
bit shameful, but I feel reluctant to fix it now, as the present PSD
system hopefully will be replaced soon.

Vito, it seems that you already have considered generating pnd_field
yourself. I hope you can live with this solution for the mono PSD. If
you get confused about the cloudbox limits, you can try to use
pnd_fieldCalcFrompnd_field_raw. That method will adjust pnd_field to
the selected cloudbox.

Bye,

Patrick



On 2022-12-15 07:51, Lemke, Oliver wrote:

Hi Patrick, hi Vito,

On 14. Dec 2022, at 20:04, Patrick Eriksson 
 wrote:



   pndFromPsdBasic
}
Append( scat_species, species_id_string )
Append( pnd_agenda_array_input_names, pnd_agenda_input_names )
But the error message is that:
The method requires that length of *psd_size_grid* is >= 2.


I must ask what ARTS version you are using? In the version I have on 
my computer it looks OK. At least, I can not find this error message.


Tbe check does exist in ARTS master as well as 2.4. It's the first 
check in pndFromPsdBasic in m_microphysics.cc.


Cheers,
Oliver





Re: [arts-users] scat_meta_single to scat_meta

2022-12-19 Thread vito . galligani

Hello!

Yes! I can use my own pnd_field. No problem. Thank you!

Vito

On 15.12.2022 18:39, Patrick Eriksson wrote:

Hi,

Thanks Oliver, I looked in the wrong function!

Hm, it seems that I forgot about fixing the full chain for the mono
PSDs, and that nobody has tried to use them until now. My mistake is a
bit shameful, but I feel reluctant to fix it now, as the present PSD
system hopefully will be replaced soon.

Vito, it seems that you already have considered generating pnd_field
yourself. I hope you can live with this solution for the mono PSD. If
you get confused about the cloudbox limits, you can try to use
pnd_fieldCalcFrompnd_field_raw. That method will adjust pnd_field to
the selected cloudbox.

Bye,

Patrick



On 2022-12-15 07:51, Lemke, Oliver wrote:

Hi Patrick, hi Vito,

On 14. Dec 2022, at 20:04, Patrick Eriksson 
 wrote:



   pndFromPsdBasic
}
Append( scat_species, species_id_string )
Append( pnd_agenda_array_input_names, pnd_agenda_input_names )
But the error message is that:
The method requires that length of *psd_size_grid* is >= 2.


I must ask what ARTS version you are using? In the version I have on 
my computer it looks OK. At least, I can not find this error message.


Tbe check does exist in ARTS master as well as 2.4. It's the first 
check in pndFromPsdBasic in m_microphysics.cc.


Cheers,
Oliver





Re: [arts-users] scat_meta_single to scat_meta

2022-12-15 Thread Patrick Eriksson

Hi,

Thanks Oliver, I looked in the wrong function!

Hm, it seems that I forgot about fixing the full chain for the mono 
PSDs, and that nobody has tried to use them until now. My mistake is a 
bit shameful, but I feel reluctant to fix it now, as the present PSD 
system hopefully will be replaced soon.


Vito, it seems that you already have considered generating pnd_field 
yourself. I hope you can live with this solution for the mono PSD. If 
you get confused about the cloudbox limits, you can try to use 
pnd_fieldCalcFrompnd_field_raw. That method will adjust pnd_field to the 
selected cloudbox.


Bye,

Patrick



On 2022-12-15 07:51, Lemke, Oliver wrote:

Hi Patrick, hi Vito,


On 14. Dec 2022, at 20:04, Patrick Eriksson  
wrote:


   pndFromPsdBasic
}
Append( scat_species, species_id_string )
Append( pnd_agenda_array_input_names, pnd_agenda_input_names )
But the error message is that:
The method requires that length of *psd_size_grid* is >= 2.


I must ask what ARTS version you are using? In the version I have on my 
computer it looks OK. At least, I can not find this error message.


Tbe check does exist in ARTS master as well as 2.4. It's the first check in 
pndFromPsdBasic in m_microphysics.cc.

Cheers,
Oliver





Re: [arts-users] scat_meta_single to scat_meta

2022-12-14 Thread Lemke, Oliver
Hi Patrick, hi Vito,

> On 14. Dec 2022, at 20:04, Patrick Eriksson  
> wrote:
> 
>>   pndFromPsdBasic
>> }
>> Append( scat_species, species_id_string )
>> Append( pnd_agenda_array_input_names, pnd_agenda_input_names )
>> But the error message is that:
>> The method requires that length of *psd_size_grid* is >= 2.
> 
> I must ask what ARTS version you are using? In the version I have on my 
> computer it looks OK. At least, I can not find this error message.

Tbe check does exist in ARTS master as well as 2.4. It's the first check in 
pndFromPsdBasic in m_microphysics.cc.

Cheers,
Oliver





smime.p7s
Description: S/MIME cryptographic signature


Re: [arts-users] scat_meta_single to scat_meta

2022-12-14 Thread Patrick Eriksson

Vito,

When it comes to:


ArrayOfAgendaAppend( pnd_agenda_array ){
   VectorSet(pnd_size_grid, [1])
   VectorSet(psd_size_grid, [1])
   psdMonoDispersive(psd_data, dpsd_data_dx, pnd_agenda_input_t, 
pnd_agenda_input,
    pnd_agenda_input_names, dpnd_data_dx_names, scat_meta, 
agenda_array_index, 220, 260)

   pndFromPsdBasic
}
Append( scat_species, species_id_string )
Append( pnd_agenda_array_input_names, pnd_agenda_input_names )

But the error message is that:
The method requires that length of *psd_size_grid* is >= 2.


I must ask what ARTS version you are using? In the version I have on my 
computer it looks OK. At least, I can not find this error message.



The other option I tried to avoid pnd_agenda_array, was reading directly 
pnd_field from the file. But when doing cloudbox_checkedCalc I run into 
this error:


The atmospheric field *pnd_field* has wrong size.
Expected size is 1 x 204 x 1 x 1,
while actual size is 1 x 231 x 1 x 1.
Stopping ARTS execution.

Related with cloudboxSetManuallyAltitude

cloudboxSetManuallyAltitude( z1=-2e3, z2=25e3, lat1=-0, lat2=0, lon1=-0, 
lon2=0 )


I don't understand as my pnd_field is the size of my p_grid.


The size of pnd_field shall follow the cloudbox. It seems that with 
z2=25e3 the upper boundary of the cloudbox ends up at p_grid[203].


If you want the cloudbox and pnd_field to follow p_grid, use 
cloudboxSetFullAtm.


/P


Re: [arts-users] scat_meta_single to scat_meta

2022-12-14 Thread vito . galligani

Hi Patrick!

Thanks for your reply. I think I made some progress, but I'm still 
running into error messages (now with PSD)


The single scattering data I'm happy with. Basically I'm doing this:

ArrayOfScatteringMetaDataCreate( scat_meta_1habit )
ArrayOfSingleScatteringDataCreate( scat_data_1habit )

#--- TMatrix calculation:
scat_data_singleTmatrix(
   shape   = part_shape,
   diameter_volume_equ = part_dveq,
   aspect_ratio= part_ar,
   mass= part_mass,
   ptype   = "totally_random",
   data_f_grid = data_f_grid,
   data_t_grid = data_t_grid,
   data_za_grid= data_za_grid,
   data_aa_grid= data_aa_grid,
)

#--- Set up scat_data
Append(scat_data_1habit, scat_data_single)
Append(scat_data_raw, scat_data_1habit)
# and meta data ...
Append(scat_meta_1habit, scat_meta_single)
Append(scat_meta, scat_meta_1habit)
#
scat_dataCalc(scat_data, scat_data_raw, f_grid)
scat_data_checkedCalc(  scat_data_checked, scat_data, f_grid, 0.1, 
"none", 5e-2 )

WriteXML( "ascii", scat_data,  "scat_data.xml" )


and when I try to use pnd_agenda_array with psdMonoDispersive I do it 
like this:


#-- PND AGENDA ARRAY
ArrayOfStringSet( pnd_agenda_input_names, [ "HWC" ] )
ArrayOfStringSet( dpnd_data_dx_names, [ "HWC" ] )

# The input data in pnd_agenda_input shall be number densities, in unit 
of [#/m3].

ReadXML( pnd_agenda_input, "hail_pnddata.xml" )

ArrayOfAgendaAppend( pnd_agenda_array ){
  VectorSet(pnd_size_grid, [1])
  VectorSet(psd_size_grid, [1])
  psdMonoDispersive(psd_data, dpsd_data_dx, pnd_agenda_input_t, 
pnd_agenda_input,
   pnd_agenda_input_names, dpnd_data_dx_names, scat_meta, 
agenda_array_index, 220, 260)

  pndFromPsdBasic
}
Append( scat_species, species_id_string )
Append( pnd_agenda_array_input_names, pnd_agenda_input_names )

But the error message is that:
The method requires that length of *psd_size_grid* is >= 2.

If I understand correctly, pnd_size_grid is the size of each scattering 
element considered. If I run a monodisperse psd then all scattering 
elements are the same size ... (?)


The other option I tried to avoid pnd_agenda_array, was reading directly 
pnd_field from the file. But when doing cloudbox_checkedCalc I run into 
this error:


The atmospheric field *pnd_field* has wrong size.
Expected size is 1 x 204 x 1 x 1,
while actual size is 1 x 231 x 1 x 1.
Stopping ARTS execution.

Related with cloudboxSetManuallyAltitude

cloudboxSetManuallyAltitude( z1=-2e3, z2=25e3, lat1=-0, lat2=0, lon1=-0, 
lon2=0 )


I don't understand as my pnd_field is the size of my p_grid.

Thank you!
Vito





On 14.12.2022 12:32, Patrick Eriksson wrote:

Hi,

Yes, this is not totally streamlined. And nothing we will change now
as the handling of scattering data is being rewritten from scratch.

You must do a bit more than you included, as scat_dataCalc requires
scat_data_raw. Not clear from where you get that.

I think you can use Append to move scat_meta_single t0 scat_meta. And
same thing for scat_data_single to scat_data_raw.

Bye,

Patrick


On 2022-12-14 14:14, vito.gallig...@cima.fcen.uba.ar wrote:

Hello!

I have a bit of an ARTS 'coding-language' question here. I'm trying to 
run a very simple simulation where I use the T-matrix and I read its 
corresponding pnd_field_raw from a file. I mainly do the following:



ReadXML( particle_bulkprop_names, "particle_bulkprop_names.xml" )
ReadXML( particle_bulkprop_field, "particle_bulkprop_field.xml" )

scat_data_singleTmatrix

ReadXML( pnd_field_raw, "hail_pnddata.xml" )

scat_dataCalc
scat_data_checkedCalc
WriteXML( "ascii", scat_data,  "scat_data.xml" ) # VB: store scat_data

cloudboxSetManuallyAltitude( z1=-9e3, z2=20e3, lat1=-0, lat2=0, 
lon1=-0, lon2=0 )


pnd_fieldCalcFromParticleBulkProps

and here is when I run into: 'Method 
pnd_fieldCalcFromParticleBulkProps needs input variable: scat_meta'


I cant seem to find in the built-in documentation server how to get 
scat_meta from scat_meta_single. What is the method that does that?


thank you!!!
Vito







Re: [arts-users] scat_meta_single to scat_meta

2022-12-14 Thread Patrick Eriksson

Hi,

Yes, this is not totally streamlined. And nothing we will change now as 
the handling of scattering data is being rewritten from scratch.


You must do a bit more than you included, as scat_dataCalc requires 
scat_data_raw. Not clear from where you get that.


I think you can use Append to move scat_meta_single t0 scat_meta. And 
same thing for scat_data_single to scat_data_raw.


Bye,

Patrick


On 2022-12-14 14:14, vito.gallig...@cima.fcen.uba.ar wrote:

Hello!

I have a bit of an ARTS 'coding-language' question here. I'm trying to 
run a very simple simulation where I use the T-matrix and I read its 
corresponding pnd_field_raw from a file. I mainly do the following:



ReadXML( particle_bulkprop_names, "particle_bulkprop_names.xml" )
ReadXML( particle_bulkprop_field, "particle_bulkprop_field.xml" )

scat_data_singleTmatrix

ReadXML( pnd_field_raw, "hail_pnddata.xml" )

scat_dataCalc
scat_data_checkedCalc
WriteXML( "ascii", scat_data,  "scat_data.xml" ) # VB: store scat_data

cloudboxSetManuallyAltitude( z1=-9e3, z2=20e3, lat1=-0, lat2=0, lon1=-0, 
lon2=0 )


pnd_fieldCalcFromParticleBulkProps

and here is when I run into: 'Method pnd_fieldCalcFromParticleBulkProps 
needs input variable: scat_meta'


I cant seem to find in the built-in documentation server how to get 
scat_meta from scat_meta_single. What is the method that does that?


thank you!!!
Vito