Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collections API: Implement RasterGroupedAverage #52

Closed
rajadain opened this issue Jul 31, 2017 · 8 comments
Closed

Collections API: Implement RasterGroupedAverage #52

rajadain opened this issue Jul 31, 2017 · 8 comments
Assignees
Labels

Comments

@rajadain
Copy link
Member

Add support for the RasterGroupedAverage operation.

Sample input: nlcd-kfactor-request.json.txt

Expected output: nlcd-kfactor-response.json.txt

Depends on #51

@mmcfarland
Copy link

Include optimizations made via #47

@rajadain rajadain changed the title Implement RasterGroupedAverage Collections API: Implement RasterGroupedAverage Aug 8, 2017
@kellyi kellyi added in progress and removed queue labels Aug 14, 2017
@kellyi kellyi self-assigned this Aug 14, 2017
@rajadain
Copy link
Member Author

Here's an example of RasterGroupedAverage without any rasters to group by:

awc-request.json.txt

awc-response.json.txt

@kellyi
Copy link
Contributor

kellyi commented Aug 16, 2017

#65 is mostly ready for a look, I think, except that I'm getting some slightly output values for the original nlcd-kfactor-request input. Here's what the implementation in #65 currently returns:

{
	"result": {
		"List(42)": 0.22445346552610787,
		"List(22)": 0.20668663718780375,
		"List(43)": 0.23152918045304285,
		"List(71)": 0.26530274008653,
		"List(41)": 0.2639788878915292,
		"List(21)": 0.23288021817461474,
		"List(24)": 0.17446897070338138,
		"List(31)": 0.2255980250794072,
		"List(90)": 0.2502959564896539,
		"List(52)": 0.2708109404806156,
		"List(11)": 0.17810512682757315,
		"List(23)": 0.1956562087269768,
		"List(82)": 0.2680885086530039,
		"List(81)": 0.2662300594180988,
		"List(95)": 0.30244740773923695
	}
}

The values for the RasterGroupedAverage op with no rasters to group by are the same:

{
	"result": {
		"List(0)": 9.937211446569115
	}
}

@kellyi
Copy link
Contributor

kellyi commented Aug 16, 2017

Wonder if the discrepancy above is related to the misalignment issue? @rajadain do you have any other sample inputs to test for the rasterGroupedAverage op with rasters supplied to test?

@rajadain
Copy link
Member Author

The sample input provided above does use misaligned layers, since NLCD and KFactor belong to different generations of rasters WikiWatershed/model-my-watershed#2153. There should only be a difference if there is a tile that is not being selected. I'll try and generate a screenshot using the shape and layers in the input to see if we're missing tiles.

@rajadain
Copy link
Member Author

Hmm, so while there is some misalignment, we are still selecting the correct tiles:

image

So the numbers should be identical.

@kellyi
Copy link
Contributor

kellyi commented Aug 16, 2017

Thanks for checking that! Something's probably off in the implementation then.

@kellyi
Copy link
Contributor

kellyi commented Aug 17, 2017

I'm getting some slightly output values for the original nlcd-kfactor-request input

Turns out this happens when using a list to store the values, then doing list.sum / list.length for the average. Using an (accumulator: DoubleAdder, counter: LongAdder) then doing accumulator / counter instead brings them back into alignment.

kellyi added a commit that referenced this issue Aug 18, 2017
Implement Raster Grouped Average operation

Connects #52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants