!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Contains integrators, force routines, and a universal Kepler
!! solver.
!!
!! @author  TL, MG, JV
!! @version 2025-05-20
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2015,2016                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Contains generic routines for parameter estimation.
!!
!! @author  MG
!! @version 2016-05-24
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Tools for statistics.
!!
!! @author  MG
!! @version 2025-03-31
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2016,2017                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Contains generic functions that return command line options.
!!
!! @author  MG
!! @version 2017-10-26
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2022,2023                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Contains different mathematical functions.
!!
!! @author  MG
!! @version 2023-04-05
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2022,2023                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Random number generators.
!!
!! @see SphericalCoordinates_class
!!
!! @author  MG
!! @version 2023-04-05
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Tools for building and manipulating data strucures such as trees
!! and lists.
!!
!! @author  MG
!! @version 2025-03-31
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Contains sorting and searching routines.
!!
!! @author  MG
!! @version 2025-03-31
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2022,2023                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! This is a linear algebra module written in Fortran 90. For additional
!! information see the README.txt-file and the linal_doc.ps-file, which are
!! distributed together with this sourcefile (linal.f90).
!!
!! Following routines are included:
!!
!! eigen_decomposition_jacobi - Solves the eigenproblem.
!!
!! sq_matrix_check        - Checks wheter the given matrix is a square
!!                          matrix, if the ranges are ok etc.
!!
!! tri_matrix_check       - Checks wheter the given matrix is a compressed
!!                          tridiagonal matrix, if the ranges are ok etc.
!!
!! vector_check           - Checks wheter the vector ranges are ok.
!!
!! LU_factor              - Finds the LU factorization of a given square
!!                          matrix.
!!
!! LU_solve               - Solves a linear system by using the LU factori-
!!                          zation.
!!
!! LU_separation          - Separates an LU factorization matrix to a lower
!!                          and an upper triangular matrix.
!!
!! matinv                 - Finds the inverse matrix of a given square
!!                          matrix by means of the LU factorization.
!!
!! Gauss_elimination      - Solves a linear system by means of the Gauss
!!                          elimination procedure.
!!
!! tridiagonal_solve      - Solves a tridiagonal linear system.
!!
!! Jacobi_iteration       - Solves a linear system by means of the Jacobi
!!                          iteration procedure.
!!
!! Gauss_Seidel_iteration - Solves a linear system by means of the Gauss-
!!                          Seidel iteration procedure.
!!
!! determinant            - Finds the determinant of a given matrix.
!!
!! cond_number            - Finds the condition number of a given matrix.
!!
!! matrix_norm            - Finds the matrix norm of a given matrix.
!!
!! matrix_print          - Writes the given matrix to the given i/o-unit
!!                          using a nice layout.
!!
!! vector_print          - Writes the given vector to the given i/o-unit
!!                          using a nice layout.
!!
!! outer_product          - Computes the outer product of two given vectors.
!!
!! cross_product          - Computes the cross product of two given vectors.
!!
!! identity_matrix        - Returns the identity matrix of a given
!!                          dimension.
!!
!!
!!
!!
!!   THE tri_matrix_check ROUTINE SHOULD ALWAYS BE CALLED BEFORE CALLING
!!
!!   tridiagonal_solve
!!
!!   THE sq_matrix_check ROUTINE SHOULD ALWAYS BE CALLED BEFORE CALLING
!!
!!   LU_factor
!!   LU_solve
!!   LU_separation
!!   Gauss_elimination
!!   Jacobi_iteration
!!   Gauss_Seidel_iteration
!!   matinv
!!   determinant
!!   cond_number
!!
!!   YOU DON'T NEED TO CALL THE CHECKING ROUTINES, BUT NOT CALLING THEM IS
!!   ADVISABLE ONLY IN CASE YOU KNOW EXACTLY WHAT YOU ARE DOING.
!!
!!
!! @author  MG
!! @version 2023-04-05
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2022,2023                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Independent utilities.
!!
!! @author  MG
!! @version 2023-04-05
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Module*description*:
!!
!! Contains routines for IO of options, orbits and residuals. To be
!! called from main programs.
!!
!! @author  MG, JV, LS, ET
!! @version 2025-05-20
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2022,2023                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Type and routines for spherical coordinates.
!!
!! @see Observations_class
!!
!! @author  MG
!! @version 2023-03-29
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Type and routines for various physical parameters such as absolute
!! magnitude H and slope parameter G and the new H,G1,G2 and H,G12
!! systems.
!!
!! @see StochasticOrbit_class
!!
!! @author  MG, LS
!! @version 2025-05-20
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Type and routines for observatories.
!!
!! @author  MG, JV
!! @version 2025-05-20
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Type and routines for time.
!!
!! @see CartesianCoordinates_class
!! @see SphericalCoordinates_class
!! @see Orbit_class
!!
!! @author  MG, JV
!! @version 2025-04-01
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Generic type and routines for an astrometric observation, which can
!! be presented with spherical coordinates and their time derivatives.
!!
!! @see Observations_class
!!
!! @author  MG, JV, ET
!! @version 2025-05-20
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Type and routines for stochastic orbits (that is, orbital elements
!! with their uncertainties). Contains the algorithms for the
!! [statistical orbital] ranging method and the least-squares method.
!!
!! @author MG, JV, KM, DO, ET
!! @version 2025-05-20
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! This class provides a datatype and routines for handling
!! observations. Only optical astrometric observations given in the
!! old and new <a
!! href="http://cfa-www.harvard.edu/iau/info/OpticalObs.html">MPC</a>
!! formats, the Data Exchange Standard (DES) format, the Lowell
!! format, and the preliminary GAIA formats are supported for the time
!! being. Besides the observations file, indirectly this class also
!! needs a file containing codes and coordinates for observatories
!! (usually OBSCODE.dat).
!!
!! *Example*:
!!
!! <pre>
!! use Base_cl
!! use Observations_cl
!! implicit none
!! type (Observations) :: obss
!! type (File) :: myfile
!! .
!! .
!! .
!! call new(myfile,"myfilen.ame")
!! call open(myfile)
!! call new(obss,myfile)
!! if (error) stop
!! call nullify(obss)
!! </pre>
!!
!! @see StochasticOrbit_class
!!
!! @author  MG, JV, GF, LS, ET
!! @version 2025-05-20
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2014,2015                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Defines a File-object and the basic file handling routines like open,
!! close, read (character string), write (character string) etc.
!!
!! *Example*:
!!
!! <pre>
!!program myprog
!!
!! use File_cl
!! implicit none
!! type (File) :: f1, f2
!! character(len=32) :: str
!!
!! call new(f1, "myfile1.txt")
!! if (error) stop "Error 1"
!!
!! call open(f1)
!! if (error) stop "Error 2"
!!
!! frmt = "(A20)"
!! call readString(f1, trim(frmt), str)
!! if (error) stop "Error 3"
!!
!! call nullify(f1)
!! if (error) stop "Error 4"
!!
!! call new(f2, "myfile2.txt")
!! if (error) stop "Error 5"
!!
!! call open(f2)
!! if (error) stop "Error 6"
!!
!! frmt = "('Copy from myfile1.txt: ',A)"
!! call writeString(f2, trim(frmt), str)
!! if (error) stop "Error 7"
!!
!! call nullify(f2)
!! if (error) stop "Error 8"
!!
!!end program myprog
!! </pre>
!!
!! @author  MG
!! @version 2015-06-15
!!
!! @see Observations_class
!! @see Time_class
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! This is actually not a class in a strict sense, but can anyway be
!! thought of as a sort of a class that all other classes should
!! inherit. It contains the most fundamental parameters, types and
!! routines, that should be available for all classes.
!!
!! IAU units are used (if not otherwise stated):
!! - mass = solar mass
!! - distance = astronomical unit (AU)
!! - time = day
!! - angle = rad
!!
!! @author  MG, JV, TL
!! @version 2025-04-29
!!


