-
Notifications
You must be signed in to change notification settings - Fork 29
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
Incorporate Julia Putko's changes #86
Conversation
Removed the module and the directory.
I've commented out some sections that Julia Putko added that may be causing tests to fail. These sections change the formatting for the dates, I think.
I made a typo in my fix, where I didn't comment out the end of a line. This is fixed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, not sure about the pyglider changes. We need to move the website stuff out of pyglider and into cproofwebsite. I've not seen the plotting changes.
pyglider/slocum.py
Outdated
@@ -639,6 +639,113 @@ def merge_rawnc(indir, outdir, deploymentyaml, | |||
ds.to_netcdf(outnebd, 'w') | |||
|
|||
|
|||
with open(deploymentyaml) as fin: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these changes are reversing the new work we just did to clean this up, so please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
pyglider/slocum.py
Outdated
#only the merge jpnote | ||
|
||
## jpnote: global variables ## | ||
# - preprocess overwrites variables - | ||
# - need global list to append multiple netcdf file attributes ## | ||
|
||
globlist = [] | ||
latmin = [] | ||
latmax = [] | ||
lonmin = [] | ||
lonmax = [] | ||
|
||
def preprocess(ds): | ||
|
||
global globlist | ||
global latmin | ||
global latmax | ||
global lonmin | ||
global lonmax | ||
|
||
# dsnew = ds.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You almost never want to use globals. I'm not sure what is being done here to be honest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a rough fix for some of the things you later fixed properly. It's all been removed.
pyglider/slocum.py
Outdated
@@ -753,6 +867,25 @@ def raw_to_timeseries(indir, outdir, deploymentyaml, *, | |||
|
|||
ds.attrs['deployment_start'] = str(start) | |||
ds.attrs['deployment_end'] = str(end) | |||
|
|||
## jpnote: beginning of jp addition ## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't tell what this is supposed to do, but I don't think it is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been removed.
pyglider/website.py
Outdated
# jpnote addition for argo float calcs | ||
import argopandas as argo | ||
import pandas as pd | ||
# end of jp addition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets redo this PR with the changes in website, plotting, and other modules all separate. I think the website work all needs to move to the website repo? Definitely we cannot have argopandas in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These all look useful, but I think we need to move out of pyglider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything argopandas related has been removed. For the website work, I'd like to first get it to merge properly into website.py, then move that into the website repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argopanda commit is still in this PR...
For website.py, lets copy the version on upstream/main
into cproofwebsite, and commit it there (maybe under scripts/ or something). Then make a pr on the website repo for the changes proposed here. The website can have argopandas as a dependency (not a submodule ;-)) and we can have the map plotting in there etc.
Probably the same with mapplotting.py. That is far too specific to our sites to be part of pyglider.
Again, we really want pyglider to be of general use, so we should try and move cproof specific routines out if we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes that was an empty argopandas directory that's now been removed.
For website.py and mapplotting.py, can I finish this pull request and then move them over into cproofwebsite? It would be nice to not be trying to do two things at once, when I'm struggling with git for both of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to add mapplotting.py to git history of this repo (though its not a big deal). Just remove it from the PR, and move the file to a temperorary location.
We could merge the changes to website.py, but you may as well just do the same thing - move the version you want to use to a different location. Why? Because we know website.py
works as-is. When we move it over, it is far better to start with a version that we know works, than one that hasn't been tested yet, and then make PRs on that version (i.e. the changes you propose here). The advantage is that we can always back the changes out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
pyglider/seaexplorer.py
Outdated
@@ -454,4 +454,3 @@ def _parse_sensor_config(filename): | |||
return active_device_dicts | |||
|
|||
|
|||
__all__ = ['raw_to_rawnc', 'merge_rawnc', 'raw_to_timeseries'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but please add the extra line back in and remove the two spare carriage returns. We don't have linting turned on, but we will ;-). Liniting ensures some coding consistency and it will complain about both of these changes.
basically a little trick here is git restore --source=upstream/main pyglider/seaexplorer.py
to restore the old version.
Please do the same for slocum below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I've reverted an accidentally deleted line in seaexplorer.py and fixed a broken if statement in plotting.py
Removed Julia's fix that was doing similar things to Jody's more recent updates.
pyglider/plotting.py
Outdated
sharex=True, sharey=True) | ||
axs = axs.flat | ||
for n, k in enumerate(keys): | ||
_log.debug(f'key {k}') | ||
|
||
pconf = config['pcolor']['vars'][k] | ||
_log.debug(pconf) | ||
cmap = pconf.get('cmap', 'viridis') | ||
|
||
cmap = plt.cm.get_cmap('viridis') #jp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes the colormap un-configurable...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted to the original line.
pyglider/plotting.py
Outdated
ax.xaxis.set_major_locator(locator) | ||
ax.xaxis.set_major_formatter(formatter) | ||
# locator = mdates.AutoDateLocator(minticks=3, maxticks=7) | ||
# formatter = mdates.ConciseDateFormatter(locator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably want to keep this in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it back in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping this part of the code causes an out of index error in matplotlib/dates.py in the testing. I've looked at it, but I don't know enough about dates.py to troubleshoot it very effectively. Did you want me to just keep lines 270 and 271 or the entire block of code following those lines that Julia added (and similar pieces of code elsewhere in plotting.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably figure out what is going on. But I'm confused because this has been woking, so I'm not clear why it is broken now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its because you didn't specify enough empty offsets.
But... why would you get rid of the offsets? The dates can often be meaningless with out them
You guys also changed a bunch of things about the plots that were features not bugs. You labeled all the ticks on each axes, which were explicitly not labeled in the original. You changed the date formatting, etc. I put substantial care into making the grid plots the way I want them. I'm happy to take suggestion on them, but I'll revert the ones here.
pyglider/plotting.py
Outdated
ax.yaxis.set_tick_params(labelbottom=True) | ||
ax.xaxis.set_tick_params(labelbottom=True) | ||
# locator = mdates.AutoDateLocator() | ||
# formatter = mdates.ConciseDateFormatter(locator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above.
pyglider/plotting.py
Outdated
ax.set_ylim([300, 0]) | ||
|
||
vmax = 300 | ||
cmap.set_over("black") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of "over" being coloured black...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was to differentiate it from the gray bathymetry. What colour would be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I've just removed it because it was failing the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - usually the over cover is just the max color of the colormap? Maybe you are referring to the NaN behaviour, which will just put an empty square. That is indeed hard to differentiate from bathymetry depth unless you have a bathy estimate from elsewhere.
pyglider/plotting.py
Outdated
depth = ds.depth[:-1] - np.diff(ds.depth) | ||
depth = np.hstack((depth, depth[-1] + np.diff(ds.depth)[-1])) | ||
pc = ax.pcolormesh(time, depth, ds[k][:, ind], | ||
rasterized=True, vmin=min, vmax=max, cmap=cmap, shading='auto') | ||
rasterized=True, vmin=min, vmax=max,cmap=cmap, shading='auto') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The space will fail flake8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put the space back.
pyglider/plotting.py
Outdated
ds[k].attrs['units'] + ']', fontsize=9) | ||
# ax.set_title(ds[k].attrs['long_name'] + ' [' + | ||
# ds[k].attrs['units'] + ']', loc='left', fontsize=9) #jpnote commented | ||
ax.set_title(ds[k].attrs['long_name'] + ' over Depth [m]', loc='left', fontsize=9) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "over Depth [m]" mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
pyglider/plotting.py
Outdated
# ax.set_ylim([depmax, 0]) | ||
ax.set_ylim([300, 0]) #jp changed (or should I leave it as dep max? ) | ||
# if n == 0: | ||
ax.set_ylabel('DEPTH [m]') | ||
# ax.set_xlabel('TIME (May - June)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd revert these changes...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the plotting, I think my take away is to not change the grid plots. I don't care about the time series plots as they looked pretty bad.
Removed the now-empty argopandas directory from pyglider directory.
Removed all jp changes from slocum.py and fixed an extra line and carriage returns in seaexplorer.py.
Undid some changes that would cause issues with colormaps, flake8, and date formatting.
Fixed an issue with axis labels and with the colormap.
I'll merge this, even though its broken and push a new PR to fix |
Hi @hvdosser So, this was confusing to deal with because I think you just made a PR on a c-proof branch versus your own branch? I see you have your own fork so the usual workflow would be: clone your own fork locally:
If you do
you can see that your branch is the remote named origin. Add upstream remote:
Now there is a second remote named upstream. You can fetch it, and you will then have the commits in that remote on your machine:
Make a placeholder branchThis is less confusing than using main locally as your default branch. I do
That makes the placeholder branch an exact copy of the upstream/main branch Make a new branch
and edit away. However, make pull requests early and often. They are easier to review and check in about. Commit some changesSome code has changed, and you want to save it as a commit:
Push to GitHub remoteDo not push to upstream, unless you really really have to! Always push to origin!
It should give a message like
You can subsequently keep pushing to that branch as you add more commits. Rebasing because upstream has changedIf upstream/main changes, then GitHub tries to reconcile your changes with the upstream changes. You can do this locally with
If there are no conflicts, then your changes do not conflict, and you can push up to origin no problem. However, because the base of the branch has changed from the old upstream/main to the new upstream/main you need to force push any changes:
However, sometimes you will have "merge conflicts" because some one else has changed code you are also trying to change, and git can't figure out whose change to apply. The rebase will list these files with problems. For each one you need to
When all the files have been reconciled, you need to continue: Git reconciles each commit one by one, so its possible future commits will also have conflicts that also need to be reconciled. This is a good reason to keep your number of commits to a bare minimum. Squashing commitsWhen developing, I'll often have a bunch of commits, but when it is time to reconcile with upstream, or push to GitHub. all these commits become a liability, so I can squash them. The most failsafe way to do this is to figure out the last commit that you did not author as part of the PR by doing
So here, the last commit that was on GitHub was
which will do an interactive rebase. This should open my editor, and then I choose to "squash" or "pick" the commits. Int his case I'd squash all except After you are done this you can force to your PR: |
Fixed conflicts in slocum.py and seaexplorer.py and removed Argo submodules.