[Dart-dev] [3836] DART/trunk/observations: initial pieces to convert observation sequence files to netCDF and rudimentary plot

nancy at ucar.edu nancy at ucar.edu
Thu Apr 30 18:25:15 MDT 2009


An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20090430/c24b7878/attachment-0001.html 
-------------- next part --------------
Modified: DART/trunk/observations/quikscat/work/input.nml
===================================================================
--- DART/trunk/observations/quikscat/work/input.nml	2009-04-30 23:12:03 UTC (rev 3835)
+++ DART/trunk/observations/quikscat/work/input.nml	2009-05-01 00:25:15 UTC (rev 3836)
@@ -17,13 +17,13 @@
  /
 
 &obs_sequence_nml
-   write_binary_obs_sequence = .false. 
+   write_binary_obs_sequence = .true. 
  /
 
 &convert_L2b_nml
     datadir = '/fs/image/home/thoar/DART/observations/quikscat/data',
    l2b_file = 'QS_S2B44444.20080021548',
    outputdir = '.',
-   lon1 = 0.0, lon2 = 360.0, lat1 = -90.0, lat2 = 90.0
+   lon1 = 0.0, lon2 = 360.0, lat1 = -0.0, lat2 = 90.0
  /
 

Modified: DART/trunk/observations/quikscat/work/mkmf_convert_L2b
===================================================================
--- DART/trunk/observations/quikscat/work/mkmf_convert_L2b	2009-04-30 23:12:03 UTC (rev 3835)
+++ DART/trunk/observations/quikscat/work/mkmf_convert_L2b	2009-05-01 00:25:15 UTC (rev 3836)
@@ -23,4 +23,4 @@
  -l "${MYINCDIR} -L/usr/lib64 ${MYLIBDIR} ${MYLIBS}" \
  -a "../../.." path_names_convert_L2b
 
-#-o "-ffixed-line-length-132 -I${HDFDIR}/include} -L/usr/lib64 -L${HDFDIR}/lib ${HDFLIBS}" \
+#-o "-ffixed-line-length-132 -I${HDFDIR}/include -L/usr/lib64 -L${HDFDIR}/lib ${HDFLIBS}" \

