paudetseis / PlateFlex

Estimating effective elastic thickness of the lithosphere
https://paudetseis.github.io/PlateFlex/
MIT License
32 stars 18 forks source link

problem reading file #9

Open maralves opened 2 years ago

maralves commented 2 years ago

good afternoon everyone!

Guys, next: I managed to install everything just right, but I'm having trouble reading my generated file, I opened the "Topo_NA" file of the examples left, and compared it with mine, and then the following question came to me: where was it extracted from , or how to calculate that part of the top that you have in the example file?

ETOPO1_NA.grd 0 6805.75136468 0 6819.00580269 -8302.53808594 3603.22363281 20.0169157785 19.9970844654 341 342

0 6819.00580269 -31.3442268372

the only difference between my file and the example is: it doesn't have the top, I saw that it has nx,ny and some information passed in the example file, but where does that come from? if anyone can give me a tip i would appreciate it. thanks!

teste

paudetseis commented 2 years ago

The first call to pd.read_csv is to load the metadata, or header information for the gridded dataset. In the example data, the header information is contained on the first line of the data file. You can generate it using GMT (version <6) with the example in the documentation: https://paudetseis.github.io/PlateFlex/getting_started.html#making-gridded-data

Otherwise, as long as you supply these parameters in some way (e.g., hardcode the values for xmin, xmax, dx; or read them from a different file), the code will not see the difference.

maralves commented 2 years ago

The first call to pd.read_csv is to load the metadata, or header information for the gridded dataset. In the example data, the header information is contained on the first line of the data file. You can generate it using GMT (version <6) with the example in the documentation: https://paudetseis.github.io/PlateFlex/getting_started.html#making-gridded-data

Otherwise, as long as you supply these parameters in some way (e.g., hardcode the values for xmin, xmax, dx; or read them from a different file), the code will not see the difference. teste1

first good afternoon! I would like to thank you for getting back so quickly! and apologize for my delay in responding. Next: I'm a programmer, I don't understand calculus in your area, so forgive my lack of knowledge about the tools you are quoting, I took a while to respond because I'm trying to help a researcher to use this tool that you kindly made it available, but we are having problems, I installed gmt in the newest version, and it didn't read the file, I installed in the version below 6 as you mentioned and it didn't catch either, and I'm feeling lost! I really appreciate it if you can give me a guide with the prints and the file that I'm going to make available here, if you can give me a hint of what I'm doing wrong it will be of great value. And first of all, thanks again!

Below is a link to the file to be converted:

https://drive.google.com/drive/folders/12El01nKwFcyG1lLCX_hWjn3aYlkxsgv6?usp=sharing

attached the error that is happening when trying to convert the data.

something else in the example you put there in the documentation has some configuration settings. How to do this within the program. Thanks for all the help have a great weekend

paudetseis commented 2 years ago

Dear @maralves - I have tried converting your file x.GRD to an ASCII file using GMT, but I get the same error as you. It looks like the file is not properly formatted. Can you please share the information on how this file was generated? Thanks

maralves commented 2 years ago

Dear @maralves - I have tried converting your file x.GRD to an ASCII file using GMT, but I get the same error as you. It looks like the file is not properly formatted. Can you please share the information on how this file was generated? Thanks

clear! the program oasis montaj was used to generate the grd, however the program also generates xyz and txt if it is easier to use we can try

WhatsApp Image 2022-09-26 at 14 12 52

23pikachu commented 4 months ago

good afternoon everyone!

Guys, next: I managed to install everything just right, but I'm having trouble reading my generated file, I opened the "Topo_NA" file of the examples left, and compared it with mine, and then the following question came to me: where was it extracted from , or how to calculate that part of the top that you have in the example file?

ETOPO1_NA.grd 0 6805.75136468 0 6819.00580269 -8302.53808594 3603.22363281 20.0169157785 19.9970844654 341 342

0 6819.00580269 -31.3442268372

the only difference between my file and the example is: it doesn't have the top, I saw that it has nx,ny and some information passed in the example file, but where does that come from? if anyone can give me a tip i would appreciate it. thanks!

teste

Hi Maralves, which version of fortran compiler and theano you downloaded for the plateflex? Beacuse I keep getting the compilation error while importing plateflex

I installed plateflex using this command conda create -n pflex2 python=3.8 fortran-compiler numpy=1.21.2 pymc3=3.10.0 matplotlib=3.4.3 seaborn=0.11.2 scikit-image=0.18.3 pandas=1.3.2 -c conda-forge

