diff --git a/NEWS.md b/NEWS.md index 90832a3e3c9bcbdac7d8b699b82014c3aad00ce6..e50ff106d5cbd58460601d85fd0fccbc5adebb67 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# startR v0.1.5 (Release date:) +- Bugfixes of lat and lon assigned by 'values' in Start(). In v0.1.4 it is incorrect when assigned from big to small values. # startR v0.1.4 (Release date: 2020-02-10) - Bugfixes of transform in Start(). Change the default value of param 'extra_cells' to 2. (issue37) - Bugfixes of chunk function in Utils.R (issue23) diff --git a/R/Start.R b/R/Start.R index eec20acd0b4e9cd583964d27fa6a3be99633931f..c3422bbfdc32b13ae18304036a19c9c045604242 100644 --- a/R/Start.R +++ b/R/Start.R @@ -1983,6 +1983,13 @@ print("-> THE INNER DIMENSION DOES NOT GO ACROSS ANY FILE DIMENSION OR IT DOES B tolerance_params[[inner_dim]] }) } + ## This 'if' runs in both Start() and Compute(). In Start(), it doesn't have any effect (no chunk). + ## In Compute(), it creates the indices for each chunk. For example, if 'sub_array_of_indices' + ## is c(5:10) and chunked into 2, 'sub_array_of_indices' becomes c(5:7) for chunk = 1, c(8:10) + ## for chunk = 2. If 'sub_array_of_indices' is list(55, 62) and chunked into 2, it becomes + ## list(55, 58) for chunk = 1 and list(59, 62) for chunk = 2. + ## TODO: The list can be turned into vector here? So afterward no need to judge if it is list + ## or vector. if (!is.list(sub_array_of_indices)) { sub_array_of_indices <- sub_array_of_indices[chunk_indices(length(sub_array_of_indices), chunks[[inner_dim]]["chunk"], @@ -1992,13 +1999,13 @@ print("-> THE INNER DIMENSION DOES NOT GO ACROSS ANY FILE DIMENSION OR IT DOES B tmp <- chunk_indices(length(sub_array_of_indices[[1]]:sub_array_of_indices[[2]]), chunks[[inner_dim]]["chunk"], chunks[[inner_dim]]["n_chunks"], inner_dim) - start_pt <- sub_array_of_indices[[1]] - sub_array_of_indices[[1]] <- start_pt + tmp[1] - 1 - sub_array_of_indices[[2]] <- start_pt + tmp[length(tmp)] - 1 + vect <- sub_array_of_indices[[1]]:sub_array_of_indices[[2]] + sub_array_of_indices[[1]] <- vect[tmp[1]] + sub_array_of_indices[[2]] <- vect[tmp[length(tmp)]] } - # The sub_array_of_indices now contains numeric indices of the values to be taken. + # The sub_array_of_indices now contains numeric indices of the values to be taken by each chunk. -#Check if all the files have the selectors assigned (e.g., region = 'Grnland') _20191015 +# Check if all the files have the selectors assigned (e.g., region = 'Grnland') _20191015 if (is.character(sub_array_of_selectors)) { array_of_var_files_check <- vector('list', length(selector_indices)) for (k in 1:length(selector_indices)) { @@ -3124,3 +3131,4 @@ print(str(store_indices)) } is.null(sub_array) } +