Re: [arts-users] calculate absorption coefficients from abs_coefCalc

2016-02-16 Thread Pengwang Zhai
Thanks, Richard.  I tried your suggestion.  Unfortunately, it does not work. 
The error message is:

arts TestAbsCoeff.arts

Version: arts-2.2.57 (compiled Fri Feb 12 21:05:27 2016)
Executing Arts
{…
…
…
}
This run took 11.10s (11.07s CPU time)
Run-time error in controlfile: TestAbsCoeff.arts
Run-time error in method: AgendaExecute
Run-time error in method: abs_xsec_per_speciesInit
Method abs_xsec_per_speciesInit needs input variable: abs_species_active
Stopping ARTS execution.
Goodbye.

Here is the script:




#DEFINITIONS:  -*-sh-*-
#
# An example ARTS controlfile that calculates absorption
# coefficients. 
# SAB 16.06.2000

Arts2 {

INCLUDE "general/general.arts"
INCLUDE "general/continua.arts"
INCLUDE "general/agendas.arts"
INCLUDE "general/planet_earth.arts"

# Agenda for scalar gas absorption calculation
Copy(abs_xsec_agenda, abs_xsec_agenda__noCIA)
# on-the-fly absorption
Copy( propmat_clearsky_agenda, propmat_clearsky_agenda__OnTheFly )

abs_linesReadFromHitran( abs_lines,
   "/RT/HITRAN/HITRAN2012.par",
3.880627143214052e+14,
3.961610390054004e+14 )

abs_speciesSet( species=[ "H2O-PWR98",
  "O2-PWR93" ] )

# This separates the lines into the different tag groups and creates
# the workspace variable `abs_lines_per_species':
abs_lines_per_speciesCreateFromLines

# Dimensionality of the atmosphere
AtmosphereSet1D

VectorNLogSpace( p_grid, 200, 10, 10 )
 
# Atmospheric profiles
AtmRawRead( t_field_raw, z_field_raw, vmr_field_raw, abs_species, 
"testdata/tropical" )

# Now interpolate all the raw atmospheric input onto the pressure 
# grid and create the atmospheric variables `t_field', `z_field', `vmr_field'
AtmFieldsCalc

# Initialize the input variables of abs_coefCalc from the Atm fields:
AbsInputFromAtmFields

# Create the frequency grid `f_grid':
VectorNLinSpace( f_grid, 25000,3.880627143214052e+14, 3.961610390054004e+14 )

IndexSet(stokes_dim, 1)

# Calculate absorption coefficients, both total (`abs_coef') and
# separately for each tag group (`abs_coef_per_species'):

atmfields_checkedCalc
abs_xsec_agenda_checkedCalc
AgendaExecute(abs_xsec_agenda)
abs_coefCalcFromXsec

# Optionally write these to files:
WriteXML( output_file_format,abs_coef_per_species)
}



> On Feb 16, 2016, at 3:15 AM, Richard Larsson  wrote:
> 
> Dear Pengwang Zhai,
> 
> I think we still have what you are looking for in ARTS.
> 
> The variable you are actually interested in is not abs_coef, but 
> abs_coef_per_species.
> 
> The way to create this is to first run abs_xsec_agenda and then 
> abs_coefCalcFromXsec.  
> 
> I think your code should only change from:
> 
> abs_coefCalc
> 
> to
> 
> abs_xsec_agendaExecute
> abs_coefCalcFromXsec
> 
> Now abs_coef_per_species is an array of matrices.  The array-size is the 
> species and the matrices are the size of f_grid and p_grid.  Save this and do 
> what you want with it.
> 
> This said, there is potentially a few other changes depending on what version 
> you are using and what species you are interested in.  You will want to run 
> jacobianOff, for instance, if you are using the dev-branch.
> 
> Cheers,
> //Richard
> 
> 2016-02-15 22:11 GMT+01:00 Pengwang Zhai :
> Thanks, Jana.
> 
> > Note that for deriving abs_coef for this, you need to sum up over all 
> > species (i.e. over the 0th dimension of propmat_clearsky_field.
> 
> This is exactly what I wanted to do within arts to get “abs_coef”.  If it is 
> not possible with arts, I will use matlab to do this.
> 
> The three dimensions are: [species, f_grid, p_grid]
> 
> Cheers,
> 
> PZ
> 
> 
> > On Feb 15, 2016, at 3:47 PM, Jana Mendrok  wrote:
> >
> > Hi,
> >
> > what do you intend to do with abs_coeff_user?
> > Do you really process this further within ARTS itself? only then it makes 
> > sense to process propmat_clearsky_field into a Tensor3*, i think.
> > Else, I strongly recommend to do any re-shaping / reduction outside of 
> > ARTS; other programming languages are much better suited for this kind of 
> > task (e.g. you can use the matlab-interface atmlab to have easy access to 
> > ARTS output. or the python interface typhon).
> >
> > abs_coef was a Matrix of dimension [f_grid, abs_p] (and 
> > abs_coef_per_species an Array holding one abs_coef matrix per defined 
> > abs_species).
> > propmat_clearsky_field is a Tensor7 of dimension [species, f_grid, 
> > stokes_dim, stokes_dim, p_grid, lat_grid, lon_grid].
> >
> > That is, for reducing propmat_clearsky_field to what was 
> > abs_coef_per_species before would be
> > propmat_clearsky_field[:, :, 0, 0, :, lat_index, lon_index] (in case of 
> > 0-indexed varibales; in case of a 1D calculation furthermore 
> > lat_index=lon_index=0). As far as I know, that's not possible (at least not 
> > easily possible) within ARTS itself.
> >
> > Note that for deriving abs_coef for this, you need to sum up over all 
> > 

Re: [arts-users] calculate absorption coefficients from abs_coefCalc

2016-02-16 Thread Richard Larsson
Dear Pengwang Zhai,

I think we still have what you are looking for in ARTS.

The variable you are actually interested in is not abs_coef, but
abs_coef_per_species.

The way to create this is to first run abs_xsec_agenda and
then abs_coefCalcFromXsec.

I think your code should only change from:

abs_coefCalc

to

abs_xsec_agendaExecute
abs_coefCalcFromXsec

Now abs_coef_per_species is an array of matrices.  The array-size is the
species and the matrices are the size of f_grid and p_grid.  Save this and
do what you want with it.

This said, there is potentially a few other changes depending on what
version you are using and what species you are interested in.  You will
want to run jacobianOff, for instance, if you are using the dev-branch.

Cheers,
//Richard

2016-02-15 22:11 GMT+01:00 Pengwang Zhai :

> Thanks, Jana.
>
> > Note that for deriving abs_coef for this, you need to sum up over all
> species (i.e. over the 0th dimension of propmat_clearsky_field.
>
> This is exactly what I wanted to do within arts to get “abs_coef”.  If it
> is not possible with arts, I will use matlab to do this.
>
> The three dimensions are: [species, f_grid, p_grid]
>
> Cheers,
>
> PZ
>
>
> > On Feb 15, 2016, at 3:47 PM, Jana Mendrok 
> wrote:
> >
> > Hi,
> >
> > what do you intend to do with abs_coeff_user?
> > Do you really process this further within ARTS itself? only then it
> makes sense to process propmat_clearsky_field into a Tensor3*, i think.
> > Else, I strongly recommend to do any re-shaping / reduction outside of
> ARTS; other programming languages are much better suited for this kind of
> task (e.g. you can use the matlab-interface atmlab to have easy access to
> ARTS output. or the python interface typhon).
> >
> > abs_coef was a Matrix of dimension [f_grid, abs_p] (and
> abs_coef_per_species an Array holding one abs_coef matrix per defined
> abs_species).
> > propmat_clearsky_field is a Tensor7 of dimension [species, f_grid,
> stokes_dim, stokes_dim, p_grid, lat_grid, lon_grid].
> >
> > That is, for reducing propmat_clearsky_field to what was
> abs_coef_per_species before would be
> > propmat_clearsky_field[:, :, 0, 0, :, lat_index, lon_index] (in case of
> 0-indexed varibales; in case of a 1D calculation furthermore
> lat_index=lon_index=0). As far as I know, that's not possible (at least not
> easily possible) within ARTS itself.
> >
> > Note that for deriving abs_coef for this, you need to sum up over all
> species (i.e. over the 0th dimension of propmat_clearsky_field.
> >
> > Best wishes,
> > Jana
> >
> >
> > ps.
> > *by the way, what are the 3 dimensions? neither abs_coeff nor
> abs_coef_per_species is (or has been for a long time) a Tensor3. That is,
> you must have post-processed abs_coef(_per_species) anyways?
> >
> > On Mon, Feb 15, 2016 at 6:09 PM, Pengwang Zhai  wrote:
> > Thanks, Jana.  Too bad that the only arts feature that I am using is now
> obsolete.
> >
> > Now given propmat_clearsky_field, can I somehow obtain abs_coeff from it?
> >
> > I used the following commands to create abs_coeff_user, which is the
> absorption coefficients per specie,
> >
> > Tensor3Create(abs_coeff_user)
> > Reduce(abs_coeff_user,propmat_clearsky_field)
> >
> > can I add the coefficients per specie abs_coeff_user together to create
> abs_coeff within arts?
> >
> > I could do this with other tools but wish to know how to do in arts,
> which is more convenient.
> >
> > Thanks,
> >
> > Pengwang
> >
> >
> > > On Feb 15, 2016, at 12:00 PM, Jana Mendrok 
> wrote:
> > >
> > > Dear Pengwang,
> > >
> > > please take a look at the workspace variable propmat_clearsky_field
> (and the workspace method propmat_clearsky_fieldCalc, that calculates this
> variables). Could they probably provide the output you need?
> > >
> > > abs_coef and its *Calc method are obsolete and not supported anymore.
> > >
> > > Best wishes,
> > > Jana
> > >
> > >
> > > On Mon, Feb 15, 2016 at 4:30 PM, Pengwang Zhai 
> wrote:
> > > Hi,
> > >
> > > I used earlier version of ARTS to calculate the total absorption
> coefficients with:
> > >
> > > abs_coefCalc
> > >
> > > and found it is very useful.  Now with the new version, this does not
> work any more. After reading the change log I found that it is replaced with
> > >
> > > abs_coefCalcFromXsec
> > >
> > > However, after numerous attemps I could not make this method working
> for me.  Would you please provide a template arts file on the usage of this
> method?
> > >
> > > Thanks very much and hope all the best,
> > >
> > > Yours
> > >
> > > ___
> > > 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. (Project Assistent)
> > > Chalmers University of