You can find the C code in this temporary file: /tmp/theano_compilation_error_gc3zdjxa library inux-gnu/sysroot/usr/include/limits.h:27, is not found. library inux-gnu/sysroot/usr/include/features.h:327: is not found. library ine>: is not found. library inux-gnu/sysroot/usr/include/features.h:328: is not found. library inux-gnu/sysroot/usr/include/features.h:331: is not found. library inux-gnu/libm.so.6: is not found. library inux-gnu/libm.so.6 is not found. library inux-gnu/libm.so.6 is not found. library inux-gnu/libm.so.6 is not found. library inux-gnu/libm.so.6: is not found. library inux-gnu/libm.so.6 is not found. library inux-gnu/libm.so.6 is not found. library inux-gnu/libmvec.so.1: is not found. library inux-gnu/libmvec.so.1 is not found. library inux-gnu/libmvec.so.1 is not found. library inux-gnu/libmvec.so.1 is not found. library inux-gnu/libmvec.so.1: is not found. library inux-gnu/libmvec.so.1 is not found. library inux-gnu/libmvec.so.1 is not found.


ImportError Traceback (most recent call last) File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/theano/gof/lazylinker_c.py:76 75 if version != actual_version: ---> 76 raise ImportError( 77 "Version check of the existing lazylinker compiled file." 78 " Looking for version %s, but found %s. " 79 "Extra debug information: force_compile=%s, _need_reload=%s" % ( 80 version, 81 actual_version, force_compile, _need_reload)) 82 except ImportError:

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last) File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/theano/gof/lazylinker_c.py:99 98 if version != actual_version: ---> 99 raise ImportError( 100 "Version check of the existing lazylinker compiled file." 101 " Looking for version %s, but found %s. " 102 "Extra debug information: force_compile=%s," 103 " _need_reload=%s" % ( 104 version, 105 actual_version, force_compile, _need_reload)) 106 except ImportError: 107 # It is useless to try to compile if there isn't any 108 # compiler! But we still want to try to load it, in case 109 # the cache was copied from another computer.

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

Exception Traceback (most recent call last) File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/theano/gof/vm.py:674 673 raise theano.gof.cmodule.MissingGXX('lazylinker will not be imported if theano.config.cxx is not set.') --> 674 from . import lazylinker_c 676 class CVM(lazylinker_c.CLazyLinker, VM):

File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/theano/gof/lazylinker_c.py:139 138 args = cmodule.GCC_compiler.compile_args() --> 139 cmodule.GCC_compiler.compile_str(dirname, code, location=loc, 140 preargs=args) 141 # Save version into the init.py file.

File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/theano/gof/cmodule.py:2410, in GCC_compiler.compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols) 2407 # We replace '\n' by '. ' in the error message because when Python 2408 # prints the exception, having '\n' in the text makes it more 2409 # difficult to read. -> 2410 raise Exception('Compilation failed (return status=%s): %s' % 2411 (status, compile_stderr.replace('\n', '. '))) 2412 elif config.cmodule.compilation_warning and compile_stderr: 2413 # Print errors just below the command line.

Exception: Compilation failed (return status=1): In file included from /home/manoj/miniconda3/envs/pflex/x86_64-conda-linux-gnu/sysroot/usr/include/limits.h:27,. from /home/manoj/miniconda3/envs/pflex1/include/python3.8/Python.h:11,. from /home/manoj/.theano/compiledir_Linux-6.8--generic-x86_64-with-glibc2.10-x86_64-3.8.19-64/lazylinker_ext/mod.cpp:1:. /home/manoj/miniconda3/envs/pflex/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:327: warning: "STDC_IEC_559" redefined. 327 | #define STDC_IEC_559 1. | . In file included from :. /usr/include/stdc-predef.h:38: note: this is the location of the previous definition. 38 | # define STDC_IEC_559 1. | . /home/manoj/miniconda3/envs/pflex/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:328: warning: "STDC_IEC_559_COMPLEX" redefined. 328 | #define STDC_IEC_559_COMPLEX 1. | . /usr/include/stdc-predef.h:48: note: this is the location of the previous definition. 48 | # define STDC_IEC_559_COMPLEX__ 1. | . /home/manoj/miniconda3/envs/pflex/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:331: warning: "STDC_ISO_10646" redefined. 331 | #define STDC_ISO_10646 200009L. | . /usr/include/stdc-predef.h:62: note: this is the location of the previous definition. 62 | #define STDC_ISO_10646__ 201706L. | . /home/manoj/miniconda3/envs/pflex1/bin/ld: /lib/x86_64-linux-gnu/libm.so.6: unknown type [0x13] section .relr.dyn'. /home/manoj/miniconda3/envs/pflex1/bin/ld: skipping incompatible /lib/x86_64-linux-gnu/libm.so.6 when searching for /lib/x86_64-linux-gnu/libm.so.6. /home/manoj/miniconda3/envs/pflex1/bin/ld: cannot find /lib/x86_64-linux-gnu/libm.so.6. /home/manoj/miniconda3/envs/pflex1/bin/ld: /lib/x86_64-linux-gnu/libm.so.6: unknown type [0x13] section.relr.dyn'. /home/manoj/miniconda3/envs/pflex1/bin/ld: skipping incompatible /lib/x86_64-linux-gnu/libm.so.6 when searching for /lib/x86_64-linux-gnu/libm.so.6. /home/manoj/miniconda3/envs/pflex1/bin/ld: /lib/x86_64-linux-gnu/libmvec.so.1: unknown type [0x13] section .relr.dyn'. /home/manoj/miniconda3/envs/pflex1/bin/ld: skipping incompatible /lib/x86_64-linux-gnu/libmvec.so.1 when searching for /lib/x86_64-linux-gnu/libmvec.so.1. /home/manoj/miniconda3/envs/pflex1/bin/ld: cannot find /lib/x86_64-linux-gnu/libmvec.so.1. /home/manoj/miniconda3/envs/pflex1/bin/ld: /lib/x86_64-linux-gnu/libmvec.so.1: unknown type [0x13] section.relr.dyn'. /home/manoj/miniconda3/envs/pflex1/bin/ld: skipping incompatible /lib/x86_64-linux-gnu/libmvec.so.1 when searching for /lib/x86_64-linux-gnu/libmvec.so.1. collect2: error: ld returned 1 exit status.

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last) Cell In[2], line 1 ----> 1 import plateflex