Added: DART/trunk/observations/utilities/threed_sphere/input.nml
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/input.nml	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/input.nml	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,104 @@
+
+&preprocess_nml
+    input_obs_kind_mod_file = '../../../obs_kind/DEFAULT_obs_kind_mod.F90',
+   output_obs_kind_mod_file = '../../../obs_kind/obs_kind_mod.f90',
+     input_obs_def_mod_file = '../../../obs_def/DEFAULT_obs_def_mod.F90',
+    output_obs_def_mod_file = '../../../obs_def/obs_def_mod.f90',
+   input_files              = '../../../obs_def/obs_def_reanalysis_bufr_mod.f90',
+                              '../../../obs_def/obs_def_radar_mod.f90',
+                              '../../../obs_def/obs_def_metar_mod.f90',
+                              '../../../obs_def/obs_def_dew_point_mod.f90',
+                              '../../../obs_def/obs_def_QuikSCAT_mod.f90',
+                              '../../../obs_def/obs_def_altimeter_mod.f90',
+                              '../../../obs_def/obs_def_gps_mod.f90',
+                              '../../../obs_def/obs_def_vortex_mod.f90'  /
+
+&assim_tools_nml
+   /
+
+&obs_kind_nml
+   /
+
+&location_nml
+   /
+
+&obs_sequence_nml
+   write_binary_obs_sequence = .false.  /
+
+&utilities_nml
+   TERMLEVEL = 1,
+   module_details = .true.,
+   logfilename = 'dart_log.out',
+   nmlfilename = 'dart_log.nml'
+   /
+
+#  bin_interval_seconds = 21600,
+&schedule_nml
+   calendar       = 'Gregorian',
+   bin_start      =  2006, 8, 1, 3, 0, 0 ,
+   bin_end        =  2006, 8, 1, 9, 0, 0 ,
+   last_bin_end   =  2006, 8, 5, 0, 0, 0 ,
+   bin_interval_days    = 0,
+   bin_interval_seconds = 21600,
+   max_num_bins         = 1000,
+   print_table          = .true.
+   /
+
+&obs_seq_to_netcdf_nml
+   obs_sequence_name = 'obs_seq.final'
+   lonlim1    =    0.0,
+   lonlim2    =  360.0,
+   latlim1    =  -80.0,
+   latlim2    =   80.0,
+   verbose    = .true.
+   /
+
+#  obs_sequence_name = '/users/thoar/temp/obs_0001/obs_seq.final'
+&wind_obs_to_table_nml
+   obs_sequence_name = 'obs_seq.final'
+   lonlim1    =    0.0,
+   lonlim2    =  360.0,
+   latlim1    =  -80.0,
+   latlim2    =   80.0,
+   verbose    = .true.
+   /
+
+&obs_diag_nml
+   obs_sequence_name = 'obs_seq.final',
+   first_bin_center =  2003, 1, 1, 0, 0, 0 ,
+   last_bin_center  =  2003, 1, 2, 0, 0, 0 ,
+   bin_separation   =     0, 0, 0,12, 0, 0 ,
+   bin_width        =     0, 0, 0, 6, 0, 0 ,
+   time_to_skip     =     0, 0, 0, 0, 0, 0 ,
+   max_num_bins     = 1000,
+   rat_cri            = 5000.0,
+   input_qc_threshold = 4.0,
+   Nregions   = 1,
+   lonlim1    =   0.0,   0.0,   0.0, 235.0,
+   lonlim2    = 360.0, 360.0, 360.0, 295.0,
+   latlim1    =  20.0, -80.0, -20.0,  25.0,
+   latlim2    =  80.0, -20.0,  20.0,  55.0,
+   reg_names  = 'Northern Hemisphere', 'Southern Hemisphere', 'Tropics', 'North America',
+   print_mismatched_locs = .false.,
+   print_obs_locations   = .false.,
+   verbose               = .false.
+   /
+
+
+&obs_sequence_tool_nml
+   num_input_files = 1, 
+   filename_seq = 'obs_seq.out',
+   filename_out = 'obs_seq.processed', 
+   first_obs_days = -1, 
+   first_obs_seconds = -1, 
+   last_obs_days = -1, 
+   last_obs_seconds = -1, 
+   obs_types = '', 
+   keep_types = .false., 
+   print_only = .false., 
+   min_lat = -90.0, 
+   max_lat = 90.0, 
+   min_lon = 0.0, 
+   max_lon = 360.0
+   /
+


Property changes on: DART/trunk/observations/utilities/threed_sphere/input.nml
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: DART/trunk/observations/utilities/threed_sphere/mkmf_obs_diag
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/mkmf_obs_diag	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/mkmf_obs_diag	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,15 @@
+#!/bin/csh
+#
+# Data Assimilation Research Testbed -- DART
+# Copyright 2004-2007, Data Assimilation Research Section
+# University Corporation for Atmospheric Research
+# Licensed under the GPL -- www.gpl.org/licenses/gpl.html
+#
+# <next few lines under version control, do not edit>
+# $URL$
+# $Id$
+# $Revision$
+# $Date$
+#
+../../../mkmf/mkmf -p obs_diag -t ../../../mkmf/mkmf.template -c"-Duse_netCDF" \
+ -a "../../.." path_names_obs_diag


Property changes on: DART/trunk/observations/utilities/threed_sphere/mkmf_obs_diag
___________________________________________________________________
Name: svn:executable
   + *
Name: mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: DART/trunk/observations/utilities/threed_sphere/mkmf_obs_seq_to_netcdf
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/mkmf_obs_seq_to_netcdf	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/mkmf_obs_seq_to_netcdf	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,15 @@
+#!/bin/csh
+#
+# Data Assimilation Research Testbed -- DART
+# Copyright 2004-2007, Data Assimilation Research Section
+# University Corporation for Atmospheric Research
+# Licensed under the GPL -- www.gpl.org/licenses/gpl.html
+#
+# <next few lines under version control, do not edit>
+# $URL$
+# $Id$
+# $Revision$
+# $Date$
+#
+../../../mkmf/mkmf -p obs_seq_to_netcdf -t ../../../mkmf/mkmf.template -c"-Duse_netCDF" \
+ -a "../../.." path_names_obs_seq_to_netcdf


Property changes on: DART/trunk/observations/utilities/threed_sphere/mkmf_obs_seq_to_netcdf
___________________________________________________________________
Name: svn:executable
   + *
