Skip to content

Commit 3aef7fa

Browse files
committed
feat: bundle mmif runtime libraries and fix output file paths
1 parent 287ea8d commit 3aef7fa

1 file changed

Lines changed: 72 additions & 5 deletions

File tree

frontend/src/zip-file/zip-file.service.ts

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,60 @@ export class ZipFileService {
138138
return { subFolder: subFolder };
139139
}
140140

141+
/**
142+
* Runtime libraries required by mmif.exe, stored in object storage under
143+
* setup_files/ alongside the executable. They are appended to the
144+
* download.bat URL list so the user's machine fetches them into the same
145+
* folder as mmif.exe before start.bat runs it.
146+
*/
147+
private static readonly MMIF_DLLS = [
148+
'libaws-c-auth.dll',
149+
'libaws-c-cal.dll',
150+
'libaws-c-common.dll',
151+
'libaws-c-compression.dll',
152+
'libaws-c-event-stream.dll',
153+
'libaws-c-http.dll',
154+
'libaws-c-io.dll',
155+
'libaws-c-mqtt.dll',
156+
'libaws-c-s3.dll',
157+
'libaws-c-sdkutils.dll',
158+
'libaws-checksums.dll',
159+
'libaws-cpp-sdk-core.dll',
160+
'libaws-cpp-sdk-s3.dll',
161+
'libaws-crt-cpp.dll',
162+
'libbrotlicommon.dll',
163+
'libbrotlidec.dll',
164+
'libbz2-1.dll',
165+
'libcrypto-3-x64.dll',
166+
'libcurl-4.dll',
167+
'libgcc_s_seh-1.dll',
168+
'libgfortran-5.dll',
169+
'libhdf5-320.dll',
170+
'libhdf5_hl-320.dll',
171+
'libiconv-2.dll',
172+
'libidn2-0.dll',
173+
'libintl-8.dll',
174+
'liblzma-5.dll',
175+
'libnetcdf.dll',
176+
'libnetcdff-7.dll',
177+
'libnghttp2-14.dll',
178+
'libnghttp3-9.dll',
179+
'libngtcp2-16.dll',
180+
'libngtcp2_crypto_ossl-0.dll',
181+
'libpsl-5.dll',
182+
'libquadmath-0.dll',
183+
'libssh2-1.dll',
184+
'libssl-3-x64.dll',
185+
'libstdc++-6.dll',
186+
'libsz-2.dll',
187+
'libunistring-5.dll',
188+
'libwinpthread-1.dll',
189+
'libxml2-16.dll',
190+
'libzip.dll',
191+
'libzstd.dll',
192+
'zlib1.dll',
193+
];
194+
141195
async beginZippingAermodFromCoords(request: {
142196
latitude: number;
143197
longitude: number;
@@ -217,7 +271,18 @@ export class ZipFileService {
217271
}
218272
}
219273

220-
console.log(`Generated ${dataUrls.length} download URLs for AERMOD`);
274+
// mmif.exe's runtime libraries. curl -O saves to the current directory,
275+
// which is the unzipped folder containing mmif.exe, and start.bat runs
276+
// download.bat before mmif, so they are in place when it executes.
277+
const dataFileCount = dataUrls.length;
278+
for (const dll of ZipFileService.MMIF_DLLS) {
279+
dataUrls.push(`${baseUrl}/setup_files/${dll}`);
280+
}
281+
282+
console.log(
283+
`Generated ${dataUrls.length} download URLs for AERMOD ` +
284+
`(${dataFileCount} data files, ${ZipFileService.MMIF_DLLS.length} runtime libraries)`
285+
);
221286

222287
return this.beginZippingAermod(tileDownloadInfo, dataUrls, aermodTileData);
223288
}
@@ -602,8 +667,7 @@ call download.bat
602667
603668
mmif
604669
md output
605-
ren "x???y???x???y???.?????????????????????.output.m3d" "/////////////////wrf.?????????????????????.output.m3d"
606-
move wrf.* output\
670+
move aermod.* output\\
607671
`;
608672
}
609673

@@ -675,8 +739,11 @@ aer_min_obuk 1.0 !default 1
675739
FSL_INTERVAL 12 !default 12
676740
${latLonLine}
677741
# See the Users Guide for the OUTPUT keyword details
678-
OUTPUT AERMOD SFC "output\aermod.sfc"
679-
OUTPUT AERMOD PFL "output\aermod.pfl"
742+
# NOTE: keep these paths free of backslashes, or escape them as \\ - a single
743+
# backslash before a letter is consumed as a JavaScript escape sequence, which
744+
# previously turned "output\aermod.sfc" into "outputaermod.sfc".
745+
OUTPUT AERMOD SFC "aermod.sfc"
746+
OUTPUT AERMOD PFL "aermod.pfl"
680747
${inputString}
681748
`;
682749
return mmifContent;

0 commit comments

Comments
 (0)