SunsetProv.Downscaling<-function(recipe,data,graph){
    parentnodename<-graph$parentnodename$parentnodename_hcst
    parentnodename_fcst<-graph$parentnodename$parentnodename_fcst
    parentnodename_obs<-graph$parentnodename$parentnodename_obs
    graph<-graph$graph
    downscInt.type<-recipe$Analysis$Workflow$Downscaling$type
    downsc.type <- switch(downscInt.type,
                          "int" = "Interpolation",
                          "intbc"="Interpolation with Bias Correction",
                          "intlr"="Interpolation with Linear Regression",
                          "logreg"="Logistic Regression",
                          "analogs"="Analogs"
                    )
    description <- switch(downscInt.type,
                    "int" = "Regrid of a coarse-scale grid into a finescale grid, or interpolate model data into a point location. 
                             Different interpolation methods, based on different mathematical approaches, can be applied: conservative, nearest neighbor, bilinear or bicubic. Does not rely on any data for training",
                    "intbc"="Interpolate model data into a fine-scale grid or point location. Later, a bias adjustment of the interpolated values is performed. 
                             Bias adjustment techniques include simple bias correction, calibration or quantile mapping",
                    "intlr"="Interpolate model data into a fine-scale grid or point location. 
                             Later, a linear-regression with the interpolated values is fitted using high-res observations as predictands, and then applied with model data to correct the interpolated values.",
                    "logreg"="Relate ensemble mean anomalies of the large-scale forecasts directly to probabilities of observing above normal/normal/below normal conditions at the local scale using a sigmoid function. 
                              It does not produce an ensemble of forecasts but rather their associated probabilities. It is a statistical method with few parameters to train, and only benefits from local information, but it has shown good performance.",
                    "analogs"="Analog interpolation, or Analog Ensemble (AnEn) interpolation, utilizes historical situations resembling current conditions to estimate values at unsampled locations. 
                               It selects a subset of similar historical events (analog situations), assigns weights based on similarity, and computes a weighted average of analog values to interpolate values at the target location, offering an alternative approach to traditional interpolation methods. 
                               This method captures spatial variability and provides uncertainty estimates, particularly beneficial in areas with complex terrain or sparse observational data."
                    )
    int<-recipe$Analysis$Workflow$Downscaling$int_method #At the time no additional provenance regarding "submethods" applied
    downsc.nodename <- paste0("Downscaling_", "hcst")
    graph <- add_vertices(graph,
                            nv = 1,
                            name = downsc.nodename,
                            label=downsc.type,
                            className = "cal:ESD",
                            attr=list("dc:description"=description,
                                      "dc:comment"="For more details, see the  CSTools documentation for CSDownscale",
                                      "ds:renferenceURL"="https://earth.bsc.es/gitlab/es/csdownscale"))

    graph <- add_edges(graph, 
                        c(getNodeIndexbyName(graph, parentnodename),
                        getNodeIndexbyName(graph, downsc.nodename)),
                        label = "cal:hadCalibration")

    #New Spatial Extent
    refgraph<-getSpatialExtent(data, type="hcst", Downsc=TRUE)
    graph <- my_union_graph(graph, refgraph$graph)
    graph <- add_edges(graph,
                       c(getNodeIndexbyName(graph, downsc.nodename),
                         getNodeIndexbyName(graph, refgraph$parentnodename)),
                       label = "ds:hasHorizontalExtent")    

    
  if(!is.null(data$fcst)){
    graph<-SunsetProv.Command(graph, package="Downscaling", version="2.0.0", fun="modules/Downscaling/Downscaling.R", arg.list=list("recipe"="Recipe","Data"="Data"), 
                             origin.node.name=list(downsc.nodename))
    graph<-list("graph"=graph, "parentnodename"=list("parentnodename_fcst"=parentnodename_fcst, "parentnodename_hcst"=parentnodename,
                                                     "parentnodename_obs"=parentnodename_obs))
  } else{
    graph<-SunsetProv.Command(graph, package="Downscaling", version="2.0.0", fun="modules/Downscaling/Downscaling.R", arg.list=list("recipe"="Recipe","Data"="Data"), 
                             origin.node.name=list(downsc.nodename))
    graph<-list("graph"=graph, "parentnodename"=list("parentnodename_hcst"=parentnodename,"parentnodename_obs"=parentnodename_obs))  
  }
  print(paste0("Downscaling provenance computed for ",type))
  return(graph)
}