Go to the documentation of this file.
69 const Index& output_level)
72 os << message <<
'\n';
76 case 0:
out0 << os.str ();
break;
77 case 1:
out1 << os.str ();
break;
78 case 2:
out2 << os.str ();
break;
79 case 3:
out3 << os.str ();
break;
81 throw runtime_error (
"Output level must have value from 0-3");
95 out1 <<
" Forced exit.\n";
193 am[0].resize( 1, 1 );
194 am[0] =
static_cast<Numeric>(v);
213 if ( (am.
nelem()!=1) || (am[0].nrows()!=1) || (am[0].ncols()!=1) )
216 os <<
"The file " << filename <<
" contains not a single value.";
217 throw runtime_error(os.str());
222 if ( (a-floor(a)) != 0 )
223 throw runtime_error(
"The value in the file is not an integer.");
225 throw runtime_error(
"The value in the file is negative.");
246 am[0].resize( 1, 1 );
265 if ( (am.
nelem()!=1) || (am[0].nrows()!=1) || (am[0].ncols()!=1) )
268 os <<
"The file " << filename <<
" contains not a single numeric value";
269 throw runtime_error(os.str());
326 if ( 1 != am.
nelem() )
327 throw runtime_error(
"You tried to convert an array of matrix to a matrix,\n"
328 "but the dimension of the array is not 1.");
332 if ( 1 != m.
ncols() )
333 throw runtime_error(
"You tried to convert a matrix to a vector,\n"
334 "but it has more than one column.");
390 if ( 1 != am.
nelem() )
391 throw runtime_error(
"You tried to convert an array of matrix to a matrix,\n"
392 "but the dimension of the array is not 1.");
394 m.
resize( am[0].nrows(), am[0].ncols() );
417 for (
Index i=0; i<n; i++ )
418 am[0](i,0) =
static_cast<Numeric>(v[i]);
440 if ( (am.
nelem()!=1) )
443 os <<
"The file " << filename <<
" contains more than one vector.";
444 throw runtime_error(os.str());
451 if ( 1 != m.
ncols() )
452 throw runtime_error(
"You tried to convert a matrix to a vector,\n"
453 "but it has more than one column.");
462 for (
Index i=0; i<n; i++ )
464 if ( (x[i]-floor(x[i])) != 0 )
465 throw runtime_error(
"A value in the file is not an integer.");
467 throw runtime_error(
"A value in the file is negative.");
493 am[i].resize( av[i].nelem(), 1 );
521 av.resize(am.
nelem());
525 if ( 1 != am[i].ncols() )
526 throw runtime_error(
"You tried to convert a matrix to a vector,\n"
527 "but it has more than one column.");
530 av[i].resize(am[i].nrows());
618 if ( 1 != as.
nelem() )
619 throw runtime_error(
"You tried to convert an array of String to a String,\n"
620 "but the dimension of the array is not 1.");
706 out3 <<
" Setting " << x_name <<
" to " << value <<
".\n";
727 out3 <<
" Setting " << x_name <<
" to " << value <<
".\n";
747 out3 <<
" Setting " << x_name <<
" to the first value of " << v_name <<
".\n";
768 out3 <<
" Setting " << x_name <<
" to the last value of " << v_name <<
".\n";
788 out2 <<
" Creating " << x_name <<
" as a constant vector\n";
789 out3 <<
" length : " << n <<
"\n";
790 out3 <<
" value : " << value <<
"\n";
811 out2 <<
" Creating " << x_name <<
" as a constant vector\n";
812 out3 <<
" length : " << n <<
"\n";
813 out3 <<
" value : " << value <<
"\n";
831 out2 <<
" Creating " << x_name <<
" as linearly spaced vector\n";
832 out3 <<
" length: " << x.
nelem() <<
"\n";
833 out3 <<
" first value: " << x[0] <<
"\n";
836 out3 <<
" step size: " << x[1]-x[0] <<
"\n";
837 out3 <<
" last value: " << x[x.nelem()-1] <<
"\n";
856 throw runtime_error(
"The number of points must be > 1.");
858 out2 <<
" Creating " << x_name <<
" as linearly spaced vector\n";
859 out3 <<
" length: " << n <<
"\n";
860 out3 <<
" first value: " << x[0] <<
"\n";
863 out3 <<
" step size: " << x[1]-x[0] <<
"\n";
864 out3 <<
" last value: " << x[x.nelem()-1] <<
"\n";
884 Vector p_lim(2), z_lim(2);
888 interpp(z_lim,p_abs,z_abs,p_lim);
891 linspace(z,z_lim[0],z_lim[1],delta_z);
893 z2p(p, z_abs, p_abs, z);
911 throw runtime_error(
"The number of points must be > 1.");
912 if ( (start<=0) || (stop<=0) )
913 throw runtime_error(
"Only positive numbers are allowed.");
917 out2 <<
" Creating " << x_name <<
" as logarithmically spaced vector\n";
918 out3 <<
" length: " << n <<
"\n";
919 out3 <<
" first value: " << x[0] <<
"\n";
921 out3 <<
" last value: " << x[x.nelem()-1] <<
"\n";
938 out2 <<
" " << name_y2 <<
" = " << name_y1 <<
"\n";
957 const String& orientation,
960 if (orientation ==
String (
"col"))
962 if (index < m.
ncols ())
965 v = m (
joker, index);
968 throw runtime_error (
"Index out of column bounds");
970 else if (orientation ==
String (
"row"))
972 if (index < m.
nrows ())
975 v = m (index,
joker);
978 throw runtime_error (
"Index out of row bounds");
981 throw runtime_error (
"Orientation must be either \"row\" or \"col\"");
997 out2 <<
" Flips " << name_y2 <<
" to create " << name_y1 <<
"\n";
1002 for (
Index i=0; i<n; i++ )
1030 out2<<
" Setting " << y_name <<
" to blackbody radiation for "<<t<<
" K.\n";
1033 throw runtime_error(
"The temperature must be > 0.");
1050 out2<<
" " << out_name <<
" = log10( " << in_name <<
" )\n";
1071 out2<<
" " << out_name <<
" = " << in_name <<
" + " << value <<
"\n";
1109 out2<<
" " << out_name <<
" = " << in_name <<
" * " << value <<
"\n";
1160 mult( dummy, M, x );
1184 x.
resize( nrows, ncols );
1186 out2 <<
" Creating " << x_name <<
" as a constant matrix\n";
1187 out3 <<
" nrows : " << nrows <<
"\n";
1188 out3 <<
" ncols : " << ncols <<
"\n";
1189 out3 <<
" value : " << value <<
"\n";
1200 out2 <<
" " << name_y2 <<
" = " << name_y1 <<
"\n";
1216 out2 <<
" Creates" << name_m <<
" by copying " << name_y << n <<
"times.\n";
1218 for (
Index i=0; i<n; ++i )
1238 out2<<
" " << out_name <<
" = " << in_name <<
" * " << value <<
"\n";
1275 x.
resize( nrows, nrows );
1279 out2 <<
" Creating " << x_name <<
" as a diagonal matrix\n";
1280 out3 <<
" nrows : " << nrows <<
"\n";
1281 out3 <<
" value : " << value <<
"\n";
1312 mult( dummy, M, X );
1347 mult( dummymat, M, X[i] );
1351 dummy[i].resize( dummymat.
nrows(), dummymat.
ncols() );
1353 dummy[i] = dummymat;
1356 Y.resize( dummy.
nelem() );
1359 Y[i].resize( dummy[i].nrows(), dummy[i].ncols() );
1394 os <<
"The size of the two matrices must be identical. \n"
1395 <<
"Size of " << M_name <<
" is " << M.
nrows() <<
" x " << M.
ncols()
1397 <<
"Size of " << X_name <<
" is " << X.
nrows() <<
" x " << X.
ncols();
1398 throw runtime_error( os.str() );
1405 for ( i=0; i<m; i++ )
1407 for ( j=0; j<n; j++ )
1408 dummy(i,j) = M(i,j) + X(i,j);
1433 out3 <<
" Setting " << s_name <<
" to " << s2 <<
"\n";
1451 sa.resize(sa2.
nelem());
1453 out3 <<
" Setting " << sa_name <<
"\n";
void check_ncol_nrow(const Matrix &A, const String &A_name, const Matrix &B, const String &B_name)
Checks that the number of columns of the first matrix is the same as the number of rows of the second...
void ArrayOfMatrixReadAscii(ArrayOfMatrix &am, const String &am_name, const String &f)
Out2 out2
Level 2 output stream.
void transform(VectorView y, double(&my_func)(double), ConstVectorView x)
A generic transform function for vectors, which can be used to implement mathematical functions opera...
void NumericCopyFirstOfVector(Numeric &x, const String &x_name, const Vector &v, const String &v_name)
See the the online help (arts -d FUNCTION_NAME)
void IndexWriteAscii(const Index &v, const String &v_name, const String &f)
void VectorNLinSpace(Vector &x, const String &x_name, const Numeric &start, const Numeric &stop, const Index &n)
See the the online help (arts -d FUNCTION_NAME)
void VectorCopy(Vector &y2, const String &name_y2, const Vector &y1, const String &name_y1)
See the the online help (arts -d FUNCTION_NAME)
void write_array_of_matrix_to_file(const String &filename, const ArrayOfMatrix &am)
A helper function that writes an array of matrix to a file.
This file contains declerations of functions releated to atmospheric physics or geometry.
void check_length_ncol(const Vector &x, const String &x_name, const Matrix &A, const String &A_name)
Checkss that the length of a vector and the number of columns of a matrix match.
void MatrixCopy(Matrix &y2, const String &name_y2, const Matrix &y1, const String &name_y1)
void Echo(const String &message, const Index &output_level)
See the the online help (arts -d FUNCTION_NAME)
void TagGroupsSpeciesWriteAscii(const TagGroups &tgs, const String &tgs_name, const String &f)
void MatrixWriteAscii(const Matrix &m, const String &m_name, const String &f)
void NumericSet(Numeric &x, const String &x_name, const Numeric &value)
See the the online help (arts -d FUNCTION_NAME)
void VectorPlanck(Vector &y, const String &y_name, const Vector &f, const String &, const Numeric &t)
See the the online help (arts -d FUNCTION_NAME)
void ArrayOfStringWriteAscii(const ArrayOfString &as, const String &as_name, const String &f)
Out0 out0
Level 0 output stream.
void ArrayOfIndexReadAscii(ArrayOfIndex &v, const String &v_name, const String &f)
void VectorScale(Vector &out, const String &out_name, const Vector &in, const String &in_name, const Numeric &value)
See the the online help (arts -d FUNCTION_NAME)
void resize(Index n)
Resize function.
Index nrows() const
Returns the number of rows.
void Exit()
See the the online help (arts -d FUNCTION_NAME)
Joker joker
Define the global joker objekt.
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix Vector multiplication.
void MatrixFillWithVector(Matrix &m, const String &name_m, const Vector &y, const String &name_y, const Index &n)
void VectorSetLengthFromVector(Vector &x, const String &x_name, const Vector &z, const String &, const Numeric &value)
See the the online help (arts -d FUNCTION_NAME)
void ArrayOfStringSet(ArrayOfString &sa, const String &sa_name, const ArrayOfString &sa2)
See the the online help (arts -d FUNCTION_NAME)
void nlogspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
Logarithmically spaced vector with specified length.
A class implementing complex numbers for ARTS.
This can be used to make arrays out of anything.
void MatrixMatrixAdd(Matrix &Y, const String &, const Matrix &M, const Matrix &X, const String &M_name, const String &X_name)
Compute Y = M+X.
void MatrixReadAscii(Matrix &m, const String &m_name, const String &f)
void VectorReadAscii(Vector &v, const String &v_name, const String &f)
Declarations having to do with the four output streams.
void planck(MatrixView B, ConstVectorView f, ConstVectorView t)
Calculates a blackbody radiation (the Planck function) matrix.
void ArrayOfIndexWriteAscii(const ArrayOfIndex &v, const String &v_name, const String &f)
void VectorSet(Vector &x, const String &x_name, const Index &n, const Numeric &value)
See the the online help (arts -d FUNCTION_NAME)
Index ncols() const
Returns the number of columns.
The implementation for String, the ARTS string class.
Out1 out1
Level 1 output stream.
NUMERIC Numeric
The type to use for all floating point numbers.
Index nelem() const
Returns the number of elements.
void MatrixDiagonal(Matrix &x, const String &x_name, const Index &nrows, const Numeric &value)
See the the online help (arts -d FUNCTION_NAME)
void VectorNLogSpace(Vector &x, const String &x_name, const Numeric &start, const Numeric &stop, const Index &n)
See the the online help (arts -d FUNCTION_NAME)
void MatrixScale(Matrix &out, const String &out_name, const Matrix &in, const String &in_name, const Numeric &value)
See the the online help (arts -d FUNCTION_NAME)
void ArrayOfVectorWriteAscii(const ArrayOfVector &av, const String &av_name, const String &f)
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
Contains declerations of basic mathematical and vector/matrix functions.
void VectorLinSpace(Vector &x, const String &x_name, const Numeric &start, const Numeric &stop, const Numeric &step)
See the the online help (arts -d FUNCTION_NAME)
void write_array_of_String_to_file(const String &filename, const ArrayOfString &as)
A help function that writes an array of String to a file.
void ArrayOfMatrixMatrixMultiply(ArrayOfMatrix &Y, const String &, const Matrix &M, const ArrayOfMatrix &X, const String &M_name, const String &X_name)
void VectorWriteAscii(const Vector &v, const String &v_name, const String &f)
void VectorMatrixMultiply(Vector &y, const String &, const Matrix &M, const Vector &x, const String &M_name, const String &x_name)
Compute y = M*x.
void resize(Index r, Index c)
Resize function.
void read_array_of_String_from_file(ArrayOfString &as, const String &filename)
A help function to read an array of String from a file.
void StringSet(String &s, const String &s_name, const String &s2)
See the the online help (arts -d FUNCTION_NAME)
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
Linearly spaced vector with specified length.
void ArrayOfMatrixWriteAscii(const ArrayOfMatrix &am, const String &am_name, const String &f)
void VectorCalcLog10(Vector &out, const String &out_name, const Vector &in, const String &in_name)
See the the online help (arts -d FUNCTION_NAME)
void VectorPressuresForLinAltitudes(Vector &p, const String &, const Vector &p_abs, const Vector &z_abs, const Numeric &delta_z, const Numeric &p_start, const Numeric &p_stop)
void NumericWriteAscii(const Numeric &v, const String &v_name, const String &f)
void NumericCopyLastOfVector(Numeric &x, const String &x_name, const Vector &v, const String &v_name)
See the the online help (arts -d FUNCTION_NAME)
Out3 out3
Level 3 output stream.
void VectorFlip(Vector &y2, const String &name_y2, const Vector &y1, const String &name_y1)
See the the online help (arts -d FUNCTION_NAME)
INDEX Index
The type to use for all integer numbers and indices.
void IndexReadAscii(Index &v, const String &v_name, const String &f)
void VectorAdd(Vector &out, const String &out_name, const Vector &in, const String &in_name, const Numeric &value)
See the the online help (arts -d FUNCTION_NAME)
void ArrayOfStringReadAscii(ArrayOfString &as, const String &as_name, const String &f)
void read_array_of_matrix_from_file(ArrayOfMatrix &am, const String &filename)
A helper function that reads an array of matrix from a file.
void filename_ascii(String &filename, const String &varname)
Gives the default file name for the ASCII formats.
const Numeric DEG2RAD
See the the online help (arts -d FUNCTION_NAME)
void VectorCopyFromMatrix(Vector &v, const String &, const Matrix &m, const String &, const String &orientation, const Index &index)
See the the online help (arts -d FUNCTION_NAME)
void MatrixSet(Matrix &x, const String &x_name, const Index &nrows, const Index &ncols, const Numeric &value)
See the the online help (arts -d FUNCTION_NAME)
void interpp(VectorView x, ConstVectorView p0, ConstVectorView x0, ConstVectorView p)
Interpolates a vertical profile at a new set of pressures.
This file contains basic functions to handle ASCII and binary (HDF) data files.
Explicit construction of Arrays.
void MatrixMatrixMultiply(Matrix &Y, const String &, const Matrix &M, const Matrix &X, const String &M_name, const String &X_name)
Compute Y = M*X.
void StringReadAscii(String &s, const String &s_name, const String &f)
void linspace(Vector &x, const Numeric start, const Numeric stop, const Numeric step)
Linearly spaced vector with specified spacing.
void IndexSet(Index &x, const String &x_name, const Index &value)
See the the online help (arts -d FUNCTION_NAME)
void StringWriteAscii(const String &s, const String &s_name, const String &f)
void write_tag_groups_species_to_file(const String &filename, const TagGroups &tgs)
A help function that writes an array of String to a file.
Index nelem() const
Number of elements.
void z2p(VectorView p, ConstVectorView z0, ConstVectorView p0, ConstVectorView z)
Converts an altitude vector to pressures.
void NumericReadAscii(Numeric &v, const String &v_name, const String &f)
The global header file for ARTS.
void ArrayOfVectorReadAscii(ArrayOfVector &av, const String &av_name, const String &f)