Name: mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: DART/trunk/observations/utilities/threed_sphere/mkmf_obs_sequence_tool
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/mkmf_obs_sequence_tool	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/mkmf_obs_sequence_tool	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,15 @@
+#!/bin/csh
+#
+# Data Assimilation Research Testbed -- DART
+# Copyright 2004-2007, Data Assimilation Research Section
+# University Corporation for Atmospheric Research
+# Licensed under the GPL -- www.gpl.org/licenses/gpl.html
+#
+# <next few lines under version control, do not edit>
+# $URL$
+# $Id$
+# $Revision$
+# $Date$
+#
+../../../mkmf/mkmf -p obs_sequence_tool -t ../../../mkmf/mkmf.template -c"-Duse_netCDF" \
+ -a "../../.." path_names_obs_sequence_tool


Property changes on: DART/trunk/observations/utilities/threed_sphere/mkmf_obs_sequence_tool
___________________________________________________________________
Name: svn:executable
   + *
Name: mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: DART/trunk/observations/utilities/threed_sphere/mkmf_preprocess
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/mkmf_preprocess	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/mkmf_preprocess	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,15 @@
+#!/bin/csh
+#
+# Data Assimilation Research Testbed -- DART
+# Copyright 2004-2007, Data Assimilation Research Section
+# University Corporation for Atmospheric Research
+# Licensed under the GPL -- www.gpl.org/licenses/gpl.html
+#
+# <next few lines under version control, do not edit>
+# $URL$
+# $Id$
+# $Revision$
+# $Date$
+#
+../../../mkmf/mkmf -p preprocess -t ../../../mkmf/mkmf.template -c"-Duse_netCDF" \
+ -a "../../.." path_names_preprocess


Property changes on: DART/trunk/observations/utilities/threed_sphere/mkmf_preprocess
___________________________________________________________________
Name: svn:executable
   + *
Name: mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: DART/trunk/observations/utilities/threed_sphere/path_names_obs_diag
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/path_names_obs_diag	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/path_names_obs_diag	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,14 @@
+assim_model/assim_model_mod.f90
+common/types_mod.f90
+diagnostics/threed_sphere/obs_diag.f90
+location/threed_sphere/location_mod.f90
+models/template/model_mod.f90
+mpi_utilities/null_mpi_utilities_mod.f90
+obs_def/obs_def_mod.f90
+obs_kind/obs_kind_mod.f90
+obs_sequence/obs_sequence_mod.f90
+random_nr/random_nr_mod.f90
+random_seq/random_seq_mod.f90
+sort/sort_mod.f90
+time_manager/time_manager_mod.f90
+utilities/utilities_mod.f90

Added: DART/trunk/observations/utilities/threed_sphere/path_names_obs_seq_to_netcdf
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/path_names_obs_seq_to_netcdf	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/path_names_obs_seq_to_netcdf	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,14 @@
+assim_model/assim_model_mod.f90
+common/types_mod.f90
+diagnostics/threed_sphere/obs_seq_to_netcdf.f90
+location/threed_sphere/location_mod.f90
+models/template/model_mod.f90
+mpi_utilities/null_mpi_utilities_mod.f90
+obs_def/obs_def_mod.f90
+obs_kind/obs_kind_mod.f90
+obs_sequence/obs_sequence_mod.f90
+random_nr/random_nr_mod.f90
+random_seq/random_seq_mod.f90
+time_manager/schedule_mod.f90
+time_manager/time_manager_mod.f90
+utilities/utilities_mod.f90

Added: DART/trunk/observations/utilities/threed_sphere/path_names_obs_sequence_tool
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/path_names_obs_sequence_tool	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/path_names_obs_sequence_tool	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,13 @@
+assim_model/assim_model_mod.f90
+common/types_mod.f90
+location/threed_sphere/location_mod.f90
+models/template/model_mod.f90
+mpi_utilities/null_mpi_utilities_mod.f90
+obs_def/obs_def_mod.f90
+obs_kind/obs_kind_mod.f90
+obs_sequence/obs_sequence_mod.f90
+obs_sequence/obs_sequence_tool.f90
+random_nr/random_nr_mod.f90
+random_seq/random_seq_mod.f90
+time_manager/time_manager_mod.f90
+utilities/utilities_mod.f90

