# CMAQV5.3 ISAM Region not found

**URL:** <https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418>\
**Category:** CMAQ\
**Created:** [April 7, 2020, 7:45pm UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418 "2020-04-07T19:45:21Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![YukuiLi](https://avatars.discourse-cdn.com/v4/letter/y/6a8cbe/32.png) [@YukuiLi](https://forum.cmascenter.org/u/YukuiLi)\
**Post date:** [April 27, 2020, 5:32pm UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/21 "2020-04-27T17:32:47Z")

</div>

Thank you @cjcoats @hogrefe.christian @barronh. My problem fixed.

---

<div class="post-metadata">

**Author:** ![lihongli](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lihongli](https://forum.cmascenter.org/u/lihongli)\
**Post date:** [September 22, 2020, 6:34am UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/22 "2020-09-22T06:34:06Z")

</div>

Hello, I want to make a GRIDMASK Region file. What program did you use to do it?

---

<div class="post-metadata">

**Author:** ![lihongli](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lihongli](https://forum.cmascenter.org/u/lihongli)\
**Post date:** [September 22, 2020, 8:44am UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/23 "2020-09-22T08:44:06Z")

</div>

Hello, I read the answer above and use the m3mask file to generate the region file. But now I am not very clear about the data format preparation of MASKDATA. The file I prepared is attached below. The LLFILE file is the GRIDCRO2D file used. It will report an error when running, can you help me see what the reason is, thank you ![maskdata.csv|attachment](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/1X/aeca6e81b0619ec7c787cd2170b693f6898102e2.csv) (664.8 KB)[maskdata.csv](https://forum.cmascenter.org/uploads/short-url/oWgMPVIqYq2JHKbytE9c39RRKRc.csv) (664.8 KB)

---

<div class="post-metadata">

**Author:** ![YukuiLi](https://avatars.discourse-cdn.com/v4/letter/y/6a8cbe/32.png) [@YukuiLi](https://forum.cmascenter.org/u/YukuiLi)\
**Post date:** [September 24, 2020, 4:40am UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/24 "2020-09-24T04:40:39Z")

</div>

Hello Lihong, you can only create mask file with single variable with m3mask. If you want to creat multiple variables in a mask file, you need to create the variable seperately in different mask files. Then you can use m3merge to merge those mask files into one mask file. Also be careful about the variable type. The variable created using m3mask is interger but not float, which can make trouble when you run CMAQ ISAM. You would need to convert variable type. The method about convert variable type you can also find in in the history questions I posted and the answer is from hogrefe.christian.

---

<div class="post-metadata">

**Author:** ![YukuiLi](https://avatars.discourse-cdn.com/v4/letter/y/6a8cbe/32.png) [@YukuiLi](https://forum.cmascenter.org/u/YukuiLi)\
**Post date:** [September 24, 2020, 4:42am UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/25 "2020-09-24T04:42:33Z")

</div>

When you use m3merge to merge mutiple mask files, you can rename all the variables. You can find how to use m3merge in ioapi m3tools website.

---

<div class="post-metadata">

**Author:** ![lihongli](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lihongli](https://forum.cmascenter.org/u/lihongli)\
**Post date:** [September 28, 2020, 1:09pm UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/26 "2020-09-28T13:09:59Z")

</div>

Thank you very much! ! According to your reply and carefully reading the above discussion, I successfully generated.

---

<div class="post-metadata">

**Author:** ![rpedruzzi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.cmascenter.org/rpedruzzi/32/142_2.png) [@rpedruzzi](https://forum.cmascenter.org/u/rpedruzzi)\
**Post date:** [September 29, 2020, 1:16pm UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/27 "2020-09-29T13:16:06Z")

</div>

Another way to generate the ISAM regions maks file is to use the Spatial Allocator using the script which was developed to generate the oceanfile (e.g. alloc\_surf\_zone\_to\_oceanfile.csh)

You just need your GRIDDESC, a shapefile with the area you want to map and the Spatial allocator.

Here is an example:

```
#! /bin/csh -f
# *******************Allocate Shapefiles Run Script**************************
# Allocates a polygon shapefile's data to an I/O API gridded file
# Oct. 2006, LR 
# Dec. 2007, LR -- projection specification changes
# *****************************************************************************

setenv DEBUG_OUTPUT Y

# Set executable
setenv EXE "$SA_HOME/bin/32bits/allocator.exe"

# Set Input Directory
setenv DATADIR $SA_HOME/data
setenv OUTPUT $SA_HOME/output

# Select method of spatial analysis

setenv MIMS_PROCESSING ALLOCATE

setenv TIME time

#set "data" shapefile parameters
setenv GRIDDESC $DATADIR/GRIDDESC.txt

**These information you can get from in your shapefile projection**
#set parameters for file being allocated
setenv INPUT_FILE_NAME $DATADIR/surfzone/surfzone_NC_SC
setenv INPUT_FILE_TYPE ShapeFile
setenv INPUT_FILE_MAP_PRJN "+proj=lcc,+lat_1=33,+lat_2=45,+lat_0=40,+lon_0=-97"
setenv INPUT_FILE_ELLIPSOID "+a=6370000.0,+b=6370000.0"
setenv ALLOCATE_ATTRS TYPE
setenv ALLOC_MODE_FILE ALL_AREAPERCENT

#Set this to SURF_ZONE to create the variables needed for CMAQ OCEANfile
setenv ALLOC_ATTR_TYPE **NAME_OF_THE_ATTRIBUTE_IN_THE_SHAPEFILE**

**These information you can get from your GRIDDESC**
# Set name and path of resulting shapefile
setenv OUTPUT_FILE_TYPE IoapiFile
setenv OUTPUT_GRID_NAME NC4KM
setenv OUTPUT_FILE_MAP_PRJN "+proj=lcc,+lat_1=33,+lat_2=45,+lat_0=40,+lon_0=-97"
setenv OUTPUT_FILE_ELLIPSOID "+a=6370000.0,+b=6370000.0"
setenv OUTPUT_FILE_NAME /OUTPUT/MAKS_ISAM_${OUTPUT_GRID_NAME}.ncf

#echo "Allocating MAKS data to CMAQ ISAM"
$TIME $EXE

```

This script can generates one are at a time, so if you have nine areas, you need to run it 9 times (remember to change the attribute name for each area).  
After it, you can merge them with m3merge, for example.  
Additionally, check the number of variables in the global attributes of the NetCDF file just to make sure it has the correct number of variables.

Regards

---

<div class="post-metadata">

**Author:** ![Catalyst2682](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@Catalyst2682](https://forum.cmascenter.org/u/Catalyst2682)\
**Post date:** [December 31, 2020, 11:27am UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/28 "2020-12-31T11:27:29Z")

</div>

Dear @rpedruzzi @sergey

I have 10 regions and I have generated a region file for each region. I want to merge them all into a single region file for ISAM as suggested by @rpedruzzi. Can you please share with me a sample of m3merge script I can use for this purpose?

Thanks in anticipation.

Catalyst

---

<div class="post-metadata">

**Author:** ![rpedruzzi](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.cmascenter.org/rpedruzzi/32/142_2.png) [@rpedruzzi](https://forum.cmascenter.org/u/rpedruzzi)\
**Post date:** [January 3, 2021, 10:54pm UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/29 "2021-01-03T22:54:23Z")

</div>

Dear @Catalyst2682,

I do not have an script right away to send you, but m3merge is easy to use. Take a look at ioapi website

> **[Program M3MERGE](https://www.cmascenter.org/ioapi/documentation/all_versions/html/M3MERGE.html)**

You just need to export the path to the ISAM’s region files and use the m3merge.  
Regards  
Rizzieri

---

<div class="post-metadata">

**Author:** ![Catalyst2682](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@Catalyst2682](https://forum.cmascenter.org/u/Catalyst2682)\
**Post date:** [January 4, 2021, 8:15am UTC](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418/30 "2021-01-04T08:15:49Z")

</div>

Dear @rpedruzzi,

I have gotten it done.

Thanks and warm regards,

Catalyst

[Previous page](https://forum.cmascenter.org/t/cmaqv5-3-isam-region-not-found/1418.md?page=1)
