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