File ~/PlateFlex/plateflex/init.py:157 155 # -- coding: utf-8 -- 156 from . import conf as cf --> 157 from . import estimate 158 from . import plotting 159 from .classes import Grid, TopoGrid, GravGrid, BougGrid, FairGrid

File ~/PlateFlex/plateflex/estimate.py:56 54 # -- coding: utf-8 -- 55 import numpy as np ---> 56 import pymc3 as pm 57 from plateflex.flex import flex 58 from plateflex import conf as cf

File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/pymc3/init.py:39 35 current = theano.config.gcc.cxxflags 36 theano.config.gcc.cxxflags = f"{current} -Wno-c++11-narrowing" ---> 39 __set_compiler_flags() 41 from . import gp, ode, sampling 42 from .backends import load_trace, save_trace

File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/pymc3/init.py:33, in set_compiler_flags() 31 def set_compiler_flags(): 32 # Workarounds for Theano compiler problems on various platforms ---> 33 import theano 35 current = theano.config.gcc.cxxflags 36 theano.config.gcc.cxxflags = f"{current} -Wno-c++11-narrowing"

File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/theano/init.py:110 97 __api_version__ = 1 99 from theano.gof import ( 100 CLinker, OpWiseCLinker, DualLinker, Linker, LocalLinker, PerformLinker, 101 Container, (...) 107 Type, Generic, generic, 108 object2, utils) --> 110 from theano.compile import ( 111 SymbolicInput, In, 112 SymbolicOutput, Out, 113 Mode, 114 predefined_modes, predefined_linkers, predefined_optimizers, 115 FunctionMaker, function, function_dump, 116 OpFromGraph, 117 ProfileStats, 118 Param, shared, as_op) 120 from theano.misc.safe_asarray import _asarray 122 from theano.printing import pprint, pp

File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/theano/compile/init.py:12 2 from theano.compile.ops import ( 3 DeepCopyOp, deep_copy_op, register_deep_copy_op_c_code, 4 Shape, shape, register_shape_c_code, (...) 7 as_op, Rebroadcast, register_rebroadcast_c_code, 8 SpecifyShape, specify_shape, register_specify_shape_c_code) 10 from theano.compile.function_module import ---> 12 from theano.compile.mode import 14 from theano.compile.io import * 16 from theano.compile.debugmode import DebugMode

File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/theano/compile/mode.py:11 9 import theano 10 from theano import gof ---> 11 import theano.gof.vm 12 from theano import config 13 from six import string_types

File ~/miniconda3/envs/pflex1/lib/python3.8/site-packages/theano/gof/vm.py:683 681 except ImportError: 682 pass --> 683 except (OSError, theano.gof.cmodule.MissingGXX) as e: 684 # OSError happens when g++ is not installed. In that case, we 685 # already changed the default linker to something else then CVM. 686 # Currently this is the py linker. 687 # Here we assert that the default linker is not cvm. 688 assert not [x for x in _config_var_list 689 if x.fullname == 'linker'][0].default.startswith('cvm'), e 690 pass

AttributeError: partially initialized module 'theano' has no attribute 'gof' (most likely due to a circular import)

Can you please guide me to fix the above issue?