how to add time steps to the beginning and end of a time series with cdo/nco? - merge

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

Related

How to use OR condition in LibreOffice?

I am trying to use the formula below to set conditions in LibreOffice but I keep getting an error. What am I doing wrong with the statement below:
=IF(G2<=2,'negative',IF(OR(G2>2 & G2<=3,'neutral',IF(OR(G2>=4,'positive))))))
Thanks
It seems, that in your formula is missing the last ':
'positive))))))
should be 'positive'))))))
Also the
&
is string-concatenation in LibreOffice, so you need here the equivalent to OR() and that is AND().
But you can simplify your formula to
=IF(G2<=2,'negative',IF(AND(G2>2,G2<=3),'neutral','positive'))
The first test is if the number is lower than 2 (negative),
the second test is if the number is between 2 and 3 (neutral)
and then there is no further test needed as it is the only remainig possiblity.
For a different locale, a slightly shorter, and I'd say simpler, version that also avoids the need for OR/AND:
=IF(G2<=2,"negative",IF(G2<=3,"neutral","positive"))
Once <=2 first test is handled (either but outputting negative or by proceeding to the 'result if FALSE') there is no longer the possibility of 2 or less, so the AND is not necessary.
The above though does fill a gap left by OP between 3 and 4.

How to increment a text field by 1 in selenium?

I have a question about how to increment field value each time selenium test is run?.
I have read the answers but am unclear at what point should the echo command should be placed. I have a repeating test where I am entering the number 1 into a text field. And every time the test runs I would like that to increment by one.
I'm also assuming I can put the two "store" commands anywhere near the top of the test.
Also if I go with the javascript{storedVars.i++;} example, would I put the variable i in the text field instead of the number 1?
I'm a relative newb so feel free to talk to me like a 4 year old.
Thanks
I found my answer! Don't know all the etiquette here yet but I need to give props to this website that helped me figure it out.
http://traceyqa.blogspot.com/2011/02/incremental-variables-in-selenium_23.html

Minizinc - counting number of solution and print first 50 only for checking

Other than generating an output file then using wc -l output.txt and -1 divide by 2 and head -50 the output.txt, is there any easy way to auto count no of solution inside minizinc and print the first 50 solution?
My program run for 12 hour in one scenario and the other one expected to run 2 days!
Also, any way in batch mode (not ide) to generate resources usage other than using time minizinc ...
Thanks for advice
The command line program "minizinc" as well as most FlatZinc solvers supports the parameter "-n " which is the number of solutions to show. The MiniZinc IDE has the option "Stop after this many solutions:".
Note that this is relevant for satisfaction problems. For optimization problems, however, there is no consensus how different solvers handle "-n".

Using filename to assign variables in matlab

This may be a simple question, but a matlab noob here and I can't find something similar in searching.
I have a bunch of filenames like this that I'm looping through: goes12.2009.242.201515.BAND_01.nc
I want to assign the 8-11th character (ie 2009) as the year, the 13-15th (ie 242) as the day, the 17-18th (ie 20) as the hour, the 19-20th (ie 15) as the min and the 21-22 (ie 15) as the second.
I believe this can be done somewhat simply?
Thanks so much in advance for any insight!!
sure, it can be done
u just need to transform the string (character) into number
filename=goes12.2009.242.201515.BAND_01.nc;
yr=str2double(filename(8:11));
doy=str2double(filename(13:15));
hr=str2double(filename(17:18));
min=str2double(filename(19:20));
sec=str2double(filename(21:22));
and good luck with nc data

Conditionally positioning fields in Crystal Reports 10

I've done a lot of googling and haven't been able to find a solution to my issue. I have a report that displays the number of calls for different help desk categories/sub categories. It has the category name and 4 other columns. When a child category is displayed it indents the whole line, but I want the last 4 columns to stay aligned under their respective labels. I'm using Crystal Reports 10 and don't see any where to enter a formula to conditionally position the fields for the last 4 columns. Even if I did see a place to enter a formula I'm not sure how I would determine where to place the fields because the X position for the field doesn't actually change when the line is indented. The only thing I could think of to handle this is to figure out how many tabs each line is indented and then subtract those from the X position, but I'm not sure how I could tell how far a line has been indented. Any suggestions would be greatly appreciated. Thank you
The SAP User Guide actually has quite a bit of information on this. You can set indentation values and you can do a lot of conditional formatting. Check the guide for CR 2011 out here and Section 11 is mostly about how to format reports. 11.3.10.9 talks about indentation, but I suggest you browse the whole section 11. And even though it's for CR 2011, it doesn't vary much for other versions.
Hope that helps,
Chris