I would like to use agenda to keep track of my classes, assuming i have a com 355 class every week from march to june,
<2010-03-23 Tue 10:40-12:10 +1w>
this works but it schedules it indefinitely if i use,
<2010-03-23 Tue 10:40-12:10 +1w>-<2010-06-23>
it gets scheduled for everyday from march to june, how can i schedule this once a week for a period of time?
I had a similar problem and found usefull the answer to "How can I create more complex appointments in my org-files?" in the FAQ at http://orgmode.org/worg/org-faq.html#Appointments/Diary You can even add exceptions for holidays. I was not able to make work the time though: when you add it the formula stops working :(
1) My example: Courses on Tuesdays and Thursdays falling in [2011-03-07 Mon]--[2011-06-25 Sat] minus [2011-05-15 Sun]--[2011-05-20 Fri] (a week of holiday):
** TEST Tuesday and Thursday in [2011-03-07 Mon]-[2011-06-20 Mon] minus holidays [2011-05-15 Sun]-[2011-05-22 Sun]
<%%(and (diary-block 3 7 2011 6 20 2011)(or (= 2 (calendar-day-of-week date) (= 4 (calendar-day-of-week date))))(not (diary-block 5 15 2011 5 22 2011)))>
If you decompose the boolean function, you get the following, which is self explanatory:
<%%(and (diary-block 3 7 2011 6 20 2011)
(or (= 2 (calendar-day-of-week date) (= 4 (calendar-day-of-week date))))
(not (diary-block 5 15 2011 5 22 2011))
)>
2) My suggestion for your case: a class every Tuesday every week from March to June (I took the liberty to fix the year to 2011):
<%%(and (= 2 (calendar-day-of-week date)) (diary-block 3 23 2011 6 23 2011)))>
You might want to have a look to the newly added section "How can I schedule a weekly class that lasts for a limited period of time?", about the function "org-diary-class", but it still seems to have problem with scheduling hours :(
Hope it helps,
There might not be a way to do that directly, but Org-mode allows you to specify times using the diary sexp style. (http://orgmode.org/org.html#Timestamps)
If you look at some of the examples in the manual for the diary functions (http://www.gnu.org/software/emacs/manual/html_node/emacs/Sexp-Diary-Entries.html#Sexp-Diary-Entries) you'll see that you can provide arbitrary code to define the occurrences of the event.
There is no way to do what you want --- ranges don't work for this (I asked on the org-mode list).
You can clone the appointment, setting the clones one week apart. This will give you one instance of the item for every day in the period. This might be cumbersome, or it might be just what you want.
You can use the diary to do this, there's an explanation here if you follow the instructions (make sure you have a ~/diary file) then it will pick it up and add it to your agenda. You may need to alter your date format depending on your settings.
Something like this should do the trick, and it should schedule hours
%%(org-diary-class 2011 5 31 2011 10 13 2) 5:00pm-6:30pm German Class
%%(org-diary-class 2011 5 31 2011 10 13 4) 6:45pm-8:15pm German Class
Where the numbers represent
Start Y M D Finish Y M D DayOfWeek (Sun = 0, Mon = 1 ...)
This works for me already many years:
* Modeling of curves and surfaces II 13:10-14:40
<%%(org-class 2019 2 18 2019 5 17 4 13)>
Related
Is there any command in cdo or nco (which I am not very familiar with) to add some timesteps at the beginning of a long time series? Let's say I have a long time series (1959-2021) within summer season (JJA) and I want to add from 24-30 August 2021 at the beginning of 1959 and from 1-8 June at the end of 2021. I was thinking to selec the days with cdo but then I am not sure how to do this with a cdo command (cdo mergetime I think will merge it at the end only), so I was wondering if there is any command in nco or even cdo that can do this?
Thanks in advance !!
add days at the beginning of a time series and at the end.
The question needs a little clarification, you mean that the 1-8 June is from 1959 and you want to post it to the end of the series? In other words you want to make the series cyclic? And what is the frequency of the data, daily? hourly? And also when you paste it to the start, you mean you want it pasted to 24-30 aug 1958, or the last days of May in 1959, in which case that will be your only May days? Please try to be specific and detailed when posting. Think of your question as a cake recipe you need to specify, we need to know the ingredients :-)
So, guessing what you want to do, and assuming hourly data frequency... I think you could do this by selecting the steps you want, resetting the time axis and then doing mergetime (here I just paste the end to the start, duplicate for the other direction):
cdo seldate,2021-08-24,2021-08-30 in.nc out1.nc
cdo settaxis,1958-08-24,00:00:00,1hour out1.nc out2.nc
cdo mergetime out2.nc in.nc merged.nc
An alternative, if you want to shift the end to 1958, same dates is to use shifttime, then the code is :
cdo seldate,2021-08-24,2021-08-30 in.nc out1.nc
cdo shifttime,-63years out1.nc out2.nc
cdo mergetime out2.nc in.nc merged.nc
It seems a strange thing to do though... I'm guessing from your date range that you are playing with ERA5 reanalysis. If you want to do this because you want to apply a running mean and don't want to get a shorter output, then it is more appropriate to pad the data at the start with the first x days repeated, same thing if you want to apply an FFT.
See the NCO documentation about selecting date ranges:
ncrcat -d time,2021-08-24,2021-08-30 in.nc august2021.nc
ncrcat -d time,1958-06-01,1958-06-08 in.nc june1958.nc
ncrcat august2021.nc in.nc june1958.nc out.nc
I am using Emacs Orgmode 9.1.3 to track habit and I saw a very useful habit template below. However I was not sure what the forward slash / meant in the date.
* NEXT HABIT
[2017-12-07 Thu 10:26]
SCHEDULED: <2017-12-07 Thu .+1d/3d>
:PROPERTIES:
:STYLE: habit
:REPEAT_TO_STATE: NEXT
:END:
I read through the org documentation but there is no mention of the forward slash in setting a repeated task.
There is a reference to some sort of reminder like this:
DEADLINE: <2005-10-01 Sat +1m -3d>.
which will provide a reminder three days in advance of a task due date.
Does anyone know what the forward slash does?
You looked in the wrong section of the documentation: this notation applies to habits where you find:
The TODO may also have minimum and maximum ranges specified by using the syntax ā.+2d/3dā, which says that you want to do the task at least every three days, but at most every two days.
I'm a beginner with Common Lisp and I'm currently trying out the package local-time.
I'm trying to create a date with the make-timestamp macro which creates an instance of timestamp. I consulted the local-time manual, but I do not understand which arguments I have to supply.
The description of the macro is as follows:
ā Macro: make-timestamp &key :day :sec :nsec
Expands to an expression that creates an instance of a timestamp exactly as specified.
Simply using the macro without any arguments makes this happen:
LOCAL-TIME> (make-timestamp)
#2000-03-01T01:00:00.000000+01:00
2000-03-01 is the standard epoch here, so this seems okay so far.
Passing :day 3 as an argument gives me this:
LOCAL-TIME> (make-timestamp :day 3)
#2000-03-04T01:00:00.000000+01:00
Okay. But how can I construct a date from this without having to count days and days into the future from 2000-03-01?
There is also a function called encode-timestamp which appears to do exactly what I want (namely: creating a date by supplying information like the day of the month, month, year, hour, minutes and so on):
LOCAL-TIME> (encode-timestamp 0 0 30 10 13 5 2009)
#2009-05-13T10:30:00.000000+02:00
But then, what is the make-timestamp macro supposed to do?
Make-timestamp is used by several of the encoding functions, including encode-timestamp. I would regard it as rather lowlevel, but it might be of interest to a user of the library.
Encode-timestamp seems to be just the function you want.
One cell in my notebook executes for a long time, while the other CPU's in the machine are idle. Is it possible to run other cells in parallel?
Yes. Here is the documentation for ipyparallel (formerly IPython parallel) that will show you how to spawn multiple IPython kernel. After you are free to distribute the work across cores, and you can prefix cells with %%px0 %%px1... %%px999 (once set up) to execute a cell on a specific engine, which in practice correspond to parallel execution of cell. I would suggest having a look at Dask as well.
This does not answer your question directly but I think it would help a lot of people that are having the same problem. You can move variables between notebooks easily and then continue running the functions on another notebook then move the result back to the main notebook.
For example:
Notebook 1:
%store X
%store y
Notebook 2:
%store -r X
%store -r y
new_df = ...
%store new_df
Notebook 1:
%store -r new_df
I got very hopeful with Matt answer of the ipp module, but the truth is that the ipp does not run two cells in pararell. Ipp lets you work in two or more engines but not simultaneously.
Take this example, you run the first code and 1 second later you run the second code, each code in different cells:
%%px --targets 0
import time
for i in range(0,6):
time.sleep(1)
print(time.ctime())
Gives:
Thu Jun 16 10:30:53 2022
Thu Jun 16 10:30:54 2022
Thu Jun 16 10:30:55 2022
Thu Jun 16 10:30:56 2022
Thu Jun 16 10:30:57 2022
And
%%px --targets 1
import time
for i in range(0,6):
time.sleep(1)
print(time.ctime())
Gives:
Thu Jun 16 10:30:59 2022
Thu Jun 16 10:31:00 2022
Thu Jun 16 10:31:01 2022
Thu Jun 16 10:31:02 2022
Thu Jun 16 10:31:03 2022
So in conclusion, the cells are not running at the same time, they are just running in different engines. The second cell waits the 1st one to finish, and once it finishes the second cell starts.
Hope there is simple solution for this -.-
PD: Here is the image
Code in jupyter notebook
I want to introduce a library that has this feature, this does not require multiple notebooks tricks etc...
Parsl is the Productive parallel programming in Python
Configuration
import parsl
from parsl.app.app import python_app, bash_app
parsl.load()
As an example, I edited this snippet from parsl/parsl-tutorial.
# App that generates a random number after a delay
#python_app
def generate(limit,delay):
from random import randint
import time
time.sleep(delay)
return randint(1,limit)
# Generate 5 random numbers between 1 and 10
import time
st = time.time()
rand_nums = []
for i in range(5):
rand_nums.append(generate(10, 1))
# Wait for all apps to finish and collect the results
outputs = [i.result() for i in rand_nums]
et = time.time()
print(f"Execution time: {et - st:.2f}")
# Print results
print(outputs)
Result:
Execution time: 3.00
[1, 6, 4, 8, 3]
Note that the time it takes for the code to execute is 3s not 5s.
So what you can do is call the function (in this example is generate(...)) in a cell. This generate(...) will return a object. Then if you call the .result() on the object it will either:
Halt the program if it's waiting for the result.
Return the result if it's completed.
Therefore, as long as you call the .result() at the last few cells, the subroutine will be running in the background. And you can be sure at the last few cells the result can be obtained.
Regarding data dependencies, parsl is very smart, it will wait for the data that is dependent, even if it's decorated with the #python_app.
When someone wanted to leave a long-running calculation running in the background while running other things in the notebook, we were able to hack a solution using Python's multiprocesing. That allowed leaving a long-running cell running while running another cell in the classic notebook interface as well as Jupyterlab, see here.
I have a class that meets regularly on Mondays/Wednesdays from 12:00-12:50 and on Thursdays from 16:00-16:50. I'd like to keep all the notes together, because it's all for the same class, but I don't know how I would set up this recurring event.
There is an easy-enough way to define arbitrary date ranges, but nothing I can see for time ranges that would also show up correctly in the agenda. They're also in different rooms, so if it's possible I'd like to add something denoting the room number. If it were just dates (at the same time as well), I would go ahead and just
(and (org-class 2013 1 21 2013 5 9 1) (org-class 2013 1 21 2013 5 9 3))
and it would be fine. Is there a(n org-mode) function to describe times? Is there a way to add notes (like the room number)? I'm not quite aware of how this whole section of org-mode works (although my guess would be that if the sexp evaluates to non-nil, then the event is active).
So, in summary, I'd like a way to be able to assign arbitrary collections of date-time-range objects to org-mode events, ideally with the notes I was talking about.
EDIT
As a secondary (but obviously related) question, what's the sexp way of specifying time?
You can use multiple time-stamps within the same entry.
For example:
C-c.mon 12:00-12:50RET will produce <2013-01-28 Mon 12:00-12:50>. You can then edit it to add a repeater +1w. The final time-stamp looks like <2013-01-28 Mon 12:00-12:50 +1w>.
I don't know how you can manage the class room though.
Wouldn't creating subtrees for the two rooms and then a third subtree for the notes themselves?
For example (see Org-FAQ for details on putting time in the same line. I think adding the time within the <> will add it to the time, but not entirely sure, otherwise add it afterwards and it should still include it within the information.
* Math Class
:PROPERTIES:
:CATEGORY: Math Class
:END:
** Room #1
<%%(and (org-class 2013 1 21 2013 5 9 1) (org-class 2013 1 21 2013 5 9 3)) 12:00-- 12:50>
** Room #2
<%%(org-class 2013 1 21 2013 5 9 4) 16:00--16:50>
** Notes