Added: DART/trunk/observations/utilities/threed_sphere/path_names_preprocess
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/path_names_preprocess	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/path_names_preprocess	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,5 @@
+common/types_mod.f90
+mpi_utilities/null_mpi_utilities_mod.f90
+preprocess/preprocess.f90
+time_manager/time_manager_mod.f90
+utilities/utilities_mod.f90

Added: DART/trunk/observations/utilities/threed_sphere/plot_obs_netcdf.m
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/plot_obs_netcdf.m	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/plot_obs_netcdf.m	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,94 @@
+function obsstruct = plot_obs_netcdf(fname, ObsTypeString, region, ObsString, QCString, verbose)
+%
+% fname         = 'obs_sequence_001.nc';
+% ObsTypeString = 'RADIOSONDE_U_WIND_COMPONENT';
+% region        = [0 360 -90 90 -Inf Inf];
+% ObsString     = 'NCEP BUFR observation';
+% QCString      = 'DART quality control';
+% verbose       = 1;   % anything > 0 == 'true'
+%
+% bob = plot_obs_netcdf(fname, ObsTypeString, region, ObsString, QCString, verbose);
+
+ObsTypes       = nc_varget(fname,'ObsTypes');
+ObsTypeStrings = nc_varget(fname,'ObsTypesMetaData');
+CopyStrings    = nc_varget(fname,'CopyMetaData');
+QCStrings      = nc_varget(fname,'QCMetaData');
+
+t              = nc_varget(fname,'time');
+obs_type       = nc_varget(fname,'obs_type');
+z              = nc_varget(fname,'which_vert');
+
+loc            = nc_varget(fname,'location');
+obs            = nc_varget(fname,'observations');
+qc             = nc_varget(fname,'qc');
+
+my_types = unique(obs_type);  % only ones in the file, actually.
+
+% Echo summary if requested
+
+if ( verbose > 0 ) 
+   for i = 1:length(my_types)
+      obtype = my_types(i);
+      inds   = find(obs_type == obtype);
+      myz    = loc(inds,3);
+     
+      disp(sprintf('N = %6d %s obs (type %3d) between levels %.2f and %.2f', ...
+               length(inds), ObsTypeStrings(obtype,:), obtype, ...
+               unique(min(myz)), unique(max(myz))))
+   end
+
+%  uniquelevels = unique(loc(:,3));
+
+%  for i = 1:length(uniquelevels)
+%     mylevel = uniquelevels(i);
+%     inds    = find(loc(:,3) == mylevel);
+%     disp(sprintf('level %2d %f has %d observations',i,mylevel,length(inds)))
+%  end
+
+end
+
+mytypeind = get_copy_index(fname, ObsString);
+myQCind   =   get_qc_index(fname,  QCString);
+
+% Find observations of a the correct type.
+
+myind  = strmatch(ObsTypeString,ObsTypeStrings);
+inds   = find(obs_type == myind);
+mylocs = loc(inds,:);
+myqc   =  qc(inds,myQCind);
+myobs  = obs(inds,mytypeind);
+
+% geographic subset if needed
+
+inds = locations_in_region(mylocs,region);
+
+obsstruct.lons = mylocs(inds,1);
+obsstruct.lats = mylocs(inds,2);
+obsstruct.z    = mylocs(inds,3);
+obsstruct.obs  =  myobs(inds);
+obsstruct.qc   =   myqc(inds);
+
+xmin = min(region(1:2));
+xmax = max(region(1:2));
+ymin = min(region(3:4));
+ymax = max(region(3:4));
+zmin = min(obsstruct.z);
+zmax = max(obsstruct.z);
+
+y1 = 36;
+yN = 10*y1;
+x1 = min(obsstruct.obs);
+xN = max(obsstruct.obs);
+slope = (yN-y1)/(xN-x1);
+b = y1 - slope*x1;
+
+scalarray = obsstruct.obs*slope + b;
+
+h = scatter(obsstruct.lons,obsstruct.lats,scalarray,obsstruct.obs,'d','filled');
+axis image
+axis([xmin xmax ymin ymax])
+worldmap;
+colorbar;
+title(sprintf('level (%.2f - %.2f) %s (%d locations)',zmin,zmax, ...
+       ObsTypeString,length(inds)), 'Interpreter','none');
+


