# Extract daily file from monthly MCIP's output

**URL:** <https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778>\
**Category:** MCIP\
**Created:** [December 14, 2022, 10:17pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778 "2022-12-14T22:17:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaoyu](https://avatars.discourse-cdn.com/v4/letter/x/b9e5f3/32.png) [@xiaoyu](https://forum.cmascenter.org/u/xiaoyu)\
**Post date:** [December 14, 2022, 10:17pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778/1 "2022-12-14T22:17:13Z")

</div>

Hello,

Is there a m3tool could extract daily file from monthly MCIP’s output?

TIA, Xiao

---

<div class="post-metadata">

**Author:** ![xiaoyu](https://avatars.discourse-cdn.com/v4/letter/x/b9e5f3/32.png) [@xiaoyu](https://forum.cmascenter.org/u/xiaoyu)\
**Post date:** [December 14, 2022, 10:22pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778/2 "2022-12-14T22:22:50Z")

</div>

m3xtract will do the job right?

---

<div class="post-metadata">

**Author:** ![hogrefe.christian](https://avatars.discourse-cdn.com/v4/letter/h/74df32/32.png) [@hogrefe.christian](https://forum.cmascenter.org/u/hogrefe.christian)\
**Post date:** [December 14, 2022, 10:24pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778/3 "2022-12-14T22:24:57Z")

</div>

Yes, that’s the tool I would use if I wanted to extract selected time periods, variables, and/or layers from a file.

---

<div class="post-metadata">

**Author:** ![xiaoyu](https://avatars.discourse-cdn.com/v4/letter/x/b9e5f3/32.png) [@xiaoyu](https://forum.cmascenter.org/u/xiaoyu)\
**Post date:** [December 15, 2022, 1:47pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778/4 "2022-12-15T13:47:48Z")

</div>

Thanks for your input!

---

<div class="post-metadata">

**Author:** ![xiaoyu](https://avatars.discourse-cdn.com/v4/letter/x/b9e5f3/32.png) [@xiaoyu](https://forum.cmascenter.org/u/xiaoyu)\
**Post date:** [December 15, 2022, 4:23pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778/5 "2022-12-15T16:23:09Z")

</div>

May you give a look of my code? For some reason, the program isn’t taking my environmental variables. I tried both Julian and calendar date.

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/3/36075a4b3a9306489b0942f275e7db1c4f19dcd4.png)

---

<div class="post-metadata">

**Author:** ![cgnolte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.cmascenter.org/cgnolte/32/53_2.png) [@cgnolte](https://forum.cmascenter.org/u/cgnolte)\
**Post date:** [December 15, 2022, 4:38pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778/6 "2022-12-15T16:38:18Z")

</div>

What is the error message you are getting?  
You might want to give the full path to OFILE, or `cd` within the script to a particular directory.

---

<div class="post-metadata">

**Author:** ![hogrefe.christian](https://avatars.discourse-cdn.com/v4/letter/h/74df32/32.png) [@hogrefe.christian](https://forum.cmascenter.org/u/hogrefe.christian)\
**Post date:** [December 15, 2022, 4:42pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778/7 "2022-12-15T16:42:59Z")

</div>

In addition, it’s also a good idea to follow this advice in the I/O API documentation before developing scripts:

> With the exception of programs designed specifically for manipulating dates and times in scripts (greg2jul, jul2greg, juldiff, julshift, timeshift), these programs are designed for easy interactive use. They begin by displaying a “splash screen” displaying the name, usage, and version for the program, and then prompt the user for the specifications for the program-run. Most of these prompts have default values computed from the metadata in input-file headers; defaults may be accepted by hitting the `RETURN` key. To develop scripts for them, it is generally best to run them interactively once, recording all the responses you give to the prompts, and then use that information to develop a command-file which redirect into the program within the script.

---

<div class="post-metadata">

**Author:** ![xiaoyu](https://avatars.discourse-cdn.com/v4/letter/x/b9e5f3/32.png) [@xiaoyu](https://forum.cmascenter.org/u/xiaoyu)\
**Post date:** [December 15, 2022, 5:56pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778/8 "2022-12-15T17:56:13Z")

</div>

Thanks for your reply. I used the wrong file (“GRIDBDY2D\_201905\_txs\_4km\_hvc.nc” rather than “METCRO2D\_201905\_txs\_4km\_hvc\_ext.nc”), so my date and time wasn’t read in.

---

<div class="post-metadata">

**Author:** ![xiaoyu](https://avatars.discourse-cdn.com/v4/letter/x/b9e5f3/32.png) [@xiaoyu](https://forum.cmascenter.org/u/xiaoyu)\
**Post date:** [December 15, 2022, 5:57pm UTC](https://forum.cmascenter.org/t/extract-daily-file-from-monthly-mcips-output/3778/9 "2022-12-15T17:57:36Z")

</div>

Thank you for the guidance! I will apply it to my future work.
