I am looking for a sample batch script I can use to execute m3wndw and bcwndw. I am not sure what is the structure to use to provide the input file, output file and the grid domain bounds. I can run the program using the command prompt, but it’s tedious for regridding files for an entire year.
Copy down what all the responses were for m3wndw (for example), and then use them to construct
an command-file to use with it: Something like:
set cmd = /tmp/m3wndw.$$
echo "Yes continue with program " >& $cmd
echo "INFILE" >> $cmd
echo "$SDATE" >> $cmd
echo "$STIME" >> $cmd
echo " " >> $cmd # default RUNLEN
...etc ...
m3wndw < $cmd
Can you please explain what the first line mean? specifically the double dollar sign?
This is mu run script
#!/bin/csh -f
#This script window out the southwest US data from 12US1 domain
#12US1 domain : 459 col by 299 row and origin of -2556 and -1728
#ADEQ_12PHX : 154 col by 110 row and origin of -2256 and -996
setenv infile /CAMData/CMAQ/2016_12US1/emis/cmaq_ready/emis_mole_all_20160603_12US1_nobeis_2016ff_16j.ncf
setenv outfile /CAMData/CMAQ/2016_12US1/emis/cmaq_ready/emis_mole_all_20160603_ADEQ_12PHX_nobeis_2016ff_16j.ncf
set cmd = /CAMData/CMAQ/Libraries/ioapi-3.2/ioapi/lib/m3wndw.$$
echo “$infile” >&$cmd
echo “$outfile” >>$cmd
echo “2016155” >>$cmd
echo “000000” >>$cmd
echo “240000” >>$cmd
echo “ADEQ_12PHX” >>$cmd
echo “26” >>$cmd
echo “179” >>$cmd
echo “62” >>$cmd
echo “171” >>$cmd
/CAMData/CMAQ/Libraries/ioapi-3.2/ioapi/lib/m3wndw < $cmd
When I run it I get:
/CAMData/CMAQ/Libraries/ioapi-3.2/ioapi/lib/m3wndw.17550: Permission denied.
Normally that should be /tmp/m3wndw.$$ (or similarly).
This is the standard UNIX/Linux way of safely creating a scratch-file: $$ is the built-in shell-variable for the current-shell process-ID (which is unique on the entire system you’re running on), so that (short of malice), no other file on the system should have that name, and so no-one should accidentally corrupt or clobber that scratch-file.
FWIW, lots of people who should know better fail to do this and create brittle systems as a result. Cisco’s anyconnect VPN-client is an example of such a failure. So you should not feel bad about not having been taught this…
Hy,
I’m not sure how to run m3wndw. I’ve tried to follow the guidelines but my terminal showing command not found. Please see the attached file.
Can you please let me know how to use this tool? I’m trying to use m3wndw to window the emissions files to the grid of a smaller domain.
Thanks
Rasel
Can you try running your command as ./m3wndw infile outfile ?
It worked. Quick question. How can I set the location GRIDDESC file? I’m not sure about LOCOL, HICOL, LOROW, and HIROW values for my datasets. I need XORIG, YORIG, NCOLS and NROWS to be specific as like in my GRIDDESC file.
Please see the attached file.
Thanks
Rasel
I do not think you need GIRDDESC file. You can just enter your LOCOL, HICOL, LOROW, and HIROW values. in the command prompt.
I want my emission grid (442X265) to match exactly as my modeling domain (200X120).
Then, you are going to have to provide more information. Do the emission files and modeling domain have the same resolution? What’s the emissions XORIG, YORIG, NCOLS and NROWS vs model domain XORIG, YORIG, NCOLS and NROWS ?
You need to do a bit of simple arithmetic to find the lo/hi col/row values.
Let the large grid GRID1
(from which you are windowing) have grid parameters XORIG1, YORIG1, XCELL1, YCELL1,NCOLS1,NROWS1
etc.
Let the small grid GRID2
(to which you are windowing) have grid parameters XORIG2, YORIG2, XCELL2, YCELL2,NCOLS2,NROWS2
etc.
For windowing, XCELL1
and XCELL2
, and YCELL1
and YCELL2
must match, as well as having correct grid alignment (more about alignment later).
Then let
DX = (XORIG2 - XORIG1)/XCELL1
DY = (YORIG2 - YORIG1)/YCELL1
For grid alignment, DX
and DY
must be positive integers.
Then
LOCOL = 1 + NINT(DX)
LOROW = 1 + NINT( DY)
HICOL = LOCOL + NCOLS2 - 1
HIROW = LOROW + NROWS - 1
and “windowability” also requires that all of these must be less than the dimensions of GRID1
.
Note that “match” means “up to reasonable round-off error” (and “Z
is a positive integer” means that DBLE(INT(Z))
matches Z
). If you’re programming this, a good test for “does not match” is in the DBLERR
function found throughout the I/O API and M3Tools:
DBLERR(P,Q) = ( (P-Q)**2 .GT. 1.0D-10*( P*P+Q*Q+1.0D-5 ) )
Note also that the approach advocated by some:
Write P and Q to ASCII strings using 6 significant digits and compare the resulting strings
(and assuming that Fortran rounds correctly as it does so – not a valid assumption, since the Fortran Standard explicitly disavows this, calling it a “quality of implementation” issue) does not work; consider the examples
P = 1.234565000000001d0
Q = 1.234564999999999d0
which round differently to 6 digits, but are within any reasonable round-off error tolerance…
Hello,
I’m trying to use m3wnd tool for windowing emission data. Here’s my script:
After I run the script, it gives me the output for just one day (20200521). It was supposed to give 2 days’ output in 2 different files. Can you please let me know where did I do wrong?
See the log output file and my script
m4.sh.txt (580 Bytes)
log.txt (6.9 KB)
Regards,
Rasel
it worked. thank you so much.