.. _uploading_measurements:

Uploading measurements
======================

New measurements can be uploaded using the "Quick Upload" link in the data
processing submenu. There, you will need to fill and submit the provided form. 


Form fields
-----------

System (Required)
   This field specifies the system configuration that was used to perform the
   measurement. The available systems can be managed in the "Station Admin" 
   section of the site. You can later change the system used in the processing 
   of the measurement again in the "Station Admin" section.

Data file (Required)
   In this field you have to select the measurement file that will be processed.
   The file has to be in the specific format described in :ref:`netcdf_file`. 
    
Sounding file (Optional)
   In this optional field you can submit a sounding file that will be used
   by your measurements in the processing. The file needs to follow the netCDF
   file format specified in the pdf file found in the :ref:`netcdf_file` section. 
   The file you submit will not be  necessarily connected with the 
   submitted measurement; which sounding file will be used in the processing of 
   each measurement is specified in the measurement's file. The file you upload 
   will, nevertheless, remain on the SCC and will be used whenever needed.
   
Overlap file (Optional)
   In this optional field you can submit a overlap file that will be used
   by your measurements in the processing. The file needs to follow the netCDF
   file format specified in the pdf file found in the :ref:`netcdf_file` section. 
   The file you submit will not be  necessarily connected with the 
   submitted measurement; which overlap file will be used in the processing of 
   each measurement is specified in the measurement's file. The file you upload 
   will, nevertheless, remain on the SCC and will be used whenever needed.
   
Lidar ratio file (Optional)
   In this optional field you can submit a lidar ratio file that will be used
   by your measurements in the processing. The file needs to follow the netCDF
   file format specified in the pdf file found in the :ref:`netcdf_file` section. 
   The file you submit will not be  necessarily connected with the 
   submitted measurement; which lidar ratio file will be used in the processing 
   of each measurement is specified in the measurement's file. The file you 
   upload will, nevertheless, remain on the SCC and will be used whenever needed.
   
Comments (Optional)
   In this field you can add a small comment (up to 100 characters) to the 
   measurement.
   
Categories (Optional)
   You can assign a number of categories to the uploaded measurement. The 
   categories you assign can be lated changed in the in the "Station Admin"
   section of the site. You can select multiple categories by holding down the 
   "Control" key (PC) or "Command" key (MAC) while selecting.

.. note::
   
   Uploading the measurement file can take considerable time, depending on 
   the size of the file and the speed of your Internet connection. In the
   current version of the site, no feedback is provided during the upload.
   You can get information on your upload progress depending on your browser.
    
   Firefox
      You can install this `add-on <https://addons.mozilla.org/en-US/firefox/addon/uploadprogress/>`_.
      
   Chrome
      A progress indicator is built-in.
   
   IE 9- 
      No progress bar is available (as far as we know).


Form Validation
---------------

The aim of form validation is to detect errors in your submitted data as early
as possible. In this way you can save time by correcting errors before the 
processing of your data fails. 

The data you provide in the form are check in two stages, before you submit 
and after you submit the form.

Before you submit the form
~~~~~~~~~~~~~~~~~~~~~~~~~~

Before you submit the form the following checks are performed:

* All the necessary fields (i.e. "system" and "data file") need to be submitted.

* The ancillary file names have to be in the appropriate format described 
  in :ref:`netcdf_file`. In brief, a sounding file should have a name 
  rs_YYYYMMDDccNN.nc, a overlap file a name ov_YYYYMMDDccNN.nc, and a lidar ratio 
  file a name lr_YYYYMMDDccNN.nc, where YYYY is a year, MM is the month, DD is 
  the day, cc is the EARLINET station call sign and NN is a number. 


After you submit the form
~~~~~~~~~~~~~~~~~~~~~~~~~~

After you submit the form:

* The uploaded **data file** needs to have a unique name.

* The **measurement id** defined in the file should *not* exist in the SCC.

* All channels declared in the measurement file should correspond to declared
  channels in the SCC.

* The submitted measurement file should have the correct netCDF format. All 
  mandatory variables and attributes should be present in the file. All 
  variables and attributes should have the correct type (float, integer, etc).
  This check is not exhaustive, and it is possible that some errors are **not** 
  detected. For example "conditionally" mandatory variables are not checked 
  (as, for example "LR_Input", that is mandatory if elastic backscatter retrievals
  have to be done). 

If ancillary files are submitted
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Additionally, if ancillary files are also uploaded, the following checks are 
performed:

* The submitted measurement file should have the correct netCDF format. All 
  mandatory variables and attributes should be present in the file. All 
  variables and attributes should have the correct type (float, integer, etc).

* A file with the same filename should not exist in the SCC or, if it exists, 
  it should have status "Missing" or "Error". If a file with the same filename
  exists, and its status is "OK" the submitted file is rejected.
