Note that the use of NcML or F-TDS scripts that define virtual variables are alternatives to init scripts for fixing or adding features to an original dataset. The advantage to these newer methods is that the dataset in your THREDDS server has the corrections applied. The corrected dataset is available not only to your particular LAS installation but also to any application that points to the URL in your THREDDS server.
For LAS, in order for your Ferret init scripts to work,you have do two things.
First, in theory, you can put the Ferret init scripts any where; we recommend {LAS_HOME}/conf/server/custom/scripts. Then, the most important thing to do is to add this path to FER_GO inFerretBackendConfig.xml at {LAS_HOME}/JavaSource/resources/ferret, soFerret can find it.
You also need to make the same change in FerretConfig.xml at{TOMCAT_HOME}/webapps/thredds/WEB-INF/classes/resources/iosp.This will make F-TDS happy.
Second, because of the changes to how LAS Ferret scripts initialize dataset and variable, you have to modify your Ferret init scripts.The custom init scripts now consist of only SET DATA and the custom commands. In addition, for F-TDS to correctly apply the corrections, (operations such as averaging or computing a difference with another variable or dataset), you must redefine the name of the dataset variable and define the final customized variable using the original name and using the qualifier /d=1. This lets F-TDS run first and call the init script to create the data set that will be used by the Ferret product script. A few sample Ferret init scripts are below for reference.
The pattern is this: To redefine variable "fvar" in the dataset,
SET DATA ($data_url) ! Define a renaming of the variable set variable/name=fvar_in fvar ! Make the new definition, giving it the original name, ! and using /d=1 let/d=1 fvar = [expression operating on fvar_in]
Example 1: Change units from Kelvin to Celsius
SET DATA ($data_url) ! Rename the variable set variable/name=analysed_sst_in analysed_sst ! Redefine the units, define the expression for the conversion, ! and assign the variable to dataset 1 let/d=1/title="Sea Surface Temperature"/units="Deg C" analysed_sst = analysed_sst_in - 273.15
The init-script capability works to edit variables in a dataset, e.g. change units or attributes, perhaps do some regridding. It will not work to add a new variable while keeping the existing variables in the dataset, for instance in the above example it will not work to keep both a Kelvin and Centigrade version of the temperature variable. F-TDS scripts would work correctly in that case.
(The following examples are not currently available. We will restore these as soon as possible.)
Example 2: DODS_GSFC_fao_soil_init.jnl - Sets up the XY grid to upon which that data are defined and provides a nice title and missing value for each data variable.
Example 3: DODS_GSFC_ndvi_init.jnl- Defines a new grid, Flips the y coordinates and regrids the variable to the new grid; applies the correct missing-value flag for the data
Example 4: DODS_LDEO_cayan_init.jnl - Redefines the time axis.
Example 5: NCAR_Biotic_equil_init.jnl - another example of Redefining the time axis.