Property changes on: DART/trunk/observations/utilities/threed_sphere/plot_obs_netcdf.m
___________________________________________________________________
Name: svn:mime-type
   + text/x-matlab
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: DART/trunk/observations/utilities/threed_sphere/quickbuild.csh
===================================================================
--- DART/trunk/observations/utilities/threed_sphere/quickbuild.csh	                        (rev 0)
+++ DART/trunk/observations/utilities/threed_sphere/quickbuild.csh	2009-05-01 00:25:15 UTC (rev 3836)
@@ -0,0 +1,98 @@
+#!/bin/csh
+#
+# Data Assimilation Research Testbed -- DART
+# Copyright 2004-2007, Data Assimilation Research Section
+# University Corporation for Atmospheric Research
+# Licensed under the GPL -- www.gpl.org/licenses/gpl.html
+#
+# <next few lines under version control, do not edit>
+# $URL$
+# $Id$
+# $Revision$
+# $Date$
+
+# Script to manage the compilation of all components for this model;
+# executes a known "perfect model" experiment using an existing
+# observation sequence file (obs_seq.in) and initial conditions appropriate 
+# for both 'perfect_model_obs' (perfect_ics) and 'filter' (filter_ics).
+# There are enough initial conditions for 80 ensemble members in filter.
+# Use ens_size = 81 and it WILL bomb. Guaranteed.
+# The 'input.nml' file controls all facets of this execution.
+#
+# 'create_obs_sequence' and 'create_fixed_network_sequence' were used to
+# create the observation sequence file 'obs_seq.in' - this defines 
+# what/where/when we want observations. This script does not run these 
+# programs - intentionally. 
+#
+# 'perfect_model_obs' results in a True_State.nc file that contains 
+# the true state, and obs_seq.out - a file that contains the "observations"
+# that will be assimilated by 'filter'.
+#
+# 'filter' results in three files (at least): Prior_Diag.nc - the state 
+# of all ensemble members prior to the assimilation (i.e. the forecast), 
+# Posterior_Diag.nc - the state of all ensemble members after the 
+# assimilation (i.e. the analysis), and obs_seq.final - the ensemble 
+# members' estimate of what the observations should have been.
+#
+# Once 'perfect_model_obs' has advanced the model and harvested the 
+# observations for the assimilation experiment, 'filter' may be run 
+# over and over by simply changing the namelist parameters in input.nml.
+#
+# The result of each assimilation can be explored in model-space with
+# matlab scripts that directly read the netCDF output, or in observation-space.
+# 'obs_diag' is a program that will create observation-space diagnostics
+# for any result of 'filter' and results in a couple data files that can
+# be explored with yet more matlab scripts.
+#
+#----------------------------------------------------------------------
+# 'preprocess' is a program that culls the appropriate sections of the
+# observation module for the observations types in 'input.nml'; the 
+# resulting source file is used by all the remaining programs, 
+# so this MUST be run first.
+#----------------------------------------------------------------------
+
+\rm -f preprocess *.o *.mod
+\rm -f ../../../obs_def/obs_def_mod.f90
+\rm -f ../../../obs_kind/obs_kind_mod.f90
+
+set MODEL = "observations/utilities/threed_sphere"
+
+@ n = 1
+
+echo
+echo
+echo "---------------------------------------------------------------"
+echo "${MODEL} build number ${n} is preprocess"
+
+csh  mkmf_preprocess
+make || exit $n
+
+./preprocess || exit 99
+
+#----------------------------------------------------------------------
+# Build all the single-threaded targets
+#----------------------------------------------------------------------
+
+foreach TARGET ( mkmf_* )
+
+   set PROG = `echo $TARGET | sed -e 's#mkmf_##'`
+
+   switch ( $TARGET )
+   case mkmf_preprocess:
+      breaksw
+   default:
+      @ n = $n + 1
+      echo
+      echo "---------------------------------------------------"
+      echo "${MODEL} build number ${n} is ${PROG}" 
+      \rm -f ${PROG}
+      csh $TARGET || exit $n
+      make        || exit $n
+      breaksw
+   endsw
+end
+
+echo ""
+echo "Success: All single task DART programs compiled."  
+echo ""
+exit 0


Property changes on: DART/trunk/observations/utilities/threed_sphere/quickbuild.csh
___________________________________________________________________
Name: svn:executable
   + *
Name: mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native


More information about the Dart-dev mailing list