[Dart-dev] DART/branches Revision: 10939

dart at ucar.edu dart at ucar.edu
Mon Jan 23 17:43:17 MST 2017


thoar at ucar.edu
2017-01-23 17:43:16 -0700 (Mon, 23 Jan 2017)
439
Adding the script to convert a True_State.nc and Prior_Diag.nc to the 
single-file netCDF input format.

I modified the filter_input.cdl values for the inflation sd to be a more
sensible default of 0.6 instead of their previous 0.0. When you turn inflation
off (as you must to get from the DART-format ascii input files to an identical
filter_input.nc file) the inflation values in the Prior_Diag.nc are 1.0, 
and the inflation sd is 0.0




Added: DART/branches/rma_single_file/models/bgrid_solo/shell_scripts/Convert_Diags_to_restarts.csh
===================================================================
--- DART/branches/rma_single_file/models/bgrid_solo/shell_scripts/Convert_Diags_to_restarts.csh	                        (rev 0)
+++ DART/branches/rma_single_file/models/bgrid_solo/shell_scripts/Convert_Diags_to_restarts.csh	2017-01-24 00:43:16 UTC (rev 10939)
@@ -0,0 +1,164 @@
+#!/bin/csh
+#
+# DART software - Copyright 2004 - 2013 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$
+#
+# README: you must denote all observations as 'evaluate only' and turn OFF any/all inflation.
+# To get identical values (to the existing ascii restarts), I had to change the 
+# trunk/models/brid_solo/model_mod.f90 to create the diagnostic variables as nf90_double values 
+# (they were nf90_real).  
+#
+# 1) takes the first timestep from True_State.nc and creates a single netCDF restart file.
+# 2) takes the first timestep from Prior_Diag.nc and creates a (multi-member) single netCDF restart file.
+#    There are no posterior inflation values in this case.
+#
+# only the non-obvious NCO tasks are explained here.
+# ncks -O -d time,0 -d copy,82 Prior_Diag.nc bob.nc         rip out the right copy/copies
+# ncwa -O -a copy,0            bob.nc prior_inflation.nc    removes 'copy' dimension
+# ncks -O -x -v copy,inputnml  prior_inflation.nc bob.nc    removes copy, inputnml variables
+#
+# Since version control systems cannot store incremental differences, we actually convert
+# the netCDF to it's ASCII representation (a .cdl file). It's tolerable for smallish files.
+# The prior inflation standard deviation had to be hand-edited from 0 to a more meaningful 0.6
+# The prior inflation value was already a useful 1.0
+#
+# This script will generate perfect_input.nc and filter_input.nc
+# To create the matching .cdl files is easy:
+#   ncdump perfect_input.nc > perfect_input.cdl
+#   ncdump  filter_input.nc >  filter_input.cdl
+# and to create a netCDF file from a .cdl file is also easy:
+#   ncgen -o perfect_input.nc perfect_input.cdl
+#   ncgen -o  filter_input.nc  filter_input.cdl
+#
+#-------------------------------------------------------------------------------
+
+
+#-------------------------------------------------------------------------------
+# bgrid_solo - True_State.nc -> perfect_input.nc
+
+ncks -O -d time,0 -d copy,0 True_State.nc perfect_input.nc
+ncrename -O -d copy,member -v copy,member perfect_input.nc temp.$$.nc
+ncks -O -x -v inputnml                    temp.$$.nc perfect_input.nc
+
+# remove extraneous history, modifies a couple
+ncatted  -O -h \
+         -a assim_model_source,global,d,, \
+         -a assim_model_revision,global,d,, \
+         -a assim_model_revdate,global,d,, \
+         -a netcdf_version,global,d,, \
+         -a creation_date,global,d,, \
+         -a model_source,global,d,, \
+         -a model_revision,global,d,, \
+         -a model_revdate,global,d,, \
+         -a NCO,global,d,, \
+         -a long_name,time,m,c,'valid time of the model state' \
+         -a title,global,m,c,'a spun-up model state' \
+         -a history,global,m,c,'same values as in perfect_ics r1025 (circa Dec 2004)' \
+            perfect_input.nc
+
+#-------------------------------------------------------------------------------
+# bgrid_solo - Prior_Diag.nc -> filter_input.nc
+#
+# Like I said, there is no posterior inflation in this test case.
+# The prior inflation mean was 1.0
+
+# Generate the prior inflation mean netCDF file
+
+ncks -O -d time,0 -d copy,82 Prior_Diag.nc temp.$$.nc
+ncwa -O -a copy,0            temp.$$.nc prior_inf_mean.$$.nc
+ncks -O -x -v copy,inputnml  prior_inf_mean.$$.nc temp.$$.nc
+ncrename -O \
+         -v ps,ps_priorinf_mean \
+         -v t,t_priorinf_mean \
+         -v u,u_priorinf_mean \
+         -v v,v_priorinf_mean \
+         temp.$$.nc prior_inf_mean.$$.nc
+
+ncatted -O -h \
+        -a  units,,d,, \
+        -a  cell_methods,,d,, \
+        -a  units_long_name,,d,, \
+        -a  long_name,ps_priorinf_mean,m,c,'prior inflation value for surface pressure' \
+        -a  long_name,t_priorinf_mean,m,c,'prior inflation value for temperature' \
+        -a  long_name,u_priorinf_mean,m,c,'prior inflation value for u wind component' \
+        -a  long_name,v_priorinf_mean,m,c,'prior inflation value for v wind component' \
+             prior_inf_mean.$$.nc
+
+# Generate the prior inflation sd netCDF file
+
+ncks -O -d time,0 -d copy,83 Prior_Diag.nc temp.$$.nc
+ncwa -O -a copy,0            temp.$$.nc prior_inf_sd.$$.nc
+ncks -O -x -v copy,inputnml  prior_inf_sd.$$.nc temp.$$.nc
+
+ncrename -O \


More information about the Dart-dev mailing list