[Dart-dev] DART/branches Revision: 12697

dart at ucar.edu dart at ucar.edu
Fri Jun 29 09:50:35 MDT 2018


nancy at ucar.edu
2018-06-29 09:50:35 -0600 (Fri, 29 Jun 2018)
310
this is to the recam branch.  i have a collection of small
obs utilities that i've written over the last few years
and they never seem to make it into the repo anywhere.
i'm adding them to this branch just so they exist someplace
and we can decide later if any are interesting enough to
move to the releases.




Added: DART/branches/recam/assimilation_code/programs/obs_utils/create_obs_grid.f90
===================================================================
--- DART/branches/recam/assimilation_code/programs/obs_utils/create_obs_grid.f90	                        (rev 0)
+++ DART/branches/recam/assimilation_code/programs/obs_utils/create_obs_grid.f90	2018-06-29 15:50:35 UTC (rev 12697)
@@ -0,0 +1,160 @@
+! DART software - Copyright © 2004 - 2010 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
+
+program create_obs_grid
+
+use    utilities_mod, only : register_module, open_file, close_file, &
+                             initialize_utilities, finalize_utilities
+use obs_sequence_mod, only : obs_sequence_type, interactive_obs, write_obs_seq, &
+                             static_init_obs_sequence
+use  assim_model_mod, only : static_init_assim_model
+use location_mod
+use obs_def_mod
+use obs_kind_mod
+use obs_sequence_mod
+use time_manager_mod
+
+implicit none
+
+! version controlled file description for error handling, do not edit
+character(len=128), parameter :: &
+   source   = "$URL$", &
+   revision = "$Revision$", &
+   revdate  = "$Date$"
+character(len=128), parameter :: id  = "$Id$"
+
+type(obs_sequence_type) :: seq
+character(len = 129)    :: file_name
+
+! Record the current time, date, etc. to the logfile
+call initialize_utilities('create_obs_grid')
+call register_module(source, revision, revdate)
+
+! Initialize the assim_model module, need this to get model
+! state meta data for locations of identity observations
+call static_init_assim_model()
+
+! Initialize the obs_sequence module
+call static_init_obs_sequence()
+
+! Create grid of obs
+seq = create_grid()
+
+! Write the sequence to a file
+write(*, *) 'Input filename for sequence (  obs_seq.in   usually works well)'
+read(*, *) file_name
+call write_obs_seq(seq, file_name)
+
+! Clean up
+call finalize_utilities('create_obs_grid')
+
+contains
+
+function create_grid()
+ type(obs_sequence_type) :: create_grid
+
+type(obs_type)     :: obs, prev_obs
+type(obs_def_type) :: obs_def
+type(time_type)    :: obs_time, prev_time
+type(location_type) :: loc
+integer            :: max_num_grids, num_copies, num_qc, end_it_all, max_num_obs
+integer            :: num_dim, n(3), i, j, k, l
+
+! these things aren't prompted for - they're fixed in the code
+num_copies = 1
+num_qc     = 0
+max_num_obs = 1000000   ! FIXME: made up
+
+write(*, *) 'Input upper bound on number of grids of observations in sequence'
+read(*, *) max_num_grids
+
+! Initialize an obs_sequence structure
+call init_obs_sequence(create_grid, num_copies, num_qc, max_num_obs)
+
+do i = 1, num_copies
+   call set_copy_meta_data(create_grid, i, 'observations')
+end do
+
+! Initialize the obs variable
+call init_obs(obs, num_copies, num_qc)
+call init_obs(prev_obs, num_copies, num_qc)
+
+! Loop to initialize each observation in turn; terminate by -1
+do l = 1, max_num_grids
+   write(*, *) 'input a -1 if there are no more grids'
+
+
+   read(*, *) end_it_all
+   if(end_it_all == -1) exit
+
+   ! FIXME: this is the corner of a grid, need to prompt for
+   ! extents in each dim (2d or 3d) and number of points in same.
+   ! then loop below using same type and error, just bumping
+   ! location each time.
+
+   write(*, *) 'the location of the next observation defines the corner of a box'


More information about the Dart-dev mailing list