!====================================================================!
!                                                                    !
! Copyright 2002,2003,2004,2005,2006,2007,2008,2009                  !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Type and routines for an observatory.
!!
!! @author  MG
!! @version 2008-08-12
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2024,2025                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz, Grigori Fedorets                               !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Type and routines for orbits. Contains the most
!! fundamental routines used in orbital inversion.
!!
!! @see StochasticOrbit_class
!!
!! @author  MG, TL, KM, JV, GF
!! @version 2025-05-20
!!


!====================================================================!
!                                                                    !
! Copyright 2002,2003,2004,2005,2006,2007,2008,2009                  !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Type and routines for static Cartesian coordinates.
!!
!! @see Orbit_class
!!
!! @author  MG, JV, KM, TL
!! @version 2009-12-31
!!


!====================================================================!
!                                                                    !
! Copyright 2002,2003,2004,2005,2006,2007,2008,2009                  !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz                                                 !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! *Class*description*:
!!
!! Type and routines for logical unit handling.
!!
!! @see File_class
!!
!! @author  MG, JV
!! @version 2008-08-12
!!


!====================================================================!
!                                                                    !
! Copyright 2002-2011,2012                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz, Lynne Jones                                    !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! Module for which f2py builds Python wrappers.
!!
!! @author  MG, FP, LJ
!! @version 2012-09-21
!!
!! updated 2018-09-05 by Michael Mommert (sbpy.org)


