Tutorial 14: What You Did Not Know You Could Do with CAMPARI - Part I: The NetCDF Analysis Mode for General Time Series

Preface:

This tutorial covers an execution mode of CAMPARI that allows the dedicated analysis of arbitrary numerical input data (→NetCDF analysis mode). As you might have discovered following Tutorial 10 and Tutorial 11, CAMPARI possesses a set of powerful (and sometimes unique) data mining algorithms, which can prove useful for the analysis of many different types of data, in particular for time series.

This tutorial covers the usage of the executables camp_nc_miner and camp_nc_miner_threads, and the reader is referred to the installation instructions for dependencies and compilation. These executables, which differ one another exclusively for supporting (camp_nc_miner_threads) or not (camp_nc_miner) threaded code, have been developed to analyze time series data of (almost) any type by means of clustering and downstream routines (see, e.g., CCOLLECT as a starting point). More in general, these two executables support two different types of input files: time series data can be fed to CAMPARI either as ASCII files or as binary NetCDF files (see links for appropriate formatting and more information).

Step-by-Step Part A:

Step A.1 - Specific settings
The above-mentioned NetCDF data mining executables of CAMPARI are supported in a special analysis mode for general time series data. In this execution mode, many keywords relevant to the analysis of atomistic systems are simply ignored, in particular there are no parameter file and no sequence file to specify.

Let us suppose you are interested in financial modeling. If so, a great place to start is to try to understand the evolution in time of stock market data. To begin with, we start creating a key-file, key_ncdmA.key, with the following entries:

FMCSC_NCDM_ASFILE <full path to campari folder>/examples/tutorial14/stocks.dat # ASCII file with input data
FMCSC_NCDM_ANONAS 1 # do analysis on input ASCII data
FMCSC_NCDM_NRFEATS 7 # number of features in ASCII file (number of columns)
FMCSC_NCDM_NRFRMS 3643 # number of frames in ASCII file (number of rows that contain features values)
FMCSC_NCDM_CHECKAS 0 # disable checking of correct number of columns per row (generally slow)

Keywords that have the string _NCDM_ are specific to this special analysis mode and not used in standard CAMPARI. FMCSC_NCDM_ASFILE specifies the path and name of the input ASCII file. In this example it contains the values of the openings and of the traded volumes of the stock indexes DJI, Nasdaq and Nikkei in columns 1 to 6 (DJI openings, DJI volumes, etc.) from 2003 to 2016 included. The seventh column is the volatility (VIX) index over the same time period. These (daily) data are from Yahoo and have been adjusted to account for missing values, etc.

Keyword FMCSC_NCDM_NRFRMS must always be set to the total number of frames (rows) that hold the values of the features (feature weights in the ASCII file are automatically detected in case they are present). If the number of rows differs from FMCSC_NCDM_NRFRMS (only feature values are present in the ASCII file), one of three conditions must be fulfilled.
  • If the number of rows is FMCSC_NCDM_NRFRMS + 1, feature values and static weights are assumed to be in the ASCII file in this order, viz., static weights are on the last row.
  • If the number of rows is 2*FMCSC_NCDM_NRFRMS, feature values and dynamic weights are are assumed to be in the ASCII file in this order.
  • If the number of rows is 2*FMCSC_NCDM_NRFRMS + 1, feature values, dynamic weights, and static weights are assumed to be in the ASCII file in this order,
If none of these conditions are fulfilled when FMCSC_NCDM_NRFRMS does not agree with the number of rows in the input file, CAMPARI will crash with an error.

For the meaning of feature weights, see CDISTANCE and CMODWEIGHTS; for properly discarding frames (and possible associated weights, which happens automatically), see FMCSC_NCDM_FRAMESFILE.

Analogously, FMCSC_NCDM_NRFEATS must be always set equal to the number of features, i.e. columns, present in the ASCII file. The only way to exclude some features from the analysis is to use keyword FMCSC_NCDM_CFILE as we will se below.
Step A.2 - Define keywords for analysis
Now that the NetCDF specific keywords that we need are in the keyfile, we proceed by requiring the computation of the so-called Progress Index to partition the data into basins. To this purpuse we append the key file with:

FMCSC_BASENAME stockdata # to give a basename to the output binary NetCDF file
FMCSC_NRTHREADS 2 # desired number of threads
FMCSC_THREADS_VERBOSE 0 # reduce threads verbosity to minimum
FMCSC_CMODE 4 # go for the progress index method
FMCSC_CDISTANCE 7 # distance metric of type 7, i.e. simple Euclidean distance between frames
FMCSC_BIRCHHEIGHT 2 # tree-based clustering with 1 level
FMCSC_CMAXRAD 100.0 # target radius of clusters at root
FMCSC_CRADIUS 99.0 # target radius of clusters at leaves
FMCSC_BIRCHCHUNKSZ 1 # do not employ divide and merge strategy for parallel clustering
FMCSC_CRESORT 1 # resort clusters systematically
FMCSC_CPROGINDMODE 2 # select approximate scheme for the progress index
FMCSC_CPROGINDSTART 1 # start from first snapshot in trajectory
FMCSC_CPROGINDRMAX 3643 # use as many random attempts as there are frames
FMCSC_CPROGMSTFOLD 20 # fold terminal branches of the spanning tree aggressively
FMCSC_CPROGINDWIDTH 300 # width for local cut-function (about 10% of frames)
FMCSC_CPREPMODE 2 # center the data and normalize by variance
FMCSC_CCOLLECT 1 # do not subsample the frames with a regular interval

With the above inputs, we circumvent the high memory usage of the exact algorithm. In this case it is feasible to make the search space (FMCSC_CPROGINDRMAX) as large as the whole data set (FMCSC_NCDM_NRFRMS). This is achieved by assuring that there is only one cluster at the finer (leaves) level of the tree (FMCSC_BIRCHHEIGHT is small and FMCSC_CMAXRAD and FMCSC_CRADIUS are both large), and that the algorithm can make as many search attempts as there are frames. In other words, with these settings, we are computing the exact minimum spanning tree with lower memory requirements but worse time complexity than the exact algorithm (FMCSC_CPROGINDMODE set to 1).
Here, we choose FMCSC_CDISTANCE to be equal to 7, which is appropriate whenever we do not have periodic variables or feature weights (see Part B for this).

We can now run (it should not take more than a minute on a modern desktop):

camp_ncminer_threads -k key_ncdmA.key > log_key_ncdm.log

Or, to avoid using the multi-threaded executable:

camp_ncminer -k key_ncdmA.key > log_key_ncdm.log

We should be left with the standard clustering output files (such as STRUCT_CLUSTERING.clu) and Progress Index file PROGIDX_000000000001.dat. The user is encouraged to plot the results with the preferred tool. We provide an R script to the purpose (<full path to campari folder>/examples/tutorial14/R_tutorial14.R). If an R installation is available, it should be safe to copy the R script to your working directory, adjust the campadir and profile pathways at the beginning of the script and run it ("Rscript R_tutorial14.R"). It should return the same image as <full path to campari folder>/examples/tutorial14/reference1.png, which highlights both the partition into several basins (the turmoil that characterized the stock markets is manifest, for example, in the time trace of years 2007, 2008 and 2009) and the little time recurrence of these type of data, which probably need a more sophisticated pre-processing (for instance, to account for gradients).
Step A.3 - Usage of NCDM FRAMESFILE and CFILE
It is of course possible to play with the data. For example, we can focus on the years 2006 - 2010 and on the American market only by adding the following keywords to the key-file:

FMCSC_NCDM_CFILE <full path to campari folder>/examples/tutorial14/cfile.inp # openings of DJI, Nasdaq, VIX as features
FMCSC_NCDM_FRAMESFILE <full path to campari folder>/examples/tutorial14/frames.inp # values from 2006 to 2010 only

This time we also want to convert the ASCII data to NetCDF format and print out the data actually being used ("seen") by the clustering routines. To this aim, we add:

FMCSC_NCDM_WRTINPUT 1 # to convert the ASCII file to net-cdf binary format
FMCSC_CDUMP 1 # to write down what is actually used by the clustering routines

After appending these additional keywords to the key-file, we are are ready to run CAMPARI again. If you want to back up the previously generated files for some reasons, do it now.
Now we run:

camp_ncminer_threads -k key_ncdmA.key > log_key_ncdm.log

or, to avoid using threaded code:

camp_ncminer -k key_ncdmA.key > log_key_ncdm.log

The first thing we suggest to do here is to convert the two NetCDF files that have been generated to a human-readable format. From the terminal, execute:

ncdump stockdata_convert.nc > stockdata_convert.cdl
ncdump CLUSTERING_FEATURES.nc > CLUSTERING_FEATURES.cdl

By giving a quick look at those files, one should realize that stockdata_convert.cdl contains the input ASCII data in full, regardless the usage of FMCSC_NCDM_CFILE, FMCSC_NCDM_FRAMESFILE and FMCSC_CPREPMODE, where the contrary is true for CLUSTERING_FEATURES.cdl. It may be a useful exercise to try to modify the R script to obtain a figure similar to <full path to campari folder>/examples/tutorial14/reference2.png. This can be achieved by setting iniyr to 2006, endyr to 2010 and both whichasannos and whichtmsrs to c(1,3,7). Ideally, you can also change pngnm (the variable part in the name of the output image) to, e.g., "pippo".

As a last remark, despite the usage of a frames file, we did not change keyword FMCSC_NCDM_NRFRMS as already explained above. For further modifications, one could now try to, for example, reduce FMCSC_CPROGINDWIDTH to 150 and look at the new cut function by re-running the same analysis and the R script as before. If you introduce any modifications, be sure to undo them before continuing.
Step A.4 - Usage of NetCDF file
We next demonstrate how to use a NetCDF file as input. We use the file "stockdata_convert.nc", which was just generated, for this purpose. First, let us edit the following entries in the key-file:

FMCSC_NCDM_ANONAS 1 → FMCSC_NCDM_ANONAS 0
FMCSC_NCDM_ASFILE ... → #FMCSC_NCDM_ASFILE ...
FMCSC_NCDM_CFILE ... → #FMCSC_NCDM_CFILE ...
FMCSC_NCDM_FRAMESFILE ... → #FMCSC_NCDM_FRAMESFILE ...

Note that commenting (or removing) of FMCSC_NCDM_ASFILE is mandatory while the other two modifications simply undo the modifications introduced in A.3, i.e., the results from what follows will be comparable in scope to those in A.2. We next add:

FMCSC_NCDM_NCFILE <full path to your working directory>/stockdata_convert.nc # NetCDF file (mutually exclusive with FMCSC_NCDM_ANONAS)
FMCSC_PCAMODE 5 # perform time-lagged independent component analysis (tICA)
FMCSC_CREDUCEDIM 3 # use the first 3 dimensions in tICA space for clustering
FMCSC_CLAGTIME 260 # lag time for tICA

In case you could not generate the stockdata_convert.nc from Step A.3, you can still use the file in "<full path to campari folder>/examples/tutorial14/stockdata_convert.nc" as FMCSC_NCDM_NCFILE, which should look the same. Make sure to restore FMCSC_CPROGINDWIDTH to 300 in case you modified it earlier. It is now time to execute as before:

camp_ncminer_threads -k key_ncdmA.key > log_key_ncdm.log

or, to avoid using threaded code:

camp_ncminer -k key_ncdmA.key > log_key_ncdm.log

In this last step of Part A, we are performing a dimensionality reduction with time-lagged independent component analysis (tICA), and we use the first three dimensions in this space to cluster the data (see FMCSC_CREDUCEDIM). Of course all these steps follow the preprocessing specified with FMCSC_CPREPMODE.
To plot the results and obtain a figure as <full path to campari folder>/examples/tutorial14/reference3.png, it is necessary to restore the R script to the original version and choose your favorite suffix for the png file (pngnm).

There are many parameters the user can try to change at this point in the key-file (e.g. one could use FMCSC_NCDM_NMFV to rename the variable in the converted NetCDF file, or could change FMCSC_CLAGTIME in the tICA analysis, which has an influence that is difficult to predict) and in the R script, including the cut function plotted (yprofl ← 4 to plot the global cut function, which looks smoother).

The user is also encouraged to convert the NetCDF output files stockdata_checked.nc and CLUSTERING_FEATURES.nc:

ncdump stockdata_checked.nc > stockdata_checked.cdl
ncdump CLUSTERING_FEATURES.nc > CLUSTERING_FEATURES.cdl

and look at the intrinsic differencies. Since the writing down of the input NetCDF file precedes the preprocessing of the data and the dimensionality reduction, the two files differ. However, it is never a good idea to use blindly one of those files as input NetCDF file, as both are in general sensitive to most of the analysis keywords. The only safe option is to use the converted ASCII file (see stockdata_convert.nc above). Finally, the user is referred to the beginning of the log-file to understand warnings about unused keywords, which are harmless in this scenario, but can give important information (e.g., we can learn that keywords such as FMCSC_NCDM_NRFRMS and FMCSC_NCDM_NRFEATS are completely ignored when providing an input NetCDF file). That's weird, isn't it?!? The answer as to why is in Part B.

Step-by-Step Part B:

Step B.1 - Specific settings
We now turn to the analysis of periodic variables. This is tricky because many concepts inherent to data analysis, e.g., variance, break down or have to be substantially revised to be able to deal correctly and/or unambiguously with periodic data. Users who want to analyse periodic variables are encouraged to perform all the steps below.

To simplify this part, we always use available ASCII files shipped with CAMPARI. We start with "<full path to campari folder>/examples/tutorial14/nbu_wghts.dat", which contains in rows from 1 to 1000 the values of the torsion angles of the small molecule, n-butane (the same system as in Tutorial 11), an associated set of dynamic weights (rows 1001 to 2000) and associated (and here flat) static weights (line 2001).

We recommend to create a new working folder. We start by building up a new key-file from scratch, "key_ncdmB.key":

FMCSC_NCDM_ASFILE <full path to campari folder>/examples/tutorial14/nbu_wghts.dat # ASCII file with input data
FMCSC_NCDM_ANONAS 1 # do analysis on input ASCII data
FMCSC_NCDM_NRFEATS 3 # number of features in ASCII file (number of columns)
FMCSC_NCDM_NRFRMS 1000 # number of frames in ASCII file (number of rows that contain features values)
FMCSC_NCDM_PRDCRNG -180 180 # left and right boundaries of periodic interval in degrees
FMCSC_NCDM_WRTINPUT 1 # to convert the ASCII file to NetCDF binary format

As before, these are the settings informing CAMPARI about what to expect in the ASCII file.
Step B.2 - Define keywords for analysis
Here we want to analyze the small molecule's dihedral angles, which all reside in the interval assumed as the reference one by CAMPARI [-180°:180°]. Rather than working with angles directly, we choose the respective sine and cosine values. We also want to make use of the dynamic weights reported in the input ASCII file. To achieve this, we must choose option 4 for keyword FMCSC_CDISTANCE. Let us append key_ncdmB.key with the following lines:

FMCSC_BASENAME NBU # to give a basename to the output binary net-cdf
FMCSC_NRTHREADS 2 # desired number of threads
FMCSC_THREADS_VERBOSE 0 # reduce threads verbosity to minimum
FMCSC_CMODE 5 # go for tree-based clustering
FMCSC_CDISTANCE 4 # distance criterion
FMCSC_BIRCHHEIGHT 8 # number of tree levels
FMCSC_CMAXRAD 1.0 # target radius of clusters at root
FMCSC_CRADIUS 0.1 # target radius of clusters at leaves
FMCSC_BIRCHCHUNKSZ 1 # do not employ divide and merge strategy for parallel clustering
FMCSC_CRESORT 1 # resort clusters systematically
FMCSC_CDUMP 1 # to write down what is actually used by the clustering routines
FMCSC_CCOLLECT 1 # do not discard any frame
FMCSC_TOROUT 1 # to write down torsional coordinates in plain CAMPARI

Now run:

camp_ncminer_threads -k key_ncdmB.key > log_key_ncdm.log

Or, to avoid using threaded code:

camp_ncminer -k key_ncdmB.key > log_key_ncdm.log

Then execute:

mv NBU_convert.nc NBU_convert_1.nc
mv CLUSTERING_FEATURES.nc CLUSTERING_FEATURES_1.nc

As before, the user is encouraged to look at the human-readable versions of files NBU_convert_1.nc and CLUSTERING_FEATURES_1.nc, respectively:

ncdump NBU_convert_1.nc > NBU_convert_1.cdl
ncdump CLUSTERING_FEATURES_1.nc > CLUSTERING_FEATURES_1.cdl

From these files, it is possible (and correct) to discover that the information about static weights is lost in CLUSTERING_FEATURES_1.nc since the specified distance criterion does not make use of them. It is also possible to glean that the torsional angles have turned into their sine and cosine values, and that the dynamic weights have been duplicated to respect the associated dimension attribute (nfeats in the NetCDF file). However, being aware of the specific features of CLUSTERING_FEATURES_1.nc actually enables us to use exactly this file as an input NetCDF file to obtain the exact same results. Before doing that, let us thus move the clustering output file:

mv STRUCT_CLUSTERING.clu STRUCT_CLUSTERING_1.clu

Finally, we should notice the presence of the attribute periodic_range in both output NetCDF files, as specified with keyword FMCSC_NCDM_PRDCRNG, and the absence of the output we requested by keyword FMCSC_TOROUT, i.e., there is no FYC.dat. The reason is that there is no notion of molecules or atoms within the camp_ncminer* executables so that there is no information on dihedral angles or other derived coordinates either. In other words, any analysis routines that process input with the knowledge that the data are coordinates of particles (possibly with specific topologies) are simply not available in NetCDF analysis mode.
Step B.3 - Usage of NetCDF file
As an additional step, we want to use the above mentioned CLUSTERING_FEATURES_1.nc to show that sine and cosine values can be used with a properly adjusted distance criterion to achieve the same results stored in STRUCT_CLUSTERING_1.clu.
We first should comment or modify existing keywords (do not remove them this time so they can be reused later), most importantly FMCSC_NCDM_ASFILE. Modify "key_ncdmB.key" as follows:

FMCSC_NCDM_ANONAS 1 → FMCSC_NCDM_ANONAS 0
FMCSC_NCDM_ASFILE ... → # FMCSC_NCDM_ASFILE ...
FMCSC_NCDM_NRFRMS ... → # FMCSC_NCDM_NRFRMS ...
FMCSC_NCDM_NRFEATS ... → # FMCSC_NCDM_NRFEATS ...
FMCSC_NCDM_PRDCRNG ... → # FMCSC_NCDM_PRDCRNG ...

The respective values provided by these keywords are all going to be inferred from the input NetCDF file. If there is a need to change the input binary NetCDF file, one can convert it to human-readable format (unless it is extremely large), edit it manually, and convert it back to the binary form with the help of ncgen. Alternatively, there should be specific tools to avoid conversion (link).

We need to add the missing keyword for specifying the NetCDF-based input file:

FMCSC_NCDM_NCFILE <full path to your workdir>/CLUSTERING_FEATURES_1.nc # NetCDF file (mutually exclusive with FMCSC_NCDM_ASFILE)

We also change keyword FMCSC_CDISTANCE from 4 to 9:

FMCSC_CDISTANCE 9 # distance criterion

Then we run again:

camp_ncminer_threads -k key_ncdmB.key > log_key_ncdm.log

Or, to avoid using threaded code:

camp_ncminer -k key_ncdmB.key > log_key_ncdm.log

A quick check between the newly generated STRUCT_CLUSTERING.clu and STRUCT_CLUSTERING_1.clu points out that we have achieved exactly the same results. In other words, if sine and cosine values are directly available in the input file (ASCII or NetCDF), then the appropriate distance criterion is either 7, 8, or 9, depending on the presence or absence of features weights, and on whether they are desired for analysis (if we had set the distance criterion to 7, we would have ignored the dynamic weights in CLUSTERING_FEATURES_1.nc completely).

There are many possibilities to keep on familiarizing yourself with this framework. You could, for example, change the distance criterion to see how this influences the actual usage of feature weights. It is also possible to overwrite the input dynamic weights through keyword CMODWEIGHTS and related ones and/or perform extra analysis that are downstream to the clustering (e.g., generate synthetic trajectories).
Step B.4 - Dealing with a periodic range different from the default
We revert now to use an ASCII file that contains fundamentally the same data as before. However, the dihedral angle values have been remapped to the [0°:360°] interval, and, in addition, the three entries in the 1st and 500th lines have been shifted by -360, 360, and 720 degrees, respectively, from the remapped values. This is expected to be safe given the intrinsic periodicity of 360° of angles. More generally, any meaningful analysis on these data should not depend on which periodic interval we choose. For consistency and error checking of the raw angle data, it can be desirable, however, to map in a particular manner, and this is what the periodic_range variable mentioned above indicates and what can be controlled by keyword FMCSC_NCDM_PRDCRNG. The internal CAMPARI convention is immutable and maps every periodic range to the [-180°;180°] interval. The user is encouraged to compare the two input files directly, viz., <full path to campari folder>/examples/tutorial14/nbu_wghts.dat and <full path to campari folder>/examples/tutorial14/nbu_wghts_0-360_mdfd.dat.

To run with these modified input data, we first uncomment/modify the following keywords:

# FMCSC_NCDM_ASFILE ... → FMCSC_NCDM_ASFILE ...
FMCSC_NCDM_ANONAS 0 → FMCSC_NCDM_ANONAS 1
# FMCSC_NCDM_NRFRMS ... → FMCSC_NCDM_NRFRMS ...
# FMCSC_NCDM_NRFEATS ... → FMCSC_NCDM_NRFEATS ...
# FMCSC_NCDM_PRDCRNG ... → FMCSC_NCDM_PRDCRNG ...

In turn, we comment FMCSC_NCDM_NCFILE:

