From 02dcafbdc06eb80f7c0e600725abe6d3242e1fa8 Mon Sep 17 00:00:00 2001 From: aho Date: Thu, 29 Apr 2021 16:30:34 +0200 Subject: [PATCH 1/4] Refine How_to_11 --- inst/doc/faq.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/inst/doc/faq.md b/inst/doc/faq.md index 3b6d5fa..714a7ef 100644 --- a/inst/doc/faq.md +++ b/inst/doc/faq.md @@ -475,7 +475,7 @@ The code to reproduce this behaviour could be found in the Use Cases section, [e ### 11. Select the longitude/latitude region There are three ways to specify the dimension selectors: special keywords('all', 'first', 'last'), indices, or values (find more details in [pratical guide](inst/doc/practical_guide.md)). -The parameter 'xxx_reorder' is only effective when using **values**. +For now, the parameter 'xxx_reorder' is only effective when using **values**. There are two reorder functions in startR package, **Sort()** for latitude and **CircularSort()** for longitude. Sort() is a wrapper function of base function sort(), rearranging the values from low to high (decreasing = TRUE, default) or @@ -487,9 +487,16 @@ It requires two input numbers defining the borders of the whole region, which ar `longitude_reorder = CircularSort(0, 360)` means that the left border is 0 and the right border is 360, so 360 will be put back to 0, 361 will be put back to 1, and -1 will become 359. After circulating values, CircularSort() also sorts the values from small to big. It may cause the discontinous sub-region, but the problem can be solved by assigning the borders correctly. +Note that the two points in CircularSort() are regarded as the same point. Hence, if you want to load the global longitude, lonmin/lonmax should be slightly different, e.g., 0/359.9, 0.1/360, -179.9/180, -180/179.9, etc. Otherwise, only one point will be returned. The following chart helps you to decide how to use CircularSort() to get the desired region. -The first row represents the longitude border of the requested region, e.g., `values(list(lon.min, lon.max))`. +The first row represents the longitude border of the requested region, e.g., `values(list(lon.min, lon.max))`, +and the white part is the returned longitude range corresponding to each CircularSort() setting. +Here are some summaries: +- The original longitude range does not matter. No matter the original longitude is [0, 360] or [-180, 180], Start() will return the values shown in the chart according to the lonmin/lonmax you set. +- The lonmin/lonmax value should be consistent with CircularSort(), so the returned values are continuous. For example, if `lonmin/lonmax = -60/60`, `CircularSort(-180, 180)` should be used. +- Define the longitude range as the one you want to get, regardless the original file. For example, if you want the data to be [-180, 180], define `lonmin/lonmax = -179.9/180` and `CircularSort(-180, 180)`, even if the original longitude in the netCDF file is [0, 360]. + Note that this chart only provides the idea. The real numbers may slightly differ depending on the original/transform values. -- GitLab From 7c5a8dfa2594c80d2eeaed35289153fb4c044026 Mon Sep 17 00:00:00 2001 From: aho Date: Fri, 30 Apr 2021 09:17:01 +0200 Subject: [PATCH 2/4] Fix link --- inst/doc/usecase.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/doc/usecase.md b/inst/doc/usecase.md index ac4e4ad..137f473 100644 --- a/inst/doc/usecase.md +++ b/inst/doc/usecase.md @@ -25,7 +25,7 @@ in a comparable structure. It also shows how to use parameters `xxx_tolerance`, 5. [Use reorder functions to get desired lat/lon region](inst/doc/usecase/ex1_5_latlon_reorder.R) This script shows you how to use reorder function (`Sort()`, `CircularSort()`) to -get the desired longitude and latitude region. See [FAQ How-to-#11] (/inst/doc/faq.md#11-read-latitude-and-longitude-with-the-usage-of-parameter-xxx_reorder) +get the desired longitude and latitude region. See [FAQ How-to-#11] (inst/doc/faq.md#11-select-the-longitudelatitude-region) for more explanation. 6. [Loading gridpoint data](inst/doc/usecase/ex1_6_gridpoint_data.R) -- GitLab From 9d2c358a5cc99103b9ecc17f209a9db65dfb0b55 Mon Sep 17 00:00:00 2001 From: aho Date: Fri, 30 Apr 2021 09:17:43 +0200 Subject: [PATCH 3/4] Fix Sort(decreasing = T) error --- inst/doc/faq.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/doc/faq.md b/inst/doc/faq.md index 714a7ef..83676f3 100644 --- a/inst/doc/faq.md +++ b/inst/doc/faq.md @@ -478,8 +478,8 @@ There are three ways to specify the dimension selectors: special keywords('all', For now, the parameter 'xxx_reorder' is only effective when using **values**. There are two reorder functions in startR package, **Sort()** for latitude and **CircularSort()** for longitude. -Sort() is a wrapper function of base function sort(), rearranging the values from low to high (decreasing = TRUE, default) or -from high to low (decreasing = FALSE). For example, if you want to sort latitude from 90 to -90, use `latitude_reorder = Sort(decreasing = TRUE)`. +Sort() is a wrapper function of base function sort(), rearranging the values from low to high (decreasing = FALSE, default) or +from high to low (decreasing = TRUE). For example, if you want to sort latitude from 90 to -90, use `latitude_reorder = Sort(decreasing = TRUE)`. By this means, the result will always from big to small value no matter how the original order is. On the other hand, the concept of CircularSort() is different. It is used for a circular region, putting the out-of-region values back to the region. -- GitLab From 45cbe5a9aedaad408b21cc6cc93a5b4edc24c4d7 Mon Sep 17 00:00:00 2001 From: aho Date: Fri, 30 Apr 2021 09:20:17 +0200 Subject: [PATCH 4/4] Fix typo --- inst/doc/usecase.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/doc/usecase.md b/inst/doc/usecase.md index 137f473..06f2c04 100644 --- a/inst/doc/usecase.md +++ b/inst/doc/usecase.md @@ -25,7 +25,7 @@ in a comparable structure. It also shows how to use parameters `xxx_tolerance`, 5. [Use reorder functions to get desired lat/lon region](inst/doc/usecase/ex1_5_latlon_reorder.R) This script shows you how to use reorder function (`Sort()`, `CircularSort()`) to -get the desired longitude and latitude region. See [FAQ How-to-#11] (inst/doc/faq.md#11-select-the-longitudelatitude-region) +get the desired longitude and latitude region. See [FAQ How-to-#11](inst/doc/faq.md#11-select-the-longitudelatitude-region) for more explanation. 6. [Loading gridpoint data](inst/doc/usecase/ex1_6_gridpoint_data.R) -- GitLab