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

add aspect ratio as a parameter for image requests #243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yousifelboukhary
Copy link

Description

I modified EDDGrid and EDDTable saveAsImage method (in both) to parse the new value.

Fixes #163

aspect would be a decimal between 0.01 and 100
For this, when the aspect value goes out of bounds, I set it back to Double.NaN indicating the aspect is not set.

  • My code follows the style guidelines of this project
  • My changes generate no new warnings

Copy link
Contributor

@ChrisJohnNOAA ChrisJohnNOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate you making the pull request. Unless I'm missing something this doesn't solve the issue though. This does parse the parameter which is a great start, but it doesn't use that value. I believe you need to set imageHeight = imageWidth * aspect or something similar. Also, we only want this to impact images (not pdf requests), so before adjusting the imageHeight, that should be checked.

Also I'm trying to make sure there is good unit test coverage of ERDDAP code. Please write a unit test that covers the new contributions.

@yousifelboukhary
Copy link
Author

@ChrisJohnNOAA
Thank you for the clarifications! I will work on it. Is there any documentation about the algorithm implemented that would help me understand the function more, or any relevant information that would be appreciated?

@ChrisJohnNOAA
Copy link
Contributor

@ChrisJohnNOAA Thank you for the clarifications! I will work on it. Is there any documentation about the algorithm implemented that would help me understand the function more, or any relevant information that would be appreciated?

Much of the saveAsImage code for both EDDTable and EDDGrid is preparing parameters to call one (or more) of the main functions that do drawing:

SgtMap.makeMap
https://github.com/ERDDAP/erddap/blob/main/WEB-INF/classes/gov/noaa/pfel/coastwatch/sgt/SgtMap.java#L451

SgtMap.makeCleanMap
https://github.com/ERDDAP/erddap/blob/main/WEB-INF/classes/gov/noaa/pfel/coastwatch/sgt/SgtMap.java#L1992

SgtGraph.makeGraph
https://github.com/ERDDAP/erddap/blob/main/WEB-INF/classes/gov/noaa/pfel/coastwatch/sgt/SgtGraph.java#L136

I'm not sure exactly what your question is, but it could be useful to read their Javadoc comments to understand how the variables in saveAsImage are used.

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

Successfully merging this pull request may close these issues.

Add aspect ratio as a parameter for image requests
2 participants