I am making a request through a API
of the NASA
, to obtain information, but the data returned through this is long, because each corresponds to each day of the year.
It depends on the year, whether it's a leap year (366 days) or not (365 days) , I get information, which I access, are objects and arrays , but because it is very long, I did not know that the maximum length allowed was 100 values within array
.
Array
(365) [5.34, 5.68, 5.59, 5.52, 5.42, 4.32, 4.48, 3.68, 3.93, 4.79, 5.74, 4.26, 3.2, 5.26, 5.34, 4.97, 5.21, 5.13, 5.3, 5.07, 5.26, 4.99 , 5.36, 5.26, 4.54, 5.99, 6.18, 5.96, 5.47, 4.9, 4.19, 5.66, 5.17, 5.53, 4.88, 5.12, 5.65, 5.38, 5.06, 4.9, 5.64, 5.01, 4.4, 5.44, 5.88, 6.3, 5.5 , 6.38, 6.48, 6.58, 6.08, 6.49, 5.4, 6.15, 6.66, 6.67, 6.23, 5.8, 6.26, 5.6, 6.25, 4.85, 3.73, 4.49, 3.69, 3.43, 5.09, 4.64, 5.73, 5.48, 5.22, 5.72 , 6.65, 5.47, 6.63, 6.15, 6.22, 6.03, 6.58, 6.28, 6.24, 3.22, 2.16, 5.69, 5.72, 5.02, 5.86, 5.22, 4.53, 5.81, 4.86, 6.41, 6.51, 6.45, 6.67, 6.44, 6.61 , 5.42, 5.16, 6.21, ...]
[0 … 99]
[100 … 199]
[200 … 299]
[300 … 364]
length: 365
The vector ends by dividing into 4 vectors, 3 with 100 values each, and a last one with 64. I would like to know how to obtain the values depending on the number of days per month, taking them as a constant reference.
Example
January : (31 days)
The idea is to take the first 31 values of the first array
[0 ... 99] , and be able to assign them, that is, only take these values, [0 .. .30] .