X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 20 Jan 2010 04:12 PM by  anon
ENVI_CONVERT_FILE_MAP_PROJECTION problem
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
20 Jan 2010 04:12 PM
    Hi there, I'm having a problem processing MODIS images in ENVI. I'm trying to write a script that will mask a MODIS file, then change the projection from the sinusoidal MODIS projection to lat/long. I can't get ENVI_CONVERT_FILE_MAP_PROJECTION to work, though. I keep getting a vague error: 'reg_warp_doit: An error has occurred during processing Error: "Array dimensions must be greater than 0." The result may be invalid' I've copied my code below. I'm at my wits' end, so would be very appreciative of any help! (Apologies for the cross-posting - I'm not sure which forum is most appropriate for this question) Cheers, Kaighin ----------------------- ENVI, /RESTORE_BASE_SAVE_FILES ENVI_BATCH_INIT, LOG_FILE = 'C:\Documents and Settings\Kaighin\Desktop\Bushfire\Code\envi\test_batch_log.txt' ENVI_OPEN_DATA_FILE, 'C:\Documents and Settings\Kaighin\Desktop\Bushfire\Veg\MOD13Q1.A2009017.h29v12.005.2009036151113.hdf', /MODIS, R_FID = fid IF (fid[0] EQ -1) THEN BEGIN   ENVI_BATCH_EXIT   RETURN ENDIF ; restore ROI file ENVI_RESTORE_ROIS, 'C:\Documents and Settings\Kaighin\Desktop\Bushfire\Code\envi\Vic.roi' roi_ids = ENVI_GET_ROI_IDS() IF (roi_ids[0] EQ -1) THEN RETURN out_name2 = 'C:\Documents and Settings\Kaighin\Desktop\Bushfire\Code\envi\testimg.hdf' class_values = LINDGEN(N_ELEMENTS(roi_ids))+1 ; ; Call the doit ; ENVI_DOIT, 'ENVI_ROI_TO_IMAGE_DOIT', $ FID=fid, ROI_IDS=roi_ids, OUT_NAME=out_name2, $ CLASS_VALUES=class_values, R_FID = fid2 ENVI_FILE_QUERY, fid[0], NS = ns, NL = nl, NB = nb ; Set the keyword parameters m_dims = [-1L, 0, ns - 1, 0, nl - 1] pos = LINDGEN(nb) m_pos = [0] out_name3='C:\Documents and Settings\Kaighin\Desktop\Bushfire\Code\envi\testimg_masked.hdf' ; Call the 'doit' ENVI_MASK_APPLY_DOIT, fid = fid[0], POS = pos, DIMS = m_dims, $    M_FID = fid2, M_POS = m_pos, VALUE = 0, OUT_NAME = out_name3, $    IN_MEMORY = 0, R_FID = masked_fid ENVI_FILE_QUERY, masked_fid, DIMS = masked_dims, NS = masked_ns, NL = masked_nl, NB = masked_nb output_proj = ENVI_PROJ_CREATE(TYPE = 1) masked_pos = LINDGEN(masked_nb) out_name4 = 'C:\Documents and Settings\Kaighin\Desktop\Bushfire\Code\envi\testimg_proj.hdf' ENVI_CONVERT_FILE_MAP_PROJECTION, DIMS = masked_dims, FID = masked_fid, $   O_PROJ = output_proj, OUT_NAME = out_name4, POS = masked_pos, RESAMPLING = 0, $   WARP_METHOD = 2, R_FID = proj_fid ENVI_BATCH_EXIT END

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    21 Jan 2010 02:44 PM
    What version of ENVI are you using?  I have a feeling that this error is related to the pixel size conversion between sinusoidal with pixels in meters to geographic with pixels in degrees.  If you use the ENVI GUI to do the conversion to geographic, when you change the projection to geographic, what is the pixel size estimate?  And if you run this, does it convert without error?  If so, you might try setting the output pixel size in your code (O_PIXEL_SIZE) to the same as that used in the GUI.
    You are not authorized to post a reply.