!
! LSST Data Management System
! Copyright 2008-2017,2018 LSST Corporation, Mikael Granvik
!
! This product includes software developed by the
! LSST Project (http://www.lsst.org/).
!
! This program is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! GNU General Public License for more details.
!
! You should have received a copy of the LSST License Statement and
! the GNU General Public License along with this program.  If not,
! see <http://www.lsstcorp.org/LegalNotices/>.
!
!
! OpenOrb library
! F. Pierfederici <fpierfed@gmail.com>
! M. Granvik <mgranvik@iki.fi>
!
! Description
!
! Notes
! error is a boolean global and is defined somewhere in liboorb.so!
!
!
!
! -------------------------------- IMPORTANT -----------------------------------
! All angles coming in and out are in radians.
! All times coming in and out in MJD TAI
! -------------------------------- IMPORTANT -----------------------------------
!
!
! The way I find out the max value used for errorCodes is:
! $NF is the number of fields in the record and so it points to the last column.
! awk '/errorCode = / { if (x < $NF) x = $NF} END { print x }' *.f90


!====================================================================!
!                                                                    !
! Copyright 2002-2011,2012                                           !
! Mikael Granvik, Jenni Virtanen, Karri Muinonen, Teemu Laakso,      !
! Dagmara Oszkiewicz, Lynne Jones                                    !
!                                                                    !
! This file is part of OpenOrb.                                      !
!                                                                    !
! OpenOrb is free software: you can redistribute it and/or modify it !
! under the terms of the GNU General Public License as published by  !
! the Free Software Foundation, either version 3 of the License, or  !
! (at your option) any later version.                                !
!                                                                    !
! OpenOrb is distributed in the hope that it will be useful, but     !
! WITHOUT ANY WARRANTY; without even the implied warranty of         !
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  !
! General Public License for more details.                           !
!                                                                    !
! You should have received a copy of the GNU General Public License  !
! along with OpenOrb. If not, see <http://www.gnu.org/licenses/>.    !
!                                                                    !
!====================================================================!
!
!! Module for which f2py builds Python wrappers.
!!
!! @author  MG, FP, LJ
!! @version 2012-09-21
!!


! -*- f90 -*-
!! This is a routine to convert between Theta and Hubble and vice-versa.
!! It is taken from the CAMB and CosmoMC codes, but avoids the need for the
!! CAMB/CMB types. Everything interesting was there in CAMB/CosmoMC already.
!! Important: This also assumes that there are no massive neutrinos.


!
! NESDIS_MHS_SnowEM_Module
!
! Module containing the MHS microwave snow emissivity model
!
! References:
!       Yan,B., F.Weng and K.Okamoto,2004: "A microwave snow emissivity model",
!         8th Specialist Meeting on Microwave Radiometry and Remote Sensing Applications,
!         24-27 February, 2004, Rome, Italy.
!
!       Yan,B., F.Weng, H.Meng, and N.Grody, 2007: "Retrieval of Snow Surface Microwave
!         Emissivity from Advanced Microwave Sounding Unit (AMSU),
!         submitted to J.G.R.
!
! CREATION HISTORY:
!       Written by:     Banghua Yan, 05-Oct-2007, banghua.yan@noaa.gov
!


!
! CRTM_Tangent_Linear_Module
!
! Module containing the CRTM tangent-linear model function.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 27-Jan-2005
!                       paul.vandelst@noaa.gov
!


!
! CRTM_IRiceCoeff
!
! Module containing the shared CRTM infrared ice surface emissivity
! data and their load/destruction routines.
!
! PUBLIC DATA:
!   IRiceC:  Data structure containing the infrared ice surface
!            emissivity data.
!
! SIDE EFFECTS:
!       Routines in this module modify the contents of the public
!       data structure IRiceC.
!
! RESTRICTIONS:
!       Routines in this module should only be called during the
!       CRTM initialisation.
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 20-Jan-2012
!                       paul.vandelst@noaa.gov
!


!
! CRTM_IRSSEM
!
! Module containing function to invoke the CRTM Infrared
! Sea Surface Emissivity Model (IRSSEM).
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 22-Jun-2005
!                       paul.vandelst@noaa.gov
!


!
! CRTM_SfcOptics_Define
!
! Module defining the CRTM SfcOptics structure and containing
! routines to manipulate it.
!
!
! CREATION HISTORY:
!       Written by:     Yong Han,       NOAA/NESDIS;     Yong.Han@noaa.gov
!                       Quanhua Liu,    QSS Group, Inc;  Quanhua.Liu@noaa.gov
!                       Paul van Delst, CIMSS/SSEC;      paul.vandelst@ssec.wisc.edu
!                       02-Apr-2004
!


!
! CRTM_IRsnowCoeff
!
! Module containing the shared CRTM infrared snow surface emissivity
! data and their load/destruction routines.
!
! PUBLIC DATA:
!   IRsnowC:  Data structure containing the infrared snow surface
!             emissivity data.
!
! SIDE EFFECTS:
!       Routines in this module modify the contents of the public
!       data structure IRsnowC.
!
! RESTRICTIONS:
!       Routines in this module should only be called during the
!       CRTM initialisation.
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 20-Jan-2012
!                       paul.vandelst@noaa.gov
!


!
! CRTM_SEcategory
!
! Module to compute the surface optical properties using
! a surface type category look-up-table.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 26-Aug-2011
!                       paul.vandelst@noaa.gov
!


!
! Common_RTSolution
!
! Module containing common ancillary functions for
! available radiative transfer algorithms.
!
! CREATION HISTORY:
!       Written by:     David Neil Groff,    IMSG at EMC;    david.groff@noaa.gov
!                       09-Sep-2010


!
! CRTM_ChannelInfo_Define
!
! Module defining the CRTM ChannelInfo data structure and containing
! routines to manipulate it.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 13-May-2004
!                       paul.vandelst@noaa.gov
!


!
! ODSSU_Binary_IO
!
! Module containing routines to read and write Binary format
! ODSSU files.
!
!
! CREATION HISTORY:
!       Written by:     Yong Han, NOAA/NESDIS, Oct. 6, 2009
!
!                       Yong Chen, NOAA/NESDIS, 06-Nov-2009
!                       yong.chen@noaa.gov
!


!
! CRTM_TauCoeff
!
! Module containing the shared CRTM absorption coefficients (TauCoeff)
! and their load/destruction routines.
!
! PUBLIC DATA:
!       TC:  Data structure containing the transmittance model
!            coefficient data for one or multiple transmittance
!            algorithms for the requested sensors.
!
! SIDE EFFECTS:
!       Routines in this module modify the contents of the public
!       data structure TC.
!
! RESTRICTIONS:
!       Routines in this module should only be called during the
!       CRTM initialisation.
!
! CREATION HISTORY:
!       Written by:     Yong Han, JCSDA, NOAA/NESDIS 20-Jun-2008
!       Modified by:    David Groff, SAIC 5-Nov-2009


!
! ACCoeff_Define
!
! Module defining the ACCoeff data structure and containing routines to
! manipulate it.
!
! CREATION HISTORY:
!       Written by:  Paul van Delst, 25-Jan-2011
!                    paul.vandelst@noaa.gov
!


!
! Compare_Float_Numbers
!
! Module containing routines to perform equality and relational
! comparisons on floating point numbers.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 01-Apr-2003
!                       paul.vandelst@noaa.gov
!


!
! Fresnel
!
! Module containing routines to compute Fresnel reflectivities.
!
!
! CREATION HISTORY:
!       Written by:     Masahiro Kazumori, JCSDA
!                       Masahiro.Kazumori@noaa.gov
!       Modified by:    Paul van Delst, CIMSS/SSEC 11-Apr-2007
!                       paul.vandelst@noaa.gov


!
! NESDIS_AMSU_SICEEM_Module
!
! Module containing the AMSU microwave sea ice emissivity model
!
! References:
!       Yan,B., F.Weng and K.Okamoto,2004: "A microwave snow emissivity model",
!         8th Specialist Meeting on Microwave Radiometry and Remote Sensing Applications,
!         24-27 February, 2004, Rome, Italy.
!
!
! CREATION HISTORY:
!       Written by:     Banghua Yan, 16-May-2005, banghua.yan@noaa.gov
!                       Fuzhong Weng, fuzhong.weng@noaa.gov
!


!
! NESDIS_SSMI_SIceEM_Module
!
! Module containing the SSM/Imicrowave sea ice emissivity model
!
! References:
!       Yan,B., F.Weng, and K.Okamoto, 2004, A microwave snow emissivity model,
!         8th Specialist Meeting on Microwave Radiometry and Remote Sensing Applications,
!         24-27 February, 2004, Rome, Italy.
!
!
! CREATION HISTORY:
!       Written by:     Banghua Yan, 16-May-2005, banghua.yan@noaa.gov
!                       Fuzhong Weng, fuzhong.weng@noaa.gov
!
!       Modified by:    Banghua Yan, 10-Sep-2005
!                       Quanhua Liu, quanhua.liu@noaa.gov
!                       Yong Han, yong.han@noaa.gov
!


!
! CRTM_Utility
!
! Module containing CRTM numerical utility routines.
!
! NOTE: This utility is specifically for use with RTSolution codes.
!       Adapted from package of MOM 1991, ASYMTX adapted from DISORT.
!
!
! CREATION HISTORY:
!       Written by:     Quanhua Liu,    Quanhua.Liu@noaa.gov
!                       Yong Han,       Yong.Han@noaa.gov
!                       Paul van Delst, paul.vandelst@noaa.g
!                       08-Jun-2004
!


!
! Binary_File_Utility
!
! Module for utility routines for "Binary" datafiles (unformatted,
! sequential) that conform to the required format.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 12-Jun-2000
!                       paul.vandelst@noaa.gov
!


!
! CRTM_CloudScatter
!
! Module to compute the cloud particle absorption and scattering properties
! required for radiative transfer in a cloudy atmosphere.
!
!
! CREATION HISTORY
!        Written by:     Quanhua Liu,    quanhua.liu@noaa.gov
!                        Yong Han,       yong.han@noaa.gov
!                        Paul van Delst, paul.vandelst@noaa.gov
!                        02-July-2005
!


!
! CRTM_Model_Profiles
!
! Module to define a set of climatological model profiles
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, CIMSS/SSEC 13-Nov-2001
!                       paul.vandelst@noaa.gov
!       Modified by:    Yong Chen, NESDIS/CIRA 22-Aug-2007
!                       Yong.Chen@noaa.gov
!                       Paul van Delst, 22-Oct-2007
!                       paul.vandelst@noaa.gov
!


!
! CRTM_IR_Water_SfcOptics
!
! Module to compute the surface optical properties for WATER surfaces at
! infrared frequencies required for determining the WATER surface
! contribution to the radiative transfer.
!
! This module is provided to allow developers to "wrap" their existing
! codes inside the provided functions to simplify integration into
! the main CRTM_SfcOptics module.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 25-Jun-2005
!                       paul.vandelst@noaa.gov
!


!
! CRTM_GeometryInfo_Define
!
! Module defining the CRTM GeometryInfo container object.
!
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 19-May-2004
!                       paul.vandelst@noaa.gov
!


!
! LSEatlas_Define
!
! Module defining the LSEatlas object.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 17-Aug-2011
!                       paul.vandelst@noaa.gov


!
! CRTM_VIS_Land_SfcOptics
!
! Module to compute the surface optical properties for LAND surfaces at
! visible frequencies required for determining the LAND surface
! contribution to the radiative transfer.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 31-Jan-2012
!                       paul.vandelst@noaa.gov
!


!
! ODSSU_Define
!
! Module defining the ODSSU (Tau coefficient data structure for the SSU sensors).
!
!
! CREATION HISTORY:
!       Written by:     Yong Han, NOAA/NESDIS, Oct. 6, 2009
!
!                       Yong Chen, NOAA/NESDIS, 06-Nov-2009
!                       yong.chen@noaa.gov
!


!
! CSvar_Define
!
! Module defining the CRTM CloudScatter module internal
! variable object.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 14-Feb-2012
!                       paul.vandelst@noaa.gov
!


!
! MWwaterCoeff_Define
!
! Module defining the MWwaterCoeff object.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 10-Nov-2011
!                       paul.vandelst@noaa.gov


!
! CRTM_AtmAbsorption
!
! Module containing routines to compute the optical depth profile
! due to gaseous absorption.
!
!
! CREATION HISTORY:
!       Modifed by:     Yong Han, NESDIS/STAR 25-June-2008
!                       yong.han@noaa.gov


!
! Large_Scale_Correction_Module
!
! Module containing the large-scale correction procedures for the
! CRTM implementations of FASTEM4 and FASTEM5
!
! Equations (A5a) and (A5b) of
!
!   Liu, Q. et al. (2011) An Improved Fast Microwave Water
!     Emissivity Model, TGRSS, 49, pp1238-1250
!
! describes the fitting of the large-scale correction formulation.
! No explicit description of the data that was fitted is given.
!
!
! CREATION HISTORY:
!       Written by:     Original FASTEM authors
!
!       Refactored by:  Paul van Delst, November 2011
!                       paul.vandelst@noaa.gov
!


!
! CRTM_VISsnowCoeff
!
! Module containing the shared CRTM visible snow surface emissivity
! data and their load/destruction routines.
!
! PUBLIC DATA:
!   VISsnowC:  Data structure containing the visible snow surface
!              emissivity data.
!
! SIDE EFFECTS:
!       Routines in this module modify the contents of the public
!       data structure VISsnowC.
!
! RESTRICTIONS:
!       Routines in this module should only be called during the
!       CRTM initialisation.
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 20-Jan-2012
!                       paul.vandelst@noaa.gov
!


!
! NESDIS_SSMI_SnowEM_Module
!
! Module containing the SSM/I microwave snow emissivity model
!
! References:
!       Yan,B., F.Weng, and K.Okamoto, 2004, A microwave snow emissivity model,
!         8th Specialist Meeting on Microwave Radiometry and Remote Sensing Applications,
!         24-27 February, 2004, Rome, Italy.
!
!
! CREATION HISTORY:
!       Written by:     Banghua Yan, 16-May-2005, banghua.yan@noaa.gov
!                       Fuzhong Weng, fuzhong.weng@noaa.gov
!
!       Modified by:    Banghua Yan, 10-Sep-2005
!                       Quanhua Liu, quanhua.liu@noaa.gov
!                       Yong Han, yong.han@noaa.gov
!


!
! ODAS_AtmAbsorption
!
! Module containing routines to compute the optical depth profile
! due to gaseous absorption for the Optical Depth Absorber Space (ODAS)
! model.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 13-May-2004
!                       paul.vandelst@noaa.gov
!
!       Modifed by:     Yong Han, 25-June-2008
!                       yong.han@noaa.gov
!


!
! CRTM_K_Matrix_Module
!
! Module containing the CRTM K-matrix model function.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 28-Jan-2005
!                       paul.vandelst@noaa.gov
!


!
! CRTM_MWwaterCoeff
!
! Module containing the shared CRTM microwave water surface emissivity
! data and their load/destruction routines.
!
! PUBLIC DATA:
!   MWwaterC:  Data structure containing the microwave water surface
!              emissivity data.
!
! SIDE EFFECTS:
!       Routines in this module modify the contents of the public
!       data structure MWwaterC.
!
! RESTRICTIONS:
!       Routines in this module should only be called during the
!       CRTM initialisation.
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 12-Nov-2011
!                       paul.vandelst@noaa.gov
!


!
! ODAS_Binary_IO
!
! Module containing routines to read and write Binary format
! ODAS files.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, CIMSS/SSEC 02-Jan-2003
!                       paul.vandelst@ssec.wisc.edu
!


!
! CRTM_FastemX
!
! Module containing the Fastem4/5/6 procedures. The difference between the Fastem4
! and Fastem5 models is realised purely through the coefficients read during CRTM
! initialisation. For Fastem6, a different azimuth emissivity model is used.
!
! CREATION HISTORY:
!       Written by:     Quanhua (Mark) Liu, Quanhua.Liu@noaa.gov
!                       Stephen English, Stephen.English@metoffice.gov.uk
!                       Fuzhong Weng, Fuzhong.Weng@noaa.gov
!                       July, 2009
!
!       Refactored by:  Paul van Delst, paul.vandelst@noaa.gov
!                       October, 2010
!
!       Modified by:    Quanhua Liu, Quanhua.Liu@noaa.gov
!                       Stephen English, Stephen.English@metoffice.gov.uk
!                       August, 2011
!
!       Refactored by:  Paul van Delst, paul.vandelst@noaa.gov
!                       December, 2011
!
!       Renamed:        Separate Fastem4 and Fastem5 modules replaced with
!                       single module named "FastemX"
!                       Paul van Delst, paul.vandelst@noaa.gov
!                       March, 2012
!
!       Added:          M. Kazumori's azimuthal emissivity model for FASTEM6.
!                       Paul van Delst, paul.vandelst@noaa.gov
!                       January, 2015
!


!
! ODAS_Define
!
! Module defining the ODAS (Optical Depth, Absorber Space) data structure and
! containing routines to manipulate it.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, CIMSS/SSEC 18-Mar-2002
!                       paul.vandelst@ssec.wisc.edu
!


!
! CRTM_AOD_Module
!
! Module containing the CRTM Aerosol Optical Depth (AOD) at nadir
! functions.
!
!
! CREATION HISTORY:
!       Written by:     Quanhua Liu, 29-Jun-2010
!                       Quanhua.Liu@noaa.gov
!


!
! CRTM_Geometry_Define
!
! Module defining the CRTM Geometry data structure.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 18-Nov-2009
!                       paul.vandelst@noaa.gov
!


!
! CRTM_MW_Land_SfcOptics
!
! Module to compute the surface optical properties for LAND surfaces at
! microwave frequencies required for determining the LAND surface
! contribution to the radiative transfer.
!
! This module is provided to allow developers to "wrap" their existing
! codes inside the provided functions to simplify integration into
! the main CRTM_SfcOptics module.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 23-Jun-2005
!                       paul.vandelst@noaa.gov
!


!
! IRwaterCoeff_Define
!
! Module defining the IRwaterCoeff object to hold coefficient
! data for the infrared water surface emissivity and reflectivity models.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 19-Aug-2011
!                       paul.vandelst@noaa.gov


!
! CRTM_Planck_Functions
!
! Module containing the sensor Planck function routines.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, CIMSS/SSEC 08-Aug-2001
!                       paul.vandelst@ssec.wisc.edu
!


!
! Fundamental_Constants
!
! Module containing various fundamental mathematical and physical constants.
!
! The fundamental constants and equations used are taken from the NIST
! Reference on Constants, Units, and Uncertainty website:
!
!   http://physics.nist.gov/cuu/Constants/
!
! See also:
!
!   Mohr, P.J. and B.N. Taylor, "CODATA recommended values of the
!     fundamental physical constants: 1998", Reviews of Modern Physics,
!     Vol.72, No.2, 2000.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 02-May-2000
!                       paul.vandelst@noaa.gov
!


!
! CRTM_Atmosphere
!
! Module for adding layers to the CRTM atmosphere structure as required.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 29-Oct-2007
!                       paul.vandelst@noaa.gov
!


!
! Helper module containing the azimuth emissivity routines for the
! CRTM implementation of FASTEM4 and FASTEM5
!
!
! CREATION HISTORY:
!       Written by:     Original FASTEM1/2/3 authors
!
!       Modified by:    Quanhua Liu, Quanhua.Liu@noaa.gov
!                       Stephen English, Stephen.English@metoffice.gov.uk
!                       July, 2009
!
!       Refactored by:  Paul van Delst, December 2011
!                       paul.vandelst@noaa.gov
!


!
! NLTE_Predictor_Define
!
! Module defining the NLTE_Predictor data structure and containing routines to
! manipulate it.
!
! CREATION HISTORY:
!       Written by:  Paul van Delst, 16-Mar-2011
!                    paul.vandelst@noaa.gov
!


!
! Helper module containing the slope variance routines for the
! CRTM implementation of FASTEM4
!
!
! CREATION HISTORY:
!       Written by:     Original FASTEM1/2/3 authors
!
!       Modified by:    Quanhua Liu, Quanhua.Liu@noaa.gov
!                       Stephen English, Stephen.English@metoffice.gov.uk
!                       July, 2009
!
!       Refactored by:  Paul van Delst, October 2010
!                       paul.vandelst@noaa.gov
!


!
! CRTM_MW_Water_SfcOptics
!
! Module to compute the surface optical properties for WATER surfaces at
! microwave frequencies required for determining the WATER surface
! contribution to the radiative transfer.
!
! This module is provided to allow developers to "wrap" their existing
! codes inside the provided functions to simplify integration into
! the main CRTM_SfcOptics module.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 25-Jun-2005
!                       paul.vandelst@noaa.gov
!


!
! PAFV_Define
!
! Module defining the PAFV object.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 21-Mar-2012
!                       paul.vandelst@noaa.gov


!
! CRTM_AerosolScatter
!
!
! Module to compute the aerosol absorption and scattering properties
! required for radiative transfer in an atmosphere with aerosols.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 15-Feb-2005
!                       paul.vandelst@noaa.gov
!       Modified by     Quanhua Liu, 03-Oct-2006
!                       Quanhua.Liu@noaa.gov
!


!
! CRTM_VIS_Ice_SfcOptics
!
! Module to compute the surface optical properties for ICE surfaces at
! visible frequencies required for determining the ICE surface
! contribution to the radiative transfer.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 31-Jan-2012
!                       paul.vandelst@noaa.gov
!


!
! Hyperbolic step functions for differentiable replacement of IF statements
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 09-Nov-2010
!                       paul.vandelst@noaa.gov
!


!
! CRTM_Predictor_Define
!
! Module containing the definition of the container predictor structure for
! the gaseous absorption transmittance models
!


!
! NESDIS_SnowEM_Parameters
!
! Module containing the parameters related to microwave snow emissivity model
!
!
! CREATION HISTORY:
!       Written by:     Banghua Yan, 03-Jun-2005
!                       banghua.yan@noaa.gov
!                       Fuzhong Weng
!                       fuzhong.weng@noaa.gov
!


!
! Date_Utility
!
! Module containing date conversion routines
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 03-Apr-2000
!                       paul.vandelst@noaa.gov


!
! CloudCoeff_Define
!
! Module defining the CloudCoeff data structure and containing routines to
! manipulate it.
!
!
! CREATION HISTORY:
!       Written by:     Yong Han,       NOAA/NESDIS;     Yong.Han@noaa.gov
!                       Quanhua Liu,    QSS Group, Inc;  Quanhua.Liu@noaa.gov
!                       Paul van Delst, CIMSS/SSEC;      paul.vandelst@ssec.wisc.edu
!


!
! CRTM_Interpolation
!
! Module containing the generic polynomial interpolation
! routines used in the CRTM
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 01-Feb-2007
!                       paul.vandelst@noaa.gov
!


!
! AOvar_Define
!
! Module defining the CRTM AtmOptics module internal
! variable object.
!
!
! CREATION HISTORY:
!       Written by:     Paul van Delst, 01-Jul-2013
!                       paul.vandelst@noaa.gov
!


! Module to define global variables used in 3d_sub.f90 (or 3d_strike.f90)


!------------------------------------------------------------------------!
!  The Community Multiscale Air Quality (CMAQ) system software is in     !
!  continuous development by various groups and is based on information  !
!  from these groups: Federal Government employees, contractors working  !
!  within a United States Government contract, and non-Federal sources   !
!  including research institutions.  These groups give the Government    !
!  permission to use, prepare derivative works of, and distribute copies !
!  of their work in the CMAQ system to the public and to permit others   !
!  to do so.  The United States Environmental Protection Agency          !
!  therefore grants similar permission to use the CMAQ system software,  !
!  but users are requested to provide copies of derivative works or      !
!  products designed to operate in the CMAQ system to the United States  !
!  Government without restrictions as to use by others.  Software        !
!  that is used with the CMAQ system but distributed under the GNU       !
!  General Public License or the GNU Lesser General Public License is    !
!  subject to their copyright restrictions.                              !
!------------------------------------------------------------------------!
! RCS file, release, date & time of last delta, author, state, [and locker]
! $Header: /project/work/rep/STENEX/src/se_snl/se_data_recv_module.f,v 1.2 2006/02/15 14:41:56 yoj Exp $
! what(1) key, module and SID; SCCS file; date and time of last delta:
! %W% %P% %G% %U%
! --------------------------------------------------------------------------
! Purpose:
!
!   use F90 interface feature to achieve "faked" polymorphism for data
!   receiving routine
!
! Revision history:
!
!   Orginal version: 11/05/99 by David Wong
!
!                    12/04/02 by David Wong
!                       -- modified the routine to accommodate worker and
!                          I/O processors partition scheme
!                    10/01/12 by David Wong
!                       -- reduced memory usage
!                       -- extended to five dimensional array
!
! Note:
!
!   se_[n]d[e]_data_recv where [n] denotes the dimensionality of the data
!   and [e] is optional, indicates the first two dimensions are not both
!   decomposed
!
! Subroutine parameter description:
!
!   In:    rind      -- stores low and high index of each dimension for
!                       receiving process
!          recv_from -- stores processor number which data is received from
!          dir_ind   -- one of those eight major communication directions
!          tag       -- message tag
!
!   InOut: data      -- variable that receives data from other processors
! --------------------------------------------------------------------------


!------------------------------------------------------------------------------!
!  The Community Multiscale Air Quality (CMAQ) system software is in           !
!  continuous development by various groups and is based on information        !
!  from these groups: Federal Government employees, contractors working        !
!  within a United States Government contract, and non-Federal sources         !
!  including research institutions.  These groups give the Government          !
!  permission to use, prepare derivative works of, and distribute copies       !
!  of their work in the CMAQ system to the public and to permit others         !
!  to do so.  The United States Environmental Protection Agency                !
!  therefore grants similar permission to use the CMAQ system software,        !
!  but users are requested to provide copies of derivative works or            !
!  products designed to operate in the CMAQ system to the United States        !
!  Government without restrictions as to use by others.  Software              !
!  that is used with the CMAQ system but distributed under the GNU             !
!  General Public License or the GNU Lesser General Public License is          !
!  subject to their copyright restrictions.                                    !
!------------------------------------------------------------------------------!


! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
!


! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
!
! $Id$
!> @brief Simple Advection model
!>
!>  This model is on a periodic one-dimensional domain. A wind field is
!>  modeled using Burger's Equation with an upstream semi-lagrangian
!>  differencing. This diffusive numerical scheme is stable and forcing
!>  is provided by adding in random gaussian noise to each wind grid
!>  variable independently at each timestep. The domain mean value of the
!>  wind is relaxed to a constant fixed value set by the namelist parameter
!>  mean_wind. The random forcing magnitude is set by namelist parameter
!>  wind_random_amp and the damping of the mean wind is controlled by
!>  parameter wind_damping_rate. An Eulerian option with centered in
!>  space differencing is also provided and can be used by setting namelist
!>  parameter lagrangian_for_wind to .false. The Eulerian differencing is
!>  both numerically unstable and subject to shock formation. However, it
!>  can sometimes be made stable in assimilation mode (see recent work by
!>  Majda and collaborators).
!>
!>  The model state includes a single passive tracer that is advected by
!>  the wind field using semi-lagrangian upstream differencing. The state
!>  also includes a tracer source value at each gridpoint. At each time
!>  step, the source is added into the concentration at each gridpoint.
!>  There is also a constant global destruction of tracer that is controlled
!>  by the namelist parameter destruction_rate. The appropriate percentage
!>  of tracer is destroyed at each gridpoint at each timestep.
!>
!>  The model also includes an associated model for the tracer source rate.
!>  At each gridpoint, there is a value of the time mean source rate and
!>  a value of the phase offset for a diurnal component of the source rate.
!>  The diurnal source rate has an amplitude that is proportional to the
!>  source rate (this proportion is controlled by namelist parameter
!>  source_diurnal_rel_amp). At each grid point, the source is the sum
!>  of the source rate plus the appropriate diurnally varying component.
!>  The phase_offset at the gridpoint controls the diurnal phase. The
!>  namelist parameter source_phase_noise controls the amplitude of
!>  random gaussian noise that is added into the source phase at each
!>  time step. If source_phase_noise is zero then the phase offset is
!>  fixed. Finally, the time mean source rate is constant in time in the
!>  present model version. The time mean source rate controls the
!>  amplitude of the diurnal cycle of the tracer source.
!>
!>


! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
!
! @todo
!   * QUAD_LOCATED_CELL_CENTERS - what difference does this make?
!   * t_grid interp for thickess locate and evaluate
!   * vertical location for QTY_DRY_LAND


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!                                                                   !!
!!                   GNU General Public License                      !!
!!                                                                   !!
!! This file is part of the Flexible Modeling System (FMS).          !!
!!                                                                   !!
!! FMS is free software; you can redistribute it and/or modify       !!
!! it and are expected to follow the terms of the GNU General Public !!
!! License as published by the Free Software Foundation.             !!
!!                                                                   !!
!! FMS is distributed in the hope that it will be useful,            !!
!! but WITHOUT ANY WARRANTY; without even the implied warranty of    !!
!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     !!
!! GNU General Public License for more details.                      !!
!!                                                                   !!
!! You should have received a copy of the GNU General Public License !!
!! along with FMS; if not, write to:                                 !!
!!          Free Software Foundation, Inc.                           !!
!!          59 Temple Place, Suite 330                               !!
!!          Boston, MA  02111-1307  USA                              !!
!! or see:                                                           !!
!!          http://www.gnu.org/licenses/gpl.txt                      !!
!!                                                                   !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


! This code may (or may not) be part of the COAMPS distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$


! This code may (or may not) be part of the COAMPS distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!------------------------------
! MODULE:       coamps_flatfile_mod
! AUTHOR:       T. R. Whitcomb and P. A. Reinecke
!               Naval Research Laboratory
! DART VERSION: Jamaica
!
! Module containing the data structure and routines for dealing with
! COAMPS flat files.
!------------------------------


! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
!
! $Id$
! BEGIN DART PREPROCESS KIND LIST
! GEOPOTENTIAL_HEIGHT,   QTY_GEOPOTENTIAL_HEIGHT
! LOG_SPECIFIC_HUMIDITY, QTY_SPECIFIC_HUMIDITY
! AIR_TEMPERATURE,       QTY_TEMPERATURE
! U_WIND_COMPONENT,      QTY_U_WIND_COMPONENT
! V_WIND_COMPONENT,      QTY_V_WIND_COMPONENT
! END DART PREPROCESS KIND LIST
! BEGIN DART PREPROCESS USE OF SPECIAL OBS_DEF MODULE
!   use obs_def_navdas_mod, only : get_expected_geopotential_height,&
!                                  get_expected_log_specific_humidity,&
!                                  get_expected_air_temperature,&
!                                  get_expected_wind_component
! END DART PREPROCESS USE OF SPECIAL OBS_DEF MODULE
! BEGIN DART PREPROCESS GET_EXPECTED_OBS_FROM_DEF
!         case(GEOPOTENTIAL_HEIGHT)
!            call get_expected_geopotential_height(state, location, &
!                                                  obs_val, istatus)
!         case(LOG_SPECIFIC_HUMIDITY)
!            call get_expected_log_specific_humidity(state, location,&
!                                                    obs_val, istatus)
!         case(AIR_TEMPERATURE)
!            call get_expected_air_temperature(state, location,&
!                                              obs_val,istatus)
!         case(U_WIND_COMPONENT)
!            call get_expected_wind_component(state, location,1,&
!                                             obs_val,istatus)
!         case(V_WIND_COMPONENT)
!            call get_expected_wind_component(state, location,2,&
!                                             obs_val,istatus)
! END DART PREPROCESS GET_EXPECTED_OBS_FROM_DEF
! BEGIN DART PREPROCESS READ_OBS_DEF
!         case(GEOPOTENTIAL_HEIGHT)
!            continue
!         case(LOG_SPECIFIC_HUMIDITY)
!            continue
!         case(AIR_TEMPERATURE)
!            continue
!         case(U_WIND_COMPONENT)
!            continue
!         case(V_WIND_COMPONENT)
!            continue
! END DART PREPROCESS READ_OBS_DEF
! BEGIN DART PREPROCESS WRITE_OBS_DEF
!         case(GEOPOTENTIAL_HEIGHT)
!            continue
!         case(LOG_SPECIFIC_HUMIDITY)
!            continue
!         case(AIR_TEMPERATURE)
!            continue
!         case(U_WIND_COMPONENT)
!            continue
!         case(V_WIND_COMPONENT)
!            continue
! END DART PREPROCESS WRITE_OBS_DEF
! BEGIN DART PREPROCESS INTERACTIVE_OBS_DEF
!         case(GEOPOTENTIAL_HEIGHT)
!            continue
!         case(LOG_SPECIFIC_HUMIDITY)
!            continue
!         case(AIR_TEMPERATURE)
!            continue
!         case(U_WIND_COMPONENT)
!            continue
!         case(V_WIND_COMPONENT)
!            continue
! END DART PREPROCESS INTERACTIVE_OBS_DEF
! BEGIN DART PREPROCESS MODULE CODE


! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
!
! TODOs
!  - Nick Dietrich fix_mmr. When do to this?
!  - model_time
!  - get_state_meta_data 2D variables


! This code is not protected by the DART copyright agreement.
! DART $Id$
! This is the only file from the rose source distribution needed
! for the DART interfaces. It is included only so that we can build
! the DART routines as part of our code maintenance. - TJH


! This code is not protected by the DART copyright agreement.
! DART $Id$
!============================================================
! a module to be used with spectral surface-based models.
!============================================================


! This code may (or may not) be part of the GITM distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!^CFG COPYRIGHT UM
!BOP
!MODULE: ModKind - define various precisions in a machine independent way
!DESCRIPTION:
! The Fortran 77 style real*4 and real*8 declarations are obsolete,
! and compilers often issue warnings. The real and double precision
! types are machine and compiler flag dependent.
! The Fortran 90 way is to define the {\bf kind} parameter.
! Typical usage:
!\begin{verbatim}
! real(Real8_) :: CpuTime  ! variable declaration
! CpuTime = 0.0_Real8_     ! 8 byte real constant
!\end{verbatim}
!INTERFACE:


! DART software - Copyright UCAR. This open source software is provided
! by ucar, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/dares/dart/dart_download
!
!----------------------------------------------------------------
!>
!> this is the interface between the cam-fv atmosphere model and dart.
!> the required public interfaces and arguments cannot be changed.
!>
!----------------------------------------------------------------


! DART software - Copyright UCAR. This open source software is provided
! by ucar, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/dares/dart/dart_download
!
! $Id$
!----------------------------------------------------------------
!>
!> this routines supports unit conversions between chemistry values
!> in the cam state and the observed quantities
!>
!----------------------------------------------------------------


! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
!
! $Id$
!----------------------------------------------------------------
!>
!> This is the interface between the ROMS ocean model and DART.
!> The required public interfaces arguments CANNOT be changed.
!>
!> Written in collaboration between Hernan Arango, Andy Moore, Chris Edwards
!> and the DART team. Uses/requires precomputed forward operator
!> values output directly from ROMS (i.e. the output of s4dvar.in:MODname).
!> The obs values are computed at the exact time of the obs as the model
!> is advancing (FGAT - First Guess at Appropriate Time). As a result,
!> there is currently NO model_interpolate() routine, since all
!> the observations already have expected values. What is required is
!> the ability to convert -on-demand- a DART observation sequence file
!> from the ROMS observation format. This is done with the convert_roms_obs
!> program in observations/ROMS.
!>
!> If required for other obs, the model_interpolate code will
!> need to be written and tested.
!>
!> The ROMS model uses a mask array to indicate dry land, so inside
!> DART and this model mod we can ignore dry land completely.  there
!> is no need to read the mask or account for it in get_state_meta_data
!> or get_close.
!>
!----------------------------------------------------------------


! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
!
! DART $Id$
!> Interpolation routines for longitude/latitude grids which are logically
!> rectangular and either fully regular, partially regular or fully deformed.
!>
!> This module includes initialization, search, interpolation, and finalization
!> routines.
!>
!> The size of the grid is specified by a count of the longitudes and latitudes.
!>
!> The actual coordinates of the grid can be specified in one of 3 ways:
!>
!>    fully regular grid, evenly spaced and fully orthogonal:
!>     (origin, delta) each for lon and lat.
!>
!>    fully orthogonal but possibly irregularly spaced along the axes:
!>     1D array(counts) each for lon and lat.
!>
!>    logically rectangular but corners of quads are fully irregular:
!>     2D array(lon counts, lat counts) each for lon and lat.
!>
!> To search for a given location and return the (i,j) indices of the
!> corners of the enclosing quad:
!>
!>    for the fully regular grid the enclosing quad is found by computing
!>    the corresponding (i,j) indices.
!>
!>    for the irregularly spaced grid, the enclosing quad is found by searching
!>    each of the 1D arrays for the enclosing (i,j) indices.
!>
!>    For the fully irregular grid, the enclosing quad is found by this process:
!>     At setup time:
!>     1) create a coarse fully regular grid.
!>     2) compute the intersection of each regular grid box with the target grid quads
!>     3) keep a list of which target grid quads overlap for each regular grid box.
!>     At search time:
!>     4) find the location in the fully regular grid (which can be done quickly)
!>     5) do an exhaustive search of the target grid quads which overlap that
!>        regular grid box, returning when one of the target grid quads encloses
!>        the given location.
!>


! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
!
! DART $Id$


! DART software - Copyright UCAR. This open source software is provided
! by UCAR, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/DAReS/DART/DART_download
!
! $Id$
!> Interface to Lorenz-04 3-variable model


! DART software - Copyright UCAR. This open source software is provided
! by ucar, "as is", without charge, subject to all terms of use at
! http://www.image.ucar.edu/dares/dart/dart_download
!
!----------------------------------------------------------------
!>
!> this is the interface between the cam-se atmosphere model and dart.
!> the required public interfaces and arguments cannot be changed.
!>
!----------------------------------------------------------------


! This code may (or may not) be part of the COAMPS distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!------------------------------
! MODULE:       coamps_statevar_mod
! AUTHOR:       T. R. Whitcomb
!               Naval Research Laboratory
! DART VERSION: Jamaica
!
! Module containing the data structure and routines for dealing with
! a COAMPS state variable
!------------------------------


! This code may (or may not) be part of the COAMPS distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!------------------------------
! MODULE:       coamps_translate_mod
! AUTHOR:       T. R. Whitcomb
!               Naval Research Laboratory
! DART VERSION: Jamaica
!
! Module containing storage for a DART state vector, a COAMPS state
! vector (spanning multiple restart files in the case of multi-
! processor I/O), and routines to read/write them and convert
! one to another.
!
! The DART time structure is represented as days and seconds, and
! I've included several routines in here to deal with converting
! the time to hours/minutes/seconds with no respect to dates
! (since we're restricting to a single date-time group).
!------------------------------


! This code may (or may not) be part of the GITM distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!------------------------------
! MODULE:       coamps_pert_mod
! AUTHOR:       T. R. Whitcomb
!               Naval Research Laboratory
! DART VERSION: Jamaica
!
! Module for perturbing
!------------------------------


! This code may (or may not) be part of the COAMPS distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!------------------------------
! MODULE:       coamps_statevec_mod
! AUTHOR:       T. R. Whitcomb
!               Naval Research Laboratory
! DART VERSION: Jamaica
!
! Module containing the data structure and routines for dealing with
! a COAMPS state vector (a collection of COAMPS state variables)
!------------------------------


! This code may (or may not) be part of the COAMPS distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!------------------------------
! MODULE:       coamps_vertical_mod
! AUTHOR:       T. R. Whitcomb
!               Naval Research Laboratory
! DART VERSION: Jamaica
!
! Module containing data structures and routines for dealing
! with the vertical component of a coamps domain
!------------------------------


! This code may (or may not) be part of the COAMPS distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!------------------------------
! MODULE:       coamps_netcdf_mod
! AUTHOR:       T. R. Whitcomb
!               Naval Research Laboratory
! DART VERSION: Jamaica
!
! Write COAMPS state vector to a NetCDF file
!------------------------------


! This code may (or may not) be part of the COAMPS distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!------------------------------
! MODULE:       coamps_nest_mod
! AUTHOR:       T. R. Whitcomb
!               Naval Research Laboratory
! DART VERSION: Jamaica
!
! Module containing data structures and routines for dealing
! with the nest component of a coamps domain
!------------------------------


! This code may (or may not) be part of the COAMPS distribution,
! So it is not protected by the DART copyright agreement.
!
! DART $Id$
!------------------------------
! MODULE:       coamps_map_mod
! AUTHOR:       T. R. Whitcomb
!               Naval Research Laboratory
! DART VERSION: Jamaica
!
! Module containing data structures and routines for dealing
! with the map component of a coamps domain
!------------------------------