-
Notifications
You must be signed in to change notification settings - Fork 68
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
BUG: datawc does not work on a time axis. #2007
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import cdms2, os, sys, vcs, cdtime, testing.regression as regression | ||
|
||
# Test that we can restrict the plot using datawc along a time axis | ||
dataFile = cdms2.open(os.path.join(vcs.sample_data, "clt.nc")) | ||
clt = dataFile("clt") | ||
clt = clt(latitude=(-90.0, 90.0), longitude=(0.), squeeze=1, | ||
time=('1979-1-1 0:0:0.0', '1988-12-1 0:0:0.0')) | ||
|
||
# Initialize canvas: | ||
canvas = regression.init() | ||
|
||
# Create and plot quick boxfill with default settings: | ||
boxfill=canvas.createboxfill() | ||
|
||
# Change the type | ||
boxfill.boxfill_type = 'custom' | ||
boxfill.datawc_y1 = 12 | ||
|
||
canvas.plot(clt, boxfill, bg=1) | ||
|
||
# Load the image testing module: | ||
# Create the test image and compare: | ||
regression.run(canvas, "test_vcs_boxfill_datawc_time.png") |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@danlipsa why
months since 1900
, we should use thegm.datawc_units
andgm.datawc_calendar
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.
@doutriaux1 This is a way to get the type, so the actual value does not matter. I got this from Canvas.py:3051. Is there a better way to get the type returned by cdtime.reltime?
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 about component time?
Is it ok to return
v
if it's a component time?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.
@doutriaux1 What is comptime? I did not try it, so probably not. It does not work with rel time either - I did try that. Its not clear from the documentation that datawc_ accepts objects beyond float values. I added an issue for this and we can fix it and add tests.
#2009
The question is: should we do this for 2.6 or leave it for later? Note this PR solves the user's issue. @aashish24 ?
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. A
comptime
is a componentTime. Basically a date. Whereasreltime
is a relative time, i.e a delta since some reference date. You should take a look at: http://uvcdat.llnl.gov/documentation/cdms/cdms_3.html