FMCSC_NCDM_NCFILE ... → # FMCSC_NCDM_NCFILE ...

You should then substitute the entry of FMCSC_NCDM_ASFILE to point to the modified ASCII file:

FMCSC_NCDM_ASFILE <full path to campari folder>/examples/tutorial14/nbu_wghts_0-360_mdfd.dat # ASCII file

Even though the new angles are recorded in the interval [0°:360°] (mod 360°), this does not automatically mean that it is maximally conservative to set FMCSC_NCDM_PRDCRNG to "0 360". As you should have been able to see from the side-by-side comparison of the files, the data from -180° to 0° have actually been periodically wrapped around to the interval from 180° to 360°. In terms of raw data, this is different from shifting the entire data by 180°. In other words, the position of the periodic boundaries has not actually changed, and thus a specification of "-180 180" is conservative here.

Thus, we just have to pick (it should still be set to these values):

FMCSC_NCDM_PRDCRNG -180 180

You should also revert FMCSC_CDISTANCE to 4:

FMCSC_CDISTANCE 4

Now we run:

camp_ncminer_threads -k key_ncdmB.key > log_key_ncdm.log

Or, to avoid using threaded code:

camp_ncminer -k key_ncdmB.key > log_key_ncdm.log

Finally, convert the newly generated NetCDF files and back up the key result:

ncdump NBU_convert.nc > NBU_convert_2.cdl
ncdump CLUSTERING_FEATURES.nc > CLUSTERING_FEATURES_2.cdl
mv STRUCT_CLUSTERING.clu STRUCT_CLUSTERING_2.clu

Now let us repeat the exact same calculation by just shifting the periodic interval by 180°. Thus, we just have to pick:

FMCSC_NCDM_PRDCRNG 0 360

An execute:

camp_ncminer_threads -k key_ncdmB.key > log_key_ncdm.log

Or, to avoid using threaded code:

camp_ncminer -k key_ncdmB.key > log_key_ncdm.log

Again, convert the newly generated NetCDF files and back up the key result:

ncdump NBU_convert.nc > NBU_convert_3.cdl
ncdump CLUSTERING_FEATURES.nc > CLUSTERING_FEATURES_3.cdl
mv STRUCT_CLUSTERING.clu STRUCT_CLUSTERING_3.clu

First and foremost, comparing the key results, i.e., STRUCT_CLUSTERING.clu with STRUCT_CLUSTERING_1.clu and STRUCT_CLUSTERING_2.clu, should confirm that the analyses are insensitive to choices regarding the position of the periodic reference interval. The actual data can differ, however. Indeed, mutual comparisons of NBU_convert_?.cdl and CLUSTERING_FEATURES_?.cdl allow the following observations:
  1. CLUSTERING_FEATURES_2.cdl is practically equal to CLUSTERING_FEATURES_1.cdl aside from precision limitations in the values that were manually changed, viz, on lines 1 and 500. In general, it is recommend to keep periodic data symmetric about 0.0 as this maximizes floating point accuracy. This is because we maintained a consistent choice regarding the position of the reference interval in the input data.
  2. CLUSTERING_FEATURES_3.cdl differs from the other two cases. Because we shifted the reference interval by 180° and because we use a feature extraction in trigonometric functions, all the feature values are simply inverted in sign.
  3. NBU_convert_2.cdl, viz., NBU_convert.nc can be used in CAMPARI as binary NetCDF file as the periodic_range attribute is -180 180 and features are untouched (it is thus maximally conservative). However, it may not be safe to use with other software because not all values are mapped to the reference interval (which is an "error" of the input ASCII file).
  4. NBU_convert_2.cdl and NBU_convert_3.cdl are identical except for the periodic_range attribute, which is expected. If you were to find analyses that produce different results based on these two input files, it would be correct to question the applicability of the chosen methodology to periodic data.
As a last bit, it is possible to ask CAMPARI to just convert the ASCII file to a NetCDF file and pick any periodic range (without running any analysis). To this purpose we would simply change:

FMCSC_NCDM_PRDCRNG -120 240
FMCSC_NCDM_ANONAS 0 #disable all analysis

The newly generated NBU_convert.nc now has an attribute indicating that the assumed periodic reference interval is from -120° to 240°. Importantly, if we used this file as an input via FMCSC_NCDM_NCFILE, we would not be able to overwrite the interval to [-180°;180°] by means of CAMPARI (this option is only available with ASCII files).

Design downloaded from free website templates.