LoadStartDate <- function(environment) {
  with(environment, {

  ## In function of the name of the variable and the dataset and other
  ## parameters we build the path to the file, following the rules 
  ## specified in the configuration file.
  filename <- replaceVariablesInString("$EXP_FULL_PATH$", replace_values)
  ## We obtain the names of all data files in the directory of the 
  ## repository.
  argfiles <- paste('ls', filename)
  files <- system(argfiles, intern = TRUE, ignore.stderr = TRUE)
  
  ## If we do not find any file there, we print a warning and set as file
  ## name 'nofile.nc'. If we find any, we take the last as file name.
  ## Then we set the grid. If the grid to apply is the default grid of  
  ## the experiment we do not apply changes to the data file, so the file 
  ## name remains the same.
  ## If the grid has to be changed, we use 'cdo' for this purpose and 
  ## then save the changes into a temporary file named 'tmp.nc'.
  if (length(files) > 0) {
    filename <- files[length(files)]
    print(filename)
  } else {
    if (is_file_per_ensemble_exp[jmod] && jmemb > 1) {
      print(paste('This message may not be an error. No file in ', argfiles,
                  '. Data corresponding to this file will be filled with NA values.'))
    } else {
      print(paste('Error: No file in ', argfiles))
      ## TODO: exit
    }
    filename <- 'nofile.nc'
  }
  
  if (filename != 'nofile.nc') {
    if (defgrid) {
      grid <- replaceVariablesInString(dataset_info[3], replace_values)
      filein <- filename
    } else {
      system(paste("cdo ", remap, ",", grid, " -selname,", namevar, " ", 
                   filename, " tmp.nc 2>/dev/null", sep = ""))
      system("ncrename -v lat,latitude -d lat,latitude -v lon,longitude -d lon,longitude tmp.nc")
      filein <- "tmp.nc"
    }
    
    ## We open the file whichever is its name and we load into the 
    ## variable tmp the data of the specified variable it contains.
    fnc <- open.ncdf(filein)
    tmp <- get.var.ncdf(fnc, namevar)
    
    ## Now we have to arrange the data in the matrix tmp with the 
    ## dimensions in a common order:
    ##   1) Longitudes 
    ##   2) Latitudes
    ##   3) Members (even if is not a file per ensemble experiment)
    ##   4) Lead-times
    ##
    ## If the variable is 2-dimensional (atmospheric):
    if (is_atm_var) {
      ## We disable large values.
      tmp[which(tmp > 1e11)] <- NA
      tmp[which(tmp < (-1e33))] <- NA
      ## If the matrix loaded has only 3 dimensions, it means it only 
      ## contains data for one member so the dimension of the members has
      ## length 1 and has been automatically squeezed.
      ## It has to be added.
      if (length(dim(tmp)) == 3) {
        tmp <- InsertDim(tmp, 3, 1)
      }
      ## We read the longitudes and latitudes from the file.
      lat <- get.var.ncdf(fnc, "latitude")
      lon <- get.var.ncdf(fnc, "longitude")
      ## We re-order the latitudes if needed.
      if (lat[1] < lat[length(lat)]) {
        tmp <- tmp[, length(lat):1, , ]
        if (length(dim(tmp)) == 3) {
          tmp <- InsertDim(tmp, 3, 1)
        }
        lat <- lat[length(lat):1]
      }
      ## TODO: Where is lat_mod and lon_mod?
    ## If the variable is a global mean (oceanic):
    } else {
      ## In this case, the file should contain data in two dimensions: 
      ## members and lead-times.
      ## If any of them does not appear, it is because there was only one 
      ## member or only one lead-time and was automatically squeezed.
      if (is.null(dim(tmp))) {
        tmp <- InsertDim(tmp, 1, 1)
      }
      if (length(dim(tmp)) < 2) {
        tmp <- InsertDim(tmp, 1, 1)
      }
      ## We add two dimensions corresponding to latitudes and longitudes 
      ## to fulfill the common order.
      tmp <- InsertDim(tmp, 1, 1)
      tmp <- InsertDim(tmp, 1, 1)
      ## We set as output longitudes and latitudes one single point 
      ## (0, 0) to avoid a crash.
      lat_mod <- 0
      lon_mod <- 0
    }
    close.ncdf(fnc)
  }
  
  })
}
