Re: [arts-users] Extract element from vector
Hi Hugh ()! Jana is correct: I could probably do this without using the batch agenda; I > do not think I am doing anything which fundamentally prevents this. But I > could not work out how to do that either . I will probably try to sort > that out at some point. > It's actually very simple: (but I had to look it up in an example controlfile, too. I keep forgetting things. And usually copy from older setups or examples.) MatrixSet( sensor_los, [ 180; 170; 160; 150; 140; 130] ) Meanwhile, Oliver's hints have enabled me to get it working by using the > batch agenda. > Always good to learn something new. And to have alternatives! :) Best wishes, Jana -- = Jana Mendrok, Ph.D. Deutscher Wetterdienst Frankfurter Str. 135 63067 Offenbach am Main, Germany Email: jana.mend...@dwd.de Phone : +49 (0)69 8062 3139 = ___ 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] Extract element from vector
Dear All, Thanks to Jana and Oliver for their help. Jana is correct: I could probably do this without using the batch agenda; I do not think I am doing anything which fundamentally prevents this. But I could not work out how to do that either . I will probably try to sort that out at some point. Meanwhile, Oliver's hints have enabled me to get it working by using the batch agenda. Best wishes, Hugh From: Jana Mendrok Sent: 18 July 2019 13:59 To: PUMPHREY Hugh Cc: arts_users.mi@lists.uni-hamburg.de Subject: Re: [arts-users] Extract element from vector Hi Hugh, you are probably doing things in the batch agenda, that make you require or prefer a batch agenda. But if it's just about multiple LOS - they can also be done in a single, non-batch run (that's why sensor_los is a matrix; one of it's dimensions is the number of LOS, or in a more general way the "number of measurement blocks" as the doc calls it). Best wishes, Jana On Thu, Jul 18, 2019 at 9:46 AM PUMPHREY Hugh mailto:hugh.pumph...@ed.ac.uk>> wrote: Dear ARTS gurus, I am trying to use ARTS's batch feature to do calculations for a range of values of sensor_los. The relevant bit of my control file goes: VectorCreate(my_loses) VectorSet(my_loses, [180,170,160,150,140,130]) Print(my_loses) IndexSet(ybatch_n,7) AgendaSet(ybatch_calc_agenda){ Extract(sensor_los,my_loses,ybatch_index) Print( ybatch_index, 0 ) Print( sensor_los, 0 ) ## Actual calculations including iyCalc go here } But I get an error in the Extract() method which says: Workspace variable belongs to the wrong group: my_loses is not ArrayOfMatrix, it is Vector At the root of this is that sensor_los is a matrix, even though it has only one element. I have tried a few other combinations of creating a matrix instead of a vector and/or using Select() instead of Extract() to extract a value from it. Select() was no good because ybatch_index is an index, not an array of index. What am I doing wrong? How do I create a 1-D array of numbers which Extract() will extract a single value from? I am sure I am being really dim here :-( Best wishes Hugh Pumphrey The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. ___ arts_users.mi mailing list arts_users.mi@lists.uni-hamburg.de<mailto:arts_users.mi@lists.uni-hamburg.de> https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi -- = Jana Mendrok, Ph.D. Deutscher Wetterdienst Frankfurter Str. 135 63067 Offenbach am Main, Germany Email: jana.mend...@dwd.de<mailto:jana.mend...@dwd.de> Phone : +49 (0)69 8062 3139 = ___ 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] Extract element from vector
Hi Hugh, you are probably doing things in the batch agenda, that make you require or prefer a batch agenda. But if it's just about multiple LOS - they can also be done in a single, non-batch run (that's why sensor_los is a matrix; one of it's dimensions is the number of LOS, or in a more general way the "number of measurement blocks" as the doc calls it). Best wishes, Jana On Thu, Jul 18, 2019 at 9:46 AM PUMPHREY Hugh wrote: > Dear ARTS gurus, > > I am trying to use ARTS's batch feature to do calculations for a range of > values of sensor_los. > > The relevant bit of my control file goes: > > VectorCreate(my_loses) > VectorSet(my_loses, [180,170,160,150,140,130]) > Print(my_loses) > IndexSet(ybatch_n,7) > > AgendaSet(ybatch_calc_agenda){ > Extract(sensor_los,my_loses,ybatch_index) > Print( ybatch_index, 0 ) > Print( sensor_los, 0 ) >## Actual calculations including iyCalc go here > } > > But I get an error in the Extract() method which says: > > Workspace variable belongs to the wrong group: my_loses is not > ArrayOfMatrix, it is Vector > > At the root of this is that sensor_los is a matrix, even though it has > only one element. I have tried a few other combinations of creating a > matrix instead of a vector and/or using Select() instead of Extract() to > extract a value from it. Select() was no good because ybatch_index is an > index, not an array of index. > > What am I doing wrong? How do I create a 1-D array of numbers which > Extract() will extract a single value from? I am sure I am being really dim > here :-( > > Best wishes > > Hugh Pumphrey > > > > The University of Edinburgh is a charitable body, registered in Scotland, > with registration number SC005336. > ___ > arts_users.mi mailing list > arts_users.mi@lists.uni-hamburg.de > https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi > -- = Jana Mendrok, Ph.D. Deutscher Wetterdienst Frankfurter Str. 135 63067 Offenbach am Main, Germany Email: jana.mend...@dwd.de Phone : +49 (0)69 8062 3139 = ___ 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] Extract element from vector
Hi Hugh, Since ARTS is strongly typed, a Numeric cannot be assigned directly to a Matrix. But you can extract it into a temporary variable and then use MatrixSetConstant: Arts2 { VectorCreate(my_loses) VectorSet(my_loses, [180,170,160,150,140,130]) Print(my_loses) IndexSet(ybatch_start, 0) IndexSet(ybatch_n,6) NumericCreate(one_los) AgendaSet(ybatch_calc_agenda){ Extract(one_los,my_loses,ybatch_index) MatrixSetConstant(sensor_los, 1, 1, one_los) Print( ybatch_index, 0 ) Print( sensor_los, 0 ) ## Actual calculations including iyCalc go here Touch(y) Touch(y_aux) Touch(jacobian) } ybatchCalc } Hope this helps. Cheers, Oliver > On 17 Jul 2019, at 19:20, PUMPHREY Hugh wrote: > > VectorCreate(my_loses) > VectorSet(my_loses, [180,170,160,150,140,130]) > Print(my_loses) > IndexSet(ybatch_n,7) > > AgendaSet(ybatch_calc_agenda){ > Extract(sensor_los,my_loses,ybatch_index) > Print( ybatch_index, 0 ) > Print( sensor_los, 0 ) >## Actual calculations including iyCalc go here > } smime.p7s Description: S/MIME cryptographic signature ___ 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] Extract element from vector
Dear ARTS gurus, I am trying to use ARTS's batch feature to do calculations for a range of values of sensor_los. The relevant bit of my control file goes: VectorCreate(my_loses) VectorSet(my_loses, [180,170,160,150,140,130]) Print(my_loses) IndexSet(ybatch_n,7) AgendaSet(ybatch_calc_agenda){ Extract(sensor_los,my_loses,ybatch_index) Print( ybatch_index, 0 ) Print( sensor_los, 0 ) ## Actual calculations including iyCalc go here } But I get an error in the Extract() method which says: Workspace variable belongs to the wrong group: my_loses is not ArrayOfMatrix, it is Vector At the root of this is that sensor_los is a matrix, even though it has only one element. I have tried a few other combinations of creating a matrix instead of a vector and/or using Select() instead of Extract() to extract a value from it. Select() was no good because ybatch_index is an index, not an array of index. What am I doing wrong? How do I create a 1-D array of numbers which Extract() will extract a single value from? I am sure I am being really dim here :-( Best wishes Hugh Pumphrey The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. ___ arts_users.mi mailing list arts_users.mi@lists.uni-hamburg.de https://mailman.rrz.uni-hamburg.de/mailman/listinfo/arts_users.mi