Package 'L3bin'

Title: Integerized Sinusoidal Binning Scheme for Level 3 Data
Description: The NASA Ocean Biology processing Group L3 bin scheme, based on the sinusoidal map projection. Psuedo code for the binning scheme was published in Appendix A of NASA Technical Memorandum 104566, Vol. 32., listed in URL.
Authors: Michael D. Sumner [aut, cre], NASA's OceanColor Web [ctb, cph]
Maintainer: Michael D. Sumner <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-09-05 05:53:28 UTC
Source: https://github.com/hypertidy/L3bin

Help Index


Generate bin number from longitude latitude.

Description

Bin number from longitude and latitude for a given grid with NUMROWS unique latitudes.

Usage

bin_from_lonlat(lon, lat, NUMROWS)

Arguments

lon

longitude

lat

latitude

NUMROWS

number of rows in the grid

Details

This function previously lived in sosoc/croc where it is called lonlat2bin

Value

integer vector of bin number

Examples

bin_from_lonlat(147, -42, 1024)
bin_from_lonlat(c(0, 0, 0), c(-90, 0, 90), 1024)

Crop L3 init object with an extent

Description

Crop L3 list, returns bins that fall within the extent.

Usage

crop_bins(x, extent)

Arguments

x

L3bin object

extent

vector of 'c(xmin, xmax, ymin, ymax)'

Details

This function previously lived in sosoc/croc where it is called crop_init

Value

integer vector of bins

Examples

init <- L3bin(24)
crop_bins(init, c(100, 110, -50, -45))

Calculate bin boundaries from bin number

Description

Calculate bin boundaries from bin number

Usage

extent_from_bin(bin, NUMROWS)

Arguments

bin

bin number

NUMROWS

relevant number of L3 bin rows

Details

Bin boundaries are the xmin, xmax, ymin, ymax edge of each bin - compare to the output of ⁠ ⁠lonlat_from_bin' which returns only the centre of each bin. This function previously lived in sosoc/croc where it is called bin2bounds

Value

matrix of extent columns xmin,xmax,ymin,ymax -

Examples

bins <- L3bin(NUMROWS = 12)
ex <- extent_from_bin(1:bins$totbins, 12)
plot(range(ex[,1:2]), range(ex[,3:4]), type = "n", asp = 1)
points(lonlat_from_bin(1:bins$totbins, 12), pch = "+", cex = .8)
rect(ex[,1], ex[,3], ex[,2], ex[,4])

Set up the basic values for the bin scheme for given number of rows.

Description

This function previously lived in sosoc/croc where it is called initbin

Usage

L3bin(NUMROWS = 2160)

Arguments

NUMROWS

relevant number of L3 bin rows

References

https://oceancolor.gsfc.nasa.gov/docs/format/l3bins/

Examples

L3bin(1024)

Longitude and latitude from bin number.

Description

Generate longitude and latitude coordinates from bin number.

Usage

lonlat_from_bin(bins, NUMROWS)

Arguments

bins

bin number

NUMROWS

number of rows in this grid

Details

This function previously lived in sosoc/croc where it is called bin2lonlat

Value

matrix of longitude, latitude the centre coordinate of the bin

Examples

lonlat_from_bin(c(1, 184), 12)

Latitude to row

Description

Row is 1-based, and starts at the southern-most row.

Usage

row_from_lat(lat, NUMROWS)

Arguments

lat

latitude

NUMROWS

number of rows in the grid

Details

This function previously lived in sosoc/croc where it is called .lat2row.

Examples

row_from_lat(-42, 1024)
row_from_lat(c(-90, 0, 90), 1024)