Added some checks into the function s2dv_cube.R
to check if lon
and lat
parameters have dimension names. If they don't have named dimension it adds a name of the corresponding dimension in data
. A part from the checks commented above, the function also will return error if lon
vector is provided but data
doesn't have longitudinal dimension. In the case that longitudinal dimension is not lon
or longitude
but it has the same name and same length of the lon
vector it returns only a warning. While in the case parameter lon
doesn't have dimension name it returns an error. The same development is done for latitude
.
The conditionals are organized by the following:
-
The first condition checks if data dimensions contain either
lon
orlongitude
. Then if the length or the dimension name oflon
vector are not consistent with longitudinal dimension ofdata
it returns an error. -
If the first condition is FALSE, then there is the second condition. Here, it checks if
lon
vector has dimension name and if this name is inside data dimensions. Then, if the length oflon
vector and longitudinal dimension are the same it returns a warning notifying that the name is not expected by s2dv_cube. In the case longitudes are different, it returns an error. -
If neither condition 1 nor 2 are TRUE it returns an error.