Open haileyajohnson opened 3 weeks ago
Hello @haileyajohnson . Thank you for the bug correction. I forked the plugin and made some changes in the main code and tests. Should I do a PR?
Basically, in the direction calculation I had to replace atan2(v/u)
with atan2(u/v)
and convert from radians to degrees in the 0 to 360 range to get the correct values. I checked against the ones calculated using metpy and ncWMS and everything seems OK:
I think now there are only two problems left.
The user needs a way of passing the "convention" used to convert u and v to direction. I think the best way would be to follow metpy conventions and use "to" (atan2(u/v)
) and "from" (atan2(-u/-v)
) in the vectorize_dir
attribute, e.g.:
<attribute name="vectorize_dir" value="uo/vo/to" />
or
<attribute name="vectorize_dir" value="uo/vo/from" />
I am not very good with Java but I think I can manage to do a new PR with this feature.
The second problem is that the "direct access" using the OPENDAP protocol still returns all zeros for magnitude and direction and the direct download (using HTTPServer) does not return the new variables.
That is, the values are correct if using NetcdfSubset or ncWMS/Godiva3 to access the data, but the access fails (in different ways) if using OPENDAP or HTTPServer
With OPENDAP, everything is zero:
With HTTPServer, the new variables are not included:
Thank you!
That's awesome! Yes please, a PR would be great! u/v/{to|from} works for me.
I'll take a look at what's happening with OPeNDAP, NcML is not applied to HttpServer since it just serves the file exactly as it exists on disk - the new variables don't exist on disk. Typically you don't enable HttpServer for NcML based datasets, like aggregations.
Cool, I will start working on the u/v/{to|from} feature.
To be honest, I almost never enable HttpServer as I and most of my users only use NCSS, OPENDAP and ncWMS. So the new variables not showing up in HttpServer is not really a problem for me. I just noticed it and decided to report it.
Thank you.
@marceloandrioni - I did fix a bug while testing against the dataset you used (https://github.com/haileyajohnson/vectorize-thredds-plugin/commit/b4f8ff810ac348221f7d6cce176c48c16fcbf1f3), and I'm getting non-zerzo and non-NaN values.... but I haven't checked that they're correct values OR that it works correctly with the TDS so those are